diff --git a/Build-Toolkit-Components.ps1 b/Build-Toolkit-Components.ps1 index c461bddd..97dface1 100644 --- a/Build-Toolkit-Components.ps1 +++ b/Build-Toolkit-Components.ps1 @@ -95,6 +95,10 @@ Param ( [switch]$Verbose ) +# Use the specified MultiTarget TFM and WinUI version +& $PSScriptRoot\MultiTarget\UseUnoWinUI.ps1 $WinUIMajorVersion +& $PSScriptRoot\MultiTarget\UseTargetFrameworks.ps1 -MultiTargets $MultiTargets -ExcludeMultiTargets $ExcludeMultiTargets + if ($MultiTargets -eq 'all') { $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') } @@ -128,10 +132,6 @@ if ($ExcludeComponents) { $Components = $Components | Where-Object { $_ -notin $ExcludeComponents } } -# Use the specified MultiTarget TFM and WinUI version -& $PSScriptRoot\MultiTarget\UseTargetFrameworks.ps1 $MultiTargets -& $PSScriptRoot\MultiTarget\UseUnoWinUI.ps1 $WinUIMajorVersion - function Invoke-MSBuildWithBinlog { param ( [string]$TargetHeadPath diff --git a/MultiTarget/AvailableMultiTargets.props b/MultiTarget/AvailableMultiTargets.props new file mode 100644 index 00000000..efd9fe51 --- /dev/null +++ b/MultiTarget/AvailableMultiTargets.props @@ -0,0 +1,18 @@ + + + + true + + + + + + + + + + + + $(AvailableMultiTargets);$(MultiTarget) + + diff --git a/MultiTarget/AvailableTargetFrameworks.props b/MultiTarget/AvailableTargetFrameworks.props index 9d9b5869..7d5afb3d 100644 --- a/MultiTarget/AvailableTargetFrameworks.props +++ b/MultiTarget/AvailableTargetFrameworks.props @@ -1,22 +1,29 @@ + - uap10.0.17763; - uap10.0.17763;net8.0-windows10.0.26100.0; - net9.0-windows10.0.19041.0;net8.0-windows10.0.19041.0; + uap10.0.17763; + + + uap10.0.17763;net8.0-windows10.0.26100.0;net9.0-windows10.0.26100.0; + net9.0-windows10.0.19041.0;net8.0-windows10.0.19041.0; net9.0; net9.0; net9.0; - net9.0-android; - net9.0-maccatalyst; - net9.0-ios; + net9.0-android; + net9.0-maccatalyst; + net9.0-ios; - net9.0; - net9.0; - net9.0; + net9.0; + net9.0; + net9.0; netstandard2.0 diff --git a/MultiTarget/EnabledMultiTargets.props b/MultiTarget/EnabledMultiTargets.props index 3781585e..47de0231 100644 --- a/MultiTarget/EnabledMultiTargets.props +++ b/MultiTarget/EnabledMultiTargets.props @@ -1,14 +1,7 @@ - + + - true + wasm;uwp;netstandard - - - - - - - - diff --git a/MultiTarget/EnabledTargetFrameworks.props b/MultiTarget/EnabledTargetFrameworks.props index 93819344..6f1c0ab9 100644 --- a/MultiTarget/EnabledTargetFrameworks.props +++ b/MultiTarget/EnabledTargetFrameworks.props @@ -1,25 +1,26 @@ - - - - uap10.0.17763; - uap10.0.17763;net8.0-windows10.0.26100.0; - - - net9.0; - net9.0; - net9.0; - - - - + + + + $(TargetFrameworks);$(UwpTargetFrameworks) + $(TargetFrameworks);$(WinAppSdkTargetFrameworks) - - net9.0; - net9.0; - net9.0; + + true + true + $(TargetFrameworks);$(DotnetCommonTargetFramework) - - netstandard2.0 - net9.0; - + $(TargetFrameworks);$(MacOSLibTargetFrameworks) + $(TargetFrameworks);$(iOSLibTargetFrameworks) + $(TargetFrameworks);$(AndroidLibTargetFrameworks) + + $(TargetFrameworks);$(DotnetStandardCommonTargetFramework) + diff --git a/MultiTarget/Library.props b/MultiTarget/Library.props index eb6e079e..61ab36c8 100644 --- a/MultiTarget/Library.props +++ b/MultiTarget/Library.props @@ -5,13 +5,14 @@ false - + + + + - - - + diff --git a/MultiTarget/MultiTargetIdentifiers.props b/MultiTarget/MultiTargetIdentifiers.props index b3593f37..a16f7190 100644 --- a/MultiTarget/MultiTargetIdentifiers.props +++ b/MultiTarget/MultiTargetIdentifiers.props @@ -19,36 +19,36 @@ - true - true - true - true - true - true - true - true - true + true + true + true + true + true + true + true + true + true true - true + true true true - true + true true true - true + true true - true - true + true + true $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - true - true - true + true + true + true true true @@ -64,6 +64,11 @@ false true - true + + true diff --git a/MultiTarget/MultiTargetToTargetFramework.props b/MultiTarget/MultiTargetToTargetFramework.props deleted file mode 100644 index 66819d5f..00000000 --- a/MultiTarget/MultiTargetToTargetFramework.props +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - $(TargetFrameworks);$(UwpTargetFramework) - $(TargetFrameworks);$(WinAppSdkTargetFramework) - - - $(TargetFrameworks);$(DotnetCommonTargetFramework) - $(TargetFrameworks);$(MacOSLibTargetFramework) - $(TargetFrameworks);$(iOSLibTargetFramework) - $(TargetFrameworks);$(AndroidLibTargetFramework) - - $(TargetFrameworks);$(DotnetStandardCommonTargetFramework) - - diff --git a/MultiTarget/UseTargetFrameworks.ps1 b/MultiTarget/UseTargetFrameworks.ps1 index 2f84ee54..568e15d6 100644 --- a/MultiTarget/UseTargetFrameworks.ps1 +++ b/MultiTarget/UseTargetFrameworks.ps1 @@ -31,87 +31,31 @@ Param ( [string[]]$ExcludeMultiTargets = @() # default settings ) -$UwpTfm = "UwpTargetFramework"; -$WinAppSdkTfm = "WinAppSdkTargetFramework"; -$WasmTfm = "DotnetCommonTargetFramework"; -$WpfTfm = "DotnetCommonTargetFramework"; -$GtkTfm = "DotnetCommonTargetFramework"; -$macOSTfm = "MacOSLibTargetFramework"; -$iOSTfm = "iOSLibTargetFramework"; -$DroidTfm = "AndroidLibTargetFramework"; -$NetstandardTfm = "DotnetStandardCommonTargetFramework"; - -$fileContents = Get-Content -Path $PSScriptRoot/AvailableTargetFrameworks.props +$fileContents = Get-Content -Path $PSScriptRoot/EnabledMultiTargets.props $newFileContents = $fileContents; -# 'all' represents many '$MultiTargets' values -if ($MultiTargets.Contains("all")) { - $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') -} +$AllMultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') # Exclude as needed foreach ($excluded in $ExcludeMultiTargets) { $MultiTargets = $MultiTargets.Where({ $_ -ne $excluded }); } -Write-Output "Setting enabled TargetFrameworks: $MultiTargets" - -$desiredTfmValues = @(); - -if ($MultiTargets.Contains("wasm")) { - $desiredTfmValues += $WasmTfm; -} +Write-Output "Setting enabled MultiTargets: $MultiTargets" -if ($MultiTargets.Contains("uwp")) { - $desiredTfmValues += $UwpTfm; -} - -if ($MultiTargets.Contains("wasdk")) { - $desiredTfmValues += $WinAppSdkTfm; -} - -if ($MultiTargets.Contains("wpf")) { - $desiredTfmValues += $WpfTfm; -} - -if ($MultiTargets.Contains("linuxgtk")) { - $desiredTfmValues += $GtkTfm; -} - -if ($MultiTargets.Contains("macos")) { - $desiredTfmValues += $macOSTfm; -} - -if ($MultiTargets.Contains("ios")) { - $desiredTfmValues += $iOSTfm; +# 'all' represents all available '$MultiTargets' values +if ($MultiTargets.Contains("all")) { + $enabledMultiTargets = @('$(AvailableMultiTargets)') } - -if ($MultiTargets.Contains("android")) { - $desiredTfmValues += $DroidTfm; +else { + $enabledMultiTargets = $AllMultiTargets.Where({ $MultiTargets.Contains($_) }) -join ";" } -if ($MultiTargets.Contains("netstandard")) { - $desiredTfmValues += $NetstandardTfm; -} - -$targetFrameworksToRemove = @( - $WasmTfm, - $UwpTfm, - $WinAppSdkTfm, - $WpfTfm, - $GtkTfm, - $macOSTfm, - $iOSTfm, - $DroidTfm, - $NetstandardTfm -).Where({ -not $desiredTfmValues.Contains($_) }) - -# When targetFrameworksToRemoveRegexPartial is empty, the regex will match everything. +# When enabledMultiTargetsRegexPartial is empty, the regex will match everything. # To work around this, check if there's anything to remove before doing it. -if ($targetFrameworksToRemove.Length -gt 0) { - $targetFrameworksToRemoveRegexPartial = "$($targetFrameworksToRemove -join "|")"; - $newFileContents = $fileContents -replace "<(?:$targetFrameworksToRemoveRegexPartial).+?>.+?>", ''; +if ($enabledMultiTargets.Length -gt 0) { + $newFileContents = $fileContents -replace "\(.+?)\<\/EnabledMultiTargets\>", "$enabledMultiTargets"; } -Set-Content -Force -Path $PSScriptRoot/EnabledTargetFrameworks.props -Value $newFileContents; +Set-Content -Force -Path $PSScriptRoot/EnabledMultiTargets.props -Value $newFileContents; Write-Output "Done. Please close and regenerate your solution. Do not commit these changes to the tooling repository." \ No newline at end of file diff --git a/ProjectHeads/AllComponents/Tests.Uwp/CommunityToolkit.Tests.Uwp.csproj b/ProjectHeads/AllComponents/Tests.Uwp/CommunityToolkit.Tests.Uwp.csproj index b0d2b247..4c9ad813 100644 --- a/ProjectHeads/AllComponents/Tests.Uwp/CommunityToolkit.Tests.Uwp.csproj +++ b/ProjectHeads/AllComponents/Tests.Uwp/CommunityToolkit.Tests.Uwp.csproj @@ -9,7 +9,10 @@ 2 + + + diff --git a/ProjectHeads/AllComponents/Tests.Wasdk/CommunityToolkit.Tests.Wasdk.csproj b/ProjectHeads/AllComponents/Tests.Wasdk/CommunityToolkit.Tests.Wasdk.csproj index 4dc9d99b..01c0a936 100644 --- a/ProjectHeads/AllComponents/Tests.Wasdk/CommunityToolkit.Tests.Wasdk.csproj +++ b/ProjectHeads/AllComponents/Tests.Wasdk/CommunityToolkit.Tests.Wasdk.csproj @@ -7,7 +7,10 @@ 3 + + + diff --git a/ProjectHeads/AllComponents/Wasdk/CommunityToolkit.App.Wasdk.csproj b/ProjectHeads/AllComponents/Wasdk/CommunityToolkit.App.Wasdk.csproj index 2808bfd3..ed800138 100644 --- a/ProjectHeads/AllComponents/Wasdk/CommunityToolkit.App.Wasdk.csproj +++ b/ProjectHeads/AllComponents/Wasdk/CommunityToolkit.App.Wasdk.csproj @@ -9,7 +9,10 @@ true + + + diff --git a/ProjectHeads/AllComponents/Wasm/CommunityToolkit.App.Wasm.csproj b/ProjectHeads/AllComponents/Wasm/CommunityToolkit.App.Wasm.csproj index cb846c4d..f1bc44a9 100644 --- a/ProjectHeads/AllComponents/Wasm/CommunityToolkit.App.Wasm.csproj +++ b/ProjectHeads/AllComponents/Wasm/CommunityToolkit.App.Wasm.csproj @@ -8,9 +8,13 @@ true true + wasm + + + diff --git a/ProjectHeads/App.Head.Uwp.props b/ProjectHeads/App.Head.Uwp.props index 1e5bc91c..a2230460 100644 --- a/ProjectHeads/App.Head.Uwp.props +++ b/ProjectHeads/App.Head.Uwp.props @@ -2,7 +2,7 @@ - $(UwpTargetFramework.Split(';')[0]) + $(UwpTargetFrameworks.Split(';')[0]) Uwp diff --git a/ProjectHeads/Head.WinAppSdk.props b/ProjectHeads/Head.WinAppSdk.props index 8df952db..35068376 100644 --- a/ProjectHeads/Head.WinAppSdk.props +++ b/ProjectHeads/Head.WinAppSdk.props @@ -1,7 +1,7 @@ WinExe - $(WinAppSdkTargetFramework.Split(';')[0]) + $(WinAppSdkTargetFrameworks.Split(';')[0]) x86;x64;arm64 win-$(Platform).pubxml true diff --git a/ProjectHeads/SingleComponent/Tests.Uwp/ProjectTemplate.Tests.Uwp.csproj b/ProjectHeads/SingleComponent/Tests.Uwp/ProjectTemplate.Tests.Uwp.csproj index 86fdc50d..8e90b9ea 100644 --- a/ProjectHeads/SingleComponent/Tests.Uwp/ProjectTemplate.Tests.Uwp.csproj +++ b/ProjectHeads/SingleComponent/Tests.Uwp/ProjectTemplate.Tests.Uwp.csproj @@ -11,7 +11,10 @@ true + + + diff --git a/ProjectHeads/SingleComponent/Tests.Wasdk/ProjectTemplate.Tests.Wasdk.csproj b/ProjectHeads/SingleComponent/Tests.Wasdk/ProjectTemplate.Tests.Wasdk.csproj index d57ef304..872db0c3 100644 --- a/ProjectHeads/SingleComponent/Tests.Wasdk/ProjectTemplate.Tests.Wasdk.csproj +++ b/ProjectHeads/SingleComponent/Tests.Wasdk/ProjectTemplate.Tests.Wasdk.csproj @@ -9,7 +9,10 @@ true + + + diff --git a/ProjectHeads/SingleComponent/Uwp/ProjectTemplate.Uwp.csproj b/ProjectHeads/SingleComponent/Uwp/ProjectTemplate.Uwp.csproj index fcd81198..4b86ee92 100644 --- a/ProjectHeads/SingleComponent/Uwp/ProjectTemplate.Uwp.csproj +++ b/ProjectHeads/SingleComponent/Uwp/ProjectTemplate.Uwp.csproj @@ -11,7 +11,10 @@ true + + + diff --git a/ProjectHeads/SingleComponent/Wasdk/ProjectTemplate.Wasdk.csproj b/ProjectHeads/SingleComponent/Wasdk/ProjectTemplate.Wasdk.csproj index 55b62098..763fd650 100644 --- a/ProjectHeads/SingleComponent/Wasdk/ProjectTemplate.Wasdk.csproj +++ b/ProjectHeads/SingleComponent/Wasdk/ProjectTemplate.Wasdk.csproj @@ -10,7 +10,12 @@ true + + + + + diff --git a/ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj b/ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj index 25f62528..701313e8 100644 --- a/ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj +++ b/ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj @@ -11,8 +11,11 @@ - + + + +