Skip to content

Commit

Permalink
Add net8-windows target. (#300)
Browse files Browse the repository at this point in the history
* Add net8-windows target.

* Publish net8 artifact mirror.
  • Loading branch information
Kagamia authored Dec 27, 2024
1 parent 7035f34 commit 95380c5
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 27 deletions.
19 changes: 15 additions & 4 deletions Build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,23 @@
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
<RunAnalyzers>false</RunAnalyzers>
</PropertyGroup>

<!-- net6+ -->
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(TargetFramework), '^net[6-8]'))">

<!-- net6 -->
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(TargetFramework), '^net8'))">
<ImplicitUsings>disable</ImplicitUsings>
<NoWarn>CA1416</NoWarn>
<DotnetEdition>core</DotnetEdition>
<MonogameFrameworkVersion>3.8.2.1105</MonogameFrameworkVersion>
<SystemDrawingCommonVersion>8.0.11</SystemDrawingCommonVersion>
</PropertyGroup>

<!-- net6 -->
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(TargetFramework), '^net6'))">
<ImplicitUsings>disable</ImplicitUsings>
<NoWarn>CA1416</NoWarn>
<DotnetEdition>core</DotnetEdition>
<MonogameFrameworkVersion>3.8.1.303</MonogameFrameworkVersion>
<SystemDrawingCommonVersion>6.0.0</SystemDrawingCommonVersion>
</PropertyGroup>

<!-- net framework -->
Expand All @@ -29,9 +39,10 @@
<MonogameFrameworkVersion>3.8.0.1641</MonogameFrameworkVersion>
</PropertyGroup>

<!-- net framework -->
<!-- common -->
<PropertyGroup>
<SharpDXVersion>4.2.0</SharpDXVersion>
<SystemResourcesExtensionsVersion>8.0.0</SystemResourcesExtensionsVersion>
</PropertyGroup>

<!-- plugin specified property -->
Expand Down
2 changes: 1 addition & 1 deletion CharaSimResource
Binary file modified References/IMEHelper.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions WzComparerR2.Avatar/WzComparerR2.Avatar.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>WzComparerR2.Avatar</AssemblyName>
<RootNamespace>WzComparerR2.Avatar</RootNamespace>
Expand Down Expand Up @@ -47,7 +47,7 @@
<HintPath>..\References\DevComponents.DotNetBar2.dll</HintPath>
<Private>false</Private>
</Reference>
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" ExcludeAssets="runtime" />
<PackageReference Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsVersion)" ExcludeAssets="runtime" />
</ItemGroup>
<ItemGroup Condition="Exists('..\Build\CommonAssemblyInfo.cs')">
<Compile Include="..\Build\CommonAssemblyInfo.cs">
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion WzComparerR2.Common/WzComparerR2.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>WzComparerR2.Common</AssemblyName>
<RootNamespace>WzComparerR2</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion WzComparerR2.LuaConsole/WzComparerR2.LuaConsole.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>WzComparerR2.LuaConsole</AssemblyName>
<RootNamespace>WzComparerR2.LuaConsole</RootNamespace>
Expand Down
9 changes: 3 additions & 6 deletions WzComparerR2.MapRender/FrmMapRender2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public FrmMapRender2()
this.TargetElapsedTime = TimeSpan.FromSeconds(1.0 / 60);
this.InactiveSleepTime = TimeSpan.FromSeconds(1.0 / 30);
this.IsMouseVisible = true;
this.Exiting += (o, e) => this.OnExiting();

this.Content = new WcR2ContentManager(this.Services);
this.patchVisibility = new PatchVisibility();
Expand All @@ -55,6 +56,8 @@ public FrmMapRender2()
form.FormClosed += Form_FormClosed;

this.imeHelper = new IMEHandler(this, true);
this.Exiting += (o, e) => this.imeHelper.Dispose();
this.Disposed += (o, e) => this.imeHelper.Dispose();
GameExt.FixKeyboard(this);
}

Expand Down Expand Up @@ -1129,12 +1132,6 @@ protected override void UnloadContent()
}
}

protected override void OnExiting(object sender, EventArgs args)
{
base.OnExiting(sender, args);
this.OnExiting();
}

private void OnExiting()
{
if (this.isExiting)
Expand Down
4 changes: 2 additions & 2 deletions WzComparerR2.MapRender/WzComparerR2.MapRender.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>WzComparerR2.MapRender</AssemblyName>
<RootNamespace>WzComparerR2.MapRender</RootNamespace>
Expand Down Expand Up @@ -66,7 +66,7 @@
<PackageReference Include="ManagedBass" Version="3.1.1" ExcludeAssets="runtime" />
<PackageReference Include="SharpDX" Version="$(SharpDXVersion)" ExcludeAssets="runtime" />
<PackageReference Include="SharpDX.RawInput" Version="$(SharpDXVersion)" NoWarn="NU1701" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" ExcludeAssets="runtime" />
<PackageReference Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsVersion)" ExcludeAssets="runtime" />
</ItemGroup>
<ItemGroup Condition="Exists('..\Build\CommonAssemblyInfo.cs')">
<Compile Include="..\Build\CommonAssemblyInfo.cs">
Expand Down
2 changes: 1 addition & 1 deletion WzComparerR2.Network/WzComparerR2.Network.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>WzComparerR2.Network</AssemblyName>
<RootNamespace>WzComparerR2.Network</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion WzComparerR2.PluginBase/WzComparerR2.PluginBase.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>WzComparerR2.PluginBase</AssemblyName>
<RootNamespace>WzComparerR2.PluginBase</RootNamespace>
Expand Down
4 changes: 2 additions & 2 deletions WzComparerR2.WzLib/WzComparerR2.WzLib.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0;net8.0</TargetFrameworks>
<AssemblyName>WzComparerR2.WzLib</AssemblyName>
<RootNamespace>WzComparerR2.WzLib</RootNamespace>
<IsPublishable>false</IsPublishable>
Expand All @@ -15,7 +15,7 @@
<PropertyGroup Condition="$(DotnetEdition) == 'framework'">
</PropertyGroup>
<ItemGroup Condition="$(DotnetEdition) == 'core'">
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommonVersion)" />
</ItemGroup>
<ItemGroup Condition="$(DotnetEdition) == 'framework'">
<Reference Include="System" />
Expand Down
7 changes: 4 additions & 3 deletions WzComparerR2/WzComparerR2.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net462;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>WzComparerR2</AssemblyName>
<RootNamespace>WzComparerR2</RootNamespace>
Expand All @@ -20,7 +20,8 @@
</PropertyGroup>
<ItemGroup Condition="$(DotnetEdition) == 'core'">
<!-- patching dotnetbar on net6 -->
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
<PackageReference Include="Lib.Harmony" Version="2.3.3" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<!-- upgrade indirect dependency of SharpDX to prevent too many runtime libraries -->
<PackageReference Include="Microsoft.NETCore.App" Version="2.1.30" />
</ItemGroup>
Expand All @@ -44,7 +45,7 @@
<PackageReference Include="MonoGame.Framework.WindowsDX" Version="$(MonogameFrameworkVersion)" />
<PackageReference Include="SharpDX" Version="$(SharpDXVersion)" />
<PackageReference Include="ManagedBass" Version="3.1.1" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsVersion)" />
</ItemGroup>
<ItemGroup>
<Reference Include="DevComponents.DotNetBar2">
Expand Down
29 changes: 26 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ variables:
outputDir_netfx_anycpu: 'WzComparerR2/bin/release/net462'
outputDir_netfx_x86: 'WzComparerR2/bin/x86/release/net462'
outputDir_net6_anycpu: 'WzComparerR2/bin/release/net6.0-windows'
outputDir_net8_anycpu: 'WzComparerR2/bin/release/net8.0-windows'
outputFileName_netfx: 'WcR2_With_Plugins_$(Build.BuildNumber)'
outputFileName_net6: 'WcR2_With_Plugins_net6_$(Build.BuildNumber)'
outputFileName_net8: 'WcR2_With_Plugins_net8_$(Build.BuildNumber)'
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
accountName: 'wcr2publish'
containerName: 'ci-build'
Expand Down Expand Up @@ -70,6 +72,10 @@ steps:
move "$(outputDir_net6_anycpu)\*.dll" "$(outputDir_net6_anycpu)\Lib"
del "$(outputDir_net6_anycpu)\*.pdb"
move "$(outputDir_net6_anycpu)\Lib\WzComparerR2.dll" "$(outputDir_net6_anycpu)"
move "$(outputDir_net8_anycpu)\*.dll" "$(outputDir_net8_anycpu)\Lib"
del "$(outputDir_net8_anycpu)\*.pdb"
move "$(outputDir_net8_anycpu)\Lib\WzComparerR2.dll" "$(outputDir_net8_anycpu)"
failOnStderr: true

- task: ArchiveFiles@2
Expand All @@ -90,6 +96,15 @@ steps:
archiveFile: '$(Build.ArtifactStagingDirectory)/$(outputFileName_net6).zip'
replaceExistingArchive: true

- task: ArchiveFiles@2
displayName: Compress net8 release
inputs:
rootFolderOrFile: '$(outputDir_net8_anycpu)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(outputFileName_net8).zip'
replaceExistingArchive: true

- task: AzureCLI@2
displayName: Upload to blob
inputs:
Expand All @@ -106,19 +121,27 @@ steps:
"srcFile"="$(outputFileName_net6).zip"
"outputVariableName"="sasurl_net6"
}
@{
"srcFile"="$(outputFileName_net8).zip"
"outputVariableName"="sasurl_net8"
}
)
$expireDate = (Get-Date).ToUniversalTime().AddYears(1).ToString("yyyy-MM-dd'T'HH:mm:ss'Z'")
$time = (Get-Date).ToUniversalTime()
$expireDate = $time.AddYears(1).ToString("yyyy-MM-dd'T'HH:mm:ss'Z'")
$keys = ConvertFrom-Json ((az storage account keys list --account-name $(accountName)) -join "")
$accountKey = $keys[0].value
$commitID = "$(Build.SourceVersion)"
$buildID = "$(Build.BuildNumber)"
$uploadTime = $time.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'")
foreach ($f in $files) {
$srcFile = "$(Build.ArtifactStagingDirectory)/{0}" -f $f.srcFile
$dstFile = $f.srcFile
$varName = $f.outputVariableName
Write-Host "Uploading ${srcFile} ..."
az storage blob upload --auth-mode login --account-name $(accountName) --container-name $(containerName) --name $dstFile --file $srcFile
az storage blob upload --auth-mode login --account-name $(accountName) --container-name $(containerName) --name $dstFile --file $srcFile --tags "commitID=$commitID" "buildID=$buildID" "uploadTime=$uploadTime"
Write-Host "Generate sas url..."
$url = ConvertFrom-Json (az storage blob url --auth-mode login --account-name $(accountName) --container-name $(containerName) --name $dstFile)
Expand Down Expand Up @@ -158,6 +181,6 @@ steps:
releaseNotesSource: 'inline'
releaseNotesInline: |
Automation build from azure-pipeline.
Mirror: [[WcR2.netfx.zip]($(sasurl_netfx))] | [[WcR2.net6.zip]($(sasurl_net6))]
Mirror: [[WcR2.netfx.zip]($(sasurl_netfx))] | [[WcR2.net6.zip]($(sasurl_net6))] | [[WcR2.net8.zip]($(sasurl_net8))]
isPreRelease: false
addChangeLog: false

0 comments on commit 95380c5

Please sign in to comment.