Skip to content

Commit 22c4f1a

Browse files
committed
Enable MTP mode
1 parent 9f8d9a3 commit 22c4f1a

File tree

6 files changed

+38
-24
lines changed

6 files changed

+38
-24
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ jobs:
6363

6464
- name: Run unit tests windows
6565
if: matrix.os == 'windows-latest'
66-
env:
67-
RuntimeIdentifier: win
68-
run: dotnet test -c ${{ env.configuration }}
66+
run: dotnet test -c ${{ env.configuration }} -p:WChartTarget=win
6967
working-directory: './src'
7068

7169
- name: Build solution

src/WCharT.Net.Tests/WCharT.Net.Tests.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
<IsPackable>false</IsPackable>
44
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
55
<RootNamespace>WCharT.Tests</RootNamespace>
6+
7+
<!-- Enable MTP mode -->
8+
<OutputType>Exe</OutputType>
9+
<EnableMSTestRunner>true</EnableMSTestRunner>
10+
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
611
</PropertyGroup>
712

813
<ItemGroup>

src/WCharT.Net/WCharT.Net.csproj

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<RootNamespace>WCharT</RootNamespace>
2222
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
2323

24-
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'win'">$(DefineConstants);TARGET_WINDOWS</DefineConstants>
24+
<DefineConstants Condition="'$(WChartTarget)' == 'win'">$(DefineConstants);TARGET_WINDOWS</DefineConstants>
2525

2626
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
2727
<IncludeBuildOutput>false</IncludeBuildOutput>
@@ -36,15 +36,18 @@
3636
<None Include="../../readme.md" Pack="true" PackagePath="/" Visible="false"/>
3737

3838
<None Include="obj/Release/net8.0/ref/WCharT.Net.dll" Pack="true" PackagePath="ref/net8.0" Visible="false"/>
39-
<None Include="bin/Release/net8.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/unix/lib/net8.0" Visible="false"/>
40-
<None Include="bin/Release/net8.0/win/WCharT.Net.dll" Pack="true" PackagePath="runtimes/win/lib/net8.0" Visible="false"/>
39+
<None Include="bin/Release/net8.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/linux-x64/lib/net8.0" Visible="false"/>
40+
<None Include="bin/Release/net8.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/osx-x64/lib/net8.0" Visible="false"/>
41+
<None Include="bin/Release/net8.0/win/WCharT.Net.dll" Pack="true" PackagePath="runtimes/win-x64/lib/net8.0" Visible="false"/>
4142

4243
<None Include="obj/Release/net9.0/ref/WCharT.Net.dll" Pack="true" PackagePath="ref/net9.0" Visible="false"/>
43-
<None Include="bin/Release/net9.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/unix/lib/net9.0" Visible="false"/>
44-
<None Include="bin/Release/net9.0/win/WCharT.Net.dll" Pack="true" PackagePath="runtimes/win/lib/net9.0" Visible="false"/>
44+
<None Include="bin/Release/net9.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/linux-x64/lib/net9.0" Visible="false"/>
45+
<None Include="bin/Release/net9.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/osx-x64/lib/net9.0" Visible="false"/>
46+
<None Include="bin/Release/net9.0/win/WCharT.Net.dll" Pack="true" PackagePath="runtimes/win-x64/lib/net9.0" Visible="false"/>
4547

4648
<None Include="obj/Release/net10.0/ref/WCharT.Net.dll" Pack="true" PackagePath="ref/net10.0" Visible="false"/>
47-
<None Include="bin/Release/net10.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/unix/lib/net10.0" Visible="false"/>
48-
<None Include="bin/Release/net10.0/win/WCharT.Net.dll" Pack="true" PackagePath="runtimes/win/lib/net10.0" Visible="false"/>
49+
<None Include="bin/Release/net10.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/linux-x64/lib/net10.0" Visible="false"/>
50+
<None Include="bin/Release/net10.0/unix/WCharT.Net.dll" Pack="true" PackagePath="runtimes/osx-x64/lib/net10.0" Visible="false"/>
51+
<None Include="bin/Release/net10.0/win/WCharT.Net.dll" Pack="true" PackagePath="runtimes/win-x64/lib/net10.0" Visible="false"/>
4952
</ItemGroup>
5053
</Project>

src/WCharT.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<File Path="build.fsx" />
88
<File Path="Directory.Build.props" />
99
<File Path="Directory.Packages.props" />
10+
<File Path="global.json" />
1011
</Folder>
1112
<Folder Name="/src/">
1213
<Project Path="WCharT.Net.Tests/WCharT.Net.Tests.csproj" />

src/build.fsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
#r "nuget: SimpleExec, 12.0.0"
2-
open System
32
open SimpleExec
43

54
let wchartDir = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "WCharT.Net")
65

7-
//Create binary for Linux / Mac
8-
Command.Run(
9-
name = "dotnet",
10-
args = "build --runtime unix --configuration Release",
11-
workingDirectory = wchartDir
12-
)
6+
let configuration = "Release"
7+
let tfms = [ "net8.0"; "net9.0"; "net10.0" ]
138

14-
//Create binary for Windows
15-
Command.Run(
16-
name = "dotnet",
17-
args = "build --runtime win --configuration Release",
18-
workingDirectory = wchartDir
19-
)
9+
let buildVariant (tfm: string) (target: string) =
10+
let outputPath = $"bin/{configuration}/{tfm}/{target}/"
11+
12+
Command.Run(
13+
name = "dotnet",
14+
args = $"build -c {configuration} -f {tfm} -p:WChartTarget={target} -p:OutputPath={outputPath}",
15+
workingDirectory = wchartDir
16+
)
17+
18+
//Create platform-specific binaries
19+
for tfm in tfms do
20+
buildVariant tfm "unix"
21+
buildVariant tfm "win"
2022

2123
//Create reference assembly for AnyCPU
2224
Command.Run(
2325
name = "dotnet",
24-
args = "build --configuration Release",
26+
args = $"build -c {configuration}",
2527
workingDirectory = wchartDir
2628
)

src/global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"test": {
3+
"runner": "Microsoft.Testing.Platform"
4+
}
5+
}

0 commit comments

Comments
 (0)