diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 2817fea9..5a513e11 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "uno.check": { - "version": "1.20.2", + "version": "1.27.1", "commands": [ "uno-check" ] diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c8987eb9..6935449f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,8 +1,5 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.208.0/containers/dotnet/.devcontainer/base.Dockerfile - -# [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.0-focal, 3.1-focal -ARG VARIANT="6.0-bullseye-slim" -FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} +# See https://github.com/devcontainers/images/tree/main/src/dotnet for image choices +FROM mcr.microsoft.com/vscode/devcontainers/dotnet:9.0 # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 ARG NODE_VERSION="none" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1ff6856c..f616c78f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "args": { // Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0 // Append -bullseye or -focal to pin to an OS version. - "VARIANT": "8.0", + "VARIANT": "9.0", // Options "NODE_VERSION": "lts/*" } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b7feb9f..07a81960 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,9 +16,7 @@ on: workflow_dispatch: env: - DOTNET_VERSION: ${{ '8.0.x' }} - DOTNET_INSTALL_DIR: dotnet-install - DOTNET_ROOT: dotnet-install + DOTNET_VERSION: ${{ '9.0.x' }} ENABLE_DIAGNOSTICS: false #COREHOST_TRACE: 1 COREHOST_TRACEFILE: corehosttrace.log @@ -142,6 +140,20 @@ jobs: # Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment new-experiment: runs-on: windows-latest + + strategy: + fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion. + matrix: + winui: [2, 3] + multitarget: ['uwp', 'wasdk', 'wasm'] + exclude: + # WinUI 2 not supported on wasdk + - winui: 2 + multitarget: wasdk + # WinUI 3 not supported on uwp + - winui: 3 + multitarget: uwp + env: HEADS_DIRECTORY: tooling/ProjectHeads PROJECT_DIRECTORY: tooling/ProjectTemplate @@ -202,7 +214,7 @@ jobs: - name: Add project heads to ${{ env.TEST_PROJECT_NAME }} working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }} - run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} + run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -MultiTargets ${{ matrix.multitarget }} -winui ${{ matrix.winui }} -componentPath "${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" - name: MSBuild working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }} @@ -217,18 +229,15 @@ jobs: with: domain: ${{ github.repository_owner }} - - name: Run tests in the generated experiment against UWP - id: test-uwp - run: vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }}/**/${{ env.TEST_PROJECT_NAME }}.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}UWP.trx" - - - name: Run tests in the generated experiment against WinAppSDK - id: test-winappsdk - run: vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }}/**/${{ env.TEST_PROJECT_NAME }}.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}WinAppSdk.trx" + - name: Run tests in the generated experiment against ${{ matrix.multitarget }} + if: ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }} + id: test-platform + run: vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }}/**/${{ env.TEST_PROJECT_NAME }}.Tests.${{ matrix.multitarget }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}${{ matrix.multitarget }}.trx" /Blame - name: Create test reports run: | testspace '[New Experiment]./TestResults/*.trx' - if: ${{ always() && (steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }} + if: ${{ (matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk') && (steps.test-platform.conclusion == 'success') }} - name: Artifact - Diagnostic Logs uses: actions/upload-artifact@v4 diff --git a/.github/workflows/config/Directory.Build.targets b/.github/workflows/config/Directory.Build.targets index b33f4330..5338f226 100644 --- a/.github/workflows/config/Directory.Build.targets +++ b/.github/workflows/config/Directory.Build.targets @@ -1,4 +1,9 @@ + + + + + diff --git a/Build-Toolkit-Components.ps1 b/Build-Toolkit-Components.ps1 index 2dea5d3a..c461bddd 100644 --- a/Build-Toolkit-Components.ps1 +++ b/Build-Toolkit-Components.ps1 @@ -67,7 +67,7 @@ Param ( [Alias("c")] [string[]]$Components = @("all"), - [string[]]$ExcludeComponents, + [string[]]$ExcludeComponents = @(), [string]$DateForVersion = (Get-Date -UFormat %y%m%d), @@ -104,6 +104,20 @@ if ($null -eq $ExcludeMultiTargets) $ExcludeMultiTargets = @() } +# Both uwp and wasdk share a targetframework. Both cannot be enabled at once. +# If both are supplied, remove one based on WinUIMajorVersion. +if ($MultiTargets.Contains('uwp') -and $MultiTargets.Contains('wasdk')) +{ + if ($WinUIMajorVersion -eq 2) + { + $ExcludeMultiTargets = $ExcludeMultiTargets + 'wasdk' + } + else + { + $ExcludeMultiTargets = $ExcludeMultiTargets + 'uwp' + } +} + $MultiTargets = $MultiTargets | Where-Object { $_ -notin $ExcludeMultiTargets } if ($Components -eq @('all')) { @@ -199,9 +213,14 @@ foreach ($ComponentName in $Components) { foreach ($componentCsproj in Get-ChildItem -Path "$PSScriptRoot/../components/$ComponentName/$ComponentDir/*.csproj") { # Get component name from csproj path $componentPath = Get-Item "$componentCsproj/../../" + $componentName = $($componentPath.BaseName); + + if ($componenName -in $ExcludeComponents) { + continue; + } # Get supported MultiTarget for this component - $supportedMultiTargets = & $PSScriptRoot\MultiTarget\Get-MultiTargets.ps1 -component $($componentPath.BaseName) + $supportedMultiTargets = & $PSScriptRoot\MultiTarget\Get-MultiTargets.ps1 -component $componentName # Flag to check if any of the requested targets are supported by the component $isTargetSupported = $false diff --git a/Build-Toolkit-Gallery.ps1 b/Build-Toolkit-Gallery.ps1 index b6fc3668..ec09ae91 100644 --- a/Build-Toolkit-Gallery.ps1 +++ b/Build-Toolkit-Gallery.ps1 @@ -87,6 +87,20 @@ if ($null -eq $ExcludeMultiTargets) $ExcludeMultiTargets = @() } +# Both uwp and wasdk share a targetframework. Both cannot be enabled at once. +# If both are supplied, remove one based on WinUIMajorVersion. +if ($MultiTargets.Contains('uwp') -and $MultiTargets.Contains('wasdk')) +{ + if ($WinUIMajorVersion -eq 2) + { + $ExcludeMultiTargets = $ExcludeMultiTargets + 'wasdk' + } + else + { + $ExcludeMultiTargets = $ExcludeMultiTargets + 'uwp' + } +} + if ($MultiTargets -eq 'all') { $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') } diff --git a/CommunityToolkit.App.Shared/Pages/GettingStartedPage.xaml b/CommunityToolkit.App.Shared/Pages/GettingStartedPage.xaml index 7da094ae..e8ad1ede 100644 --- a/CommunityToolkit.App.Shared/Pages/GettingStartedPage.xaml +++ b/CommunityToolkit.App.Shared/Pages/GettingStartedPage.xaml @@ -4,7 +4,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:behaviors="using:CommunityToolkit.App.Shared.Behaviors" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:interactions="using:Microsoft.Xaml.Interactions.Core" xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:local="using:CommunityToolkit.App.Shared" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -104,9 +103,9 @@ - + - + @@ -141,9 +140,9 @@ - + - + diff --git a/CommunityToolkit.App.Shared/Pages/SettingsPage.xaml.cs b/CommunityToolkit.App.Shared/Pages/SettingsPage.xaml.cs index 0c3ae26b..16205046 100644 --- a/CommunityToolkit.App.Shared/Pages/SettingsPage.xaml.cs +++ b/CommunityToolkit.App.Shared/Pages/SettingsPage.xaml.cs @@ -4,18 +4,17 @@ using Windows.ApplicationModel; -namespace CommunityToolkit.App.Shared.Pages +namespace CommunityToolkit.App.Shared.Pages; + +/// +/// An empty page that can be used on its own or navigated to within a Frame. +/// +public sealed partial class SettingsPage : Page { - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class SettingsPage : Page - { - public string AppVersion => $"Version {Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}"; + public string AppVersion => $"Version {Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}"; - public SettingsPage() - { - this.InitializeComponent(); - } + public SettingsPage() + { + this.InitializeComponent(); } } diff --git a/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml b/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml index f08262c1..ad3161af 100644 --- a/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml +++ b/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml @@ -5,7 +5,6 @@ xmlns:behaviors="using:CommunityToolkit.App.Shared.Behaviors" xmlns:converters="using:CommunityToolkit.WinUI.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:interactions="using:Microsoft.Xaml.Interactions.Core" xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:local="using:CommunityToolkit.App.Shared" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -216,9 +215,9 @@ Text="API doc" /> - + - + --> diff --git a/CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj b/CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj index a04a5fa1..3dc69337 100644 --- a/CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj +++ b/CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj @@ -9,10 +9,10 @@ - + - - + + diff --git a/CommunityToolkit.Tooling.TestGen.Tests/CommunityToolkit.Tooling.TestGen.Tests.csproj b/CommunityToolkit.Tooling.TestGen.Tests/CommunityToolkit.Tooling.TestGen.Tests.csproj index 42048be6..8c87f398 100644 --- a/CommunityToolkit.Tooling.TestGen.Tests/CommunityToolkit.Tooling.TestGen.Tests.csproj +++ b/CommunityToolkit.Tooling.TestGen.Tests/CommunityToolkit.Tooling.TestGen.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/GenerateAllSolution.ps1 b/GenerateAllSolution.ps1 index 1ef1efac..2b59293a 100644 --- a/GenerateAllSolution.ps1 +++ b/GenerateAllSolution.ps1 @@ -62,9 +62,23 @@ if ($null -eq $ExcludeMultiTargets) $ExcludeMultiTargets = @() } +# Both uwp and wasdk share a targetframework. Both cannot be enabled at once. +# If both are supplied, remove one based on WinUIMajorVersion. +if ($MultiTargets.Contains('uwp') -and $MultiTargets.Contains('wasdk')) +{ + if ($WinUIMajorVersion -eq 2) + { + $ExcludeMultiTargets = $ExcludeMultiTargets + 'wasdk' + } + else + { + $ExcludeMultiTargets = $ExcludeMultiTargets + 'uwp' + } +} + $MultiTargets = $MultiTargets | Where-Object { $_ -notin $ExcludeMultiTargets } -# Generate required props for "All" solution. +# Generate required props for "All" solution preferences. & ./tooling/MultiTarget/GenerateAllProjectReferences.ps1 -MultiTargets $MultiTargets -Components $Components -ExcludeComponents $ExcludeComponents & ./tooling/MultiTarget/UseTargetFrameworks.ps1 -MultiTargets $MultiTargets & ./tooling/MultiTarget/UseUnoWinUI.ps1 $WinUIMajorVersion diff --git a/MultiTarget/AvailableTargetFrameworks.props b/MultiTarget/AvailableTargetFrameworks.props index 837c10ec..9d9b5869 100644 --- a/MultiTarget/AvailableTargetFrameworks.props +++ b/MultiTarget/AvailableTargetFrameworks.props @@ -1,23 +1,25 @@ - uap10.0.17763 - net8.0-windows10.0.19041.0;net7.0-windows10.0.19041.0;net6.0-windows10.0.19041.0; + + uap10.0.17763; + uap10.0.17763;net8.0-windows10.0.26100.0; + net9.0-windows10.0.19041.0;net8.0-windows10.0.19041.0; - net8.0 - net8.0 - net8.0 + net9.0; + net9.0; + net9.0; - net8.0-android34.0 - net8.0-maccatalyst - net8.0-ios + net9.0-android; + net9.0-maccatalyst; + net9.0-ios; - net8.0 - net8.0 - net8.0 + net9.0; + net9.0; + net9.0; netstandard2.0 - net8.0 + net9.0; \ No newline at end of file diff --git a/MultiTarget/DefinedConstants.props b/MultiTarget/DefinedConstants.props index 41e955b7..b5c8c2c9 100644 --- a/MultiTarget/DefinedConstants.props +++ b/MultiTarget/DefinedConstants.props @@ -15,6 +15,7 @@ $(DefineConstants);HAS_UNO_SKIA;__SKIA__;WINDOWS_WPF; $(DefineConstants);HAS_UNO_SKIA;__SKIA__;__GTK__; + $(DefineConstants);NET9_0_OR_GREATER $(DefineConstants);NET8_0_OR_GREATER $(DefineConstants);NET7_0_OR_GREATER $(DefineConstants);NET6_0_OR_GREATER diff --git a/MultiTarget/EnabledTargetFrameworks.props b/MultiTarget/EnabledTargetFrameworks.props index ac1170df..93819344 100644 --- a/MultiTarget/EnabledTargetFrameworks.props +++ b/MultiTarget/EnabledTargetFrameworks.props @@ -1,23 +1,25 @@ - uap10.0.17763 - net8.0-windows10.0.19041.0;net7.0-windows10.0.19041.0;net6.0-windows10.0.19041.0; + + uap10.0.17763; + uap10.0.17763;net8.0-windows10.0.26100.0; - net8.0 - net8.0 - net8.0 + net9.0; + net9.0; + net9.0; + - net8.0 - net8.0 - net8.0 + net9.0; + net9.0; + net9.0; netstandard2.0 - net8.0 + net9.0; diff --git a/MultiTarget/Library.props b/MultiTarget/Library.props index 2967239e..11158154 100644 --- a/MultiTarget/Library.props +++ b/MultiTarget/Library.props @@ -16,6 +16,7 @@ + diff --git a/MultiTarget/MultiTargetIdentifiers.props b/MultiTarget/MultiTargetIdentifiers.props index 9faf2208..632d23e6 100644 --- a/MultiTarget/MultiTargetIdentifiers.props +++ b/MultiTarget/MultiTargetIdentifiers.props @@ -29,25 +29,27 @@ 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 true @@ -57,7 +59,9 @@ This property is only for changing the version used by Uno. Force the version to 2 for UWP and 3 for WinAppSDK. --> - 2 - 3 + 2 + 3 + + true diff --git a/MultiTarget/NoWarn.props b/MultiTarget/NoWarn.props new file mode 100644 index 00000000..e4df2dd3 --- /dev/null +++ b/MultiTarget/NoWarn.props @@ -0,0 +1,14 @@ + + + + $(NoWarn);CA1416;NETSDK1219; + + + + + $(NoWarn);CS8305; + + \ No newline at end of file diff --git a/MultiTarget/PackageReferences/Uno.props b/MultiTarget/PackageReferences/Uno.props index ab7ec0f3..4b4a9c04 100644 --- a/MultiTarget/PackageReferences/Uno.props +++ b/MultiTarget/PackageReferences/Uno.props @@ -1,13 +1,13 @@ - 5.2.132 + 5.5.87 - + diff --git a/MultiTarget/PackageReferences/Uwp.props b/MultiTarget/PackageReferences/Uwp.props index 8a7b1729..2e4723a0 100644 --- a/MultiTarget/PackageReferences/Uwp.props +++ b/MultiTarget/PackageReferences/Uwp.props @@ -1,5 +1,4 @@ - - - + + diff --git a/MultiTarget/PackageReferences/Uwp/Microsoft.UI.Xaml.props b/MultiTarget/PackageReferences/Uwp/Microsoft.UI.Xaml.props new file mode 100644 index 00000000..83bdffc6 --- /dev/null +++ b/MultiTarget/PackageReferences/Uwp/Microsoft.UI.Xaml.props @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiTarget/PackageReferences/Uwp/Microsoft.Web.WebView2.props b/MultiTarget/PackageReferences/Uwp/Microsoft.Web.WebView2.props new file mode 100644 index 00000000..1da0cfb4 --- /dev/null +++ b/MultiTarget/PackageReferences/Uwp/Microsoft.Web.WebView2.props @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiTarget/PackageReferences/Uwp/Microsoft.Windows.CsWinRT.props b/MultiTarget/PackageReferences/Uwp/Microsoft.Windows.CsWinRT.props new file mode 100644 index 00000000..70bf7535 --- /dev/null +++ b/MultiTarget/PackageReferences/Uwp/Microsoft.Windows.CsWinRT.props @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiTarget/PackageReferences/Uwp/Microsoft.Windows.SDK.CPP.props b/MultiTarget/PackageReferences/Uwp/Microsoft.Windows.SDK.CPP.props new file mode 100644 index 00000000..bbc2d192 --- /dev/null +++ b/MultiTarget/PackageReferences/Uwp/Microsoft.Windows.SDK.CPP.props @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiTarget/PackageReferences/WinAppSdk.props b/MultiTarget/PackageReferences/WinAppSdk.props index b557de75..867078b6 100644 --- a/MultiTarget/PackageReferences/WinAppSdk.props +++ b/MultiTarget/PackageReferences/WinAppSdk.props @@ -2,6 +2,6 @@ - + diff --git a/MultiTarget/WinUI.Extra.props b/MultiTarget/WinUI.Extra.props index 206362d1..cc85306c 100644 --- a/MultiTarget/WinUI.Extra.props +++ b/MultiTarget/WinUI.Extra.props @@ -17,16 +17,25 @@ --> 10.0.17763.0 $(TargetPlatformMinVersion) - 10.0.19041.0 + 10.0.26100.0 + 10.0.19041.0 + + + x86;x64;arm64 + + 10.0.26100.54 + win-x86;win-x64;win-arm64 + + true @@ -47,6 +56,11 @@ $(NoWarn);WMC1006;CS8034; + + + + $(NoWarn);CA1416; + diff --git a/ProjectHeads/AllComponents/Wasm/CommunityToolkit.App.Wasm.csproj b/ProjectHeads/AllComponents/Wasm/CommunityToolkit.App.Wasm.csproj index 1d3a7526..cb846c4d 100644 --- a/ProjectHeads/AllComponents/Wasm/CommunityToolkit.App.Wasm.csproj +++ b/ProjectHeads/AllComponents/Wasm/CommunityToolkit.App.Wasm.csproj @@ -1,4 +1,4 @@ - + true diff --git a/ProjectHeads/App.Head.Uno.UI.Dependencies.props b/ProjectHeads/App.Head.Uno.UI.Dependencies.props index 960a1391..d3c8a7ff 100644 --- a/ProjectHeads/App.Head.Uno.UI.Dependencies.props +++ b/ProjectHeads/App.Head.Uno.UI.Dependencies.props @@ -3,7 +3,7 @@ - + diff --git a/ProjectHeads/App.Head.Uno.WinUI.Dependencies.props b/ProjectHeads/App.Head.Uno.WinUI.Dependencies.props index 0d911d78..18e899d5 100644 --- a/ProjectHeads/App.Head.Uno.WinUI.Dependencies.props +++ b/ProjectHeads/App.Head.Uno.WinUI.Dependencies.props @@ -3,6 +3,7 @@ - + + diff --git a/ProjectHeads/App.Head.Uno.props b/ProjectHeads/App.Head.Uno.props index dd40b927..77d60655 100644 --- a/ProjectHeads/App.Head.Uno.props +++ b/ProjectHeads/App.Head.Uno.props @@ -6,6 +6,22 @@ + + + + + $(NoWarn);IL2026 + + + $(NoWarn);Uno0006 + - - - + + + diff --git a/ProjectHeads/App.Head.Uwp.props b/ProjectHeads/App.Head.Uwp.props index 3a79f60b..1e5bc91c 100644 --- a/ProjectHeads/App.Head.Uwp.props +++ b/ProjectHeads/App.Head.Uwp.props @@ -2,7 +2,7 @@ - $(UwpTargetFramework) + $(UwpTargetFramework.Split(';')[0]) Uwp diff --git a/ProjectHeads/App.Head.Wasm.props b/ProjectHeads/App.Head.Wasm.props index 86a98d39..47aecaa8 100644 --- a/ProjectHeads/App.Head.Wasm.props +++ b/ProjectHeads/App.Head.Wasm.props @@ -1,7 +1,7 @@ Exe - $(WasmHeadTargetFramework) + $(WasmHeadTargetFramework.Split(';')[0]) @@ -36,6 +36,11 @@ true + + + + + @@ -59,13 +64,13 @@ - - - - - - - + + + + + + + diff --git a/ProjectHeads/App.Head.WinAppSdk.Dependencies.props b/ProjectHeads/App.Head.WinAppSdk.Dependencies.props index 833d010f..7849998c 100644 --- a/ProjectHeads/App.Head.WinAppSdk.Dependencies.props +++ b/ProjectHeads/App.Head.WinAppSdk.Dependencies.props @@ -3,6 +3,6 @@ - + diff --git a/ProjectHeads/App.Head.props b/ProjectHeads/App.Head.props index e391661d..f6aae2ba 100644 --- a/ProjectHeads/App.Head.props +++ b/ProjectHeads/App.Head.props @@ -8,13 +8,13 @@ - + - - + + diff --git a/ProjectHeads/GenerateSingleSampleHeads.ps1 b/ProjectHeads/GenerateSingleSampleHeads.ps1 index 27747753..63971394 100644 --- a/ProjectHeads/GenerateSingleSampleHeads.ps1 +++ b/ProjectHeads/GenerateSingleSampleHeads.ps1 @@ -1,30 +1,47 @@ <# .SYNOPSIS Uses the dotnet template tool to copy and rename project heads to run sample code for different platforms. + .DESCRIPTION This is used to centralize configuration and reduce duplication of copying these heads for every project. - This script also generates a solution for the project and will open Visual Studio. + .PARAMETER componentPath Folder for the project to copy the project heads to. -.PARAMETER heads - Which heads to include to copy, defaults to all. (Currently ignored.) + +.PARAMETER MultiTargets + Specifies the MultiTarget TFM(s) to include for building the components. The default value is 'uwp', 'wasm', 'wasdk'. + +.PARAMETER ExcludeMultiTargets + Specifies the MultiTarget TFM(s) to exclude for building the components. The default value excludes targets that require additional tooling or workloads to build. Run uno-check to install the required workloads. + +.PARAMETER WinUIMajorVersion + Specifies the WinUI major version to use when building an Uno head. Also decides the package id and dependency variant. The default value is '2'. + .PARAMETER UseDiagnostics Add extra diagnostic output to running slngen, such as a binlog, etc... + .EXAMPLE C:\PS> .\GenerateSingleSampleHeads -componentPath components\testproj Builds project heads for component in testproj directory. + .NOTES Author: Windows Community Toolkit Labs Team Date: Feb 9, 2023 #> Param ( + [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android')] + [Alias("mt")] + [string[]]$MultiTargets = @('uwp', 'wasm', 'wasdk'), + + [string[]]$ExcludeMultiTargets, + + [Alias("winui")] + [int]$WinUIMajorVersion = 2, + [Parameter(HelpMessage = "The path to the containing folder for a component where sample heads should be generated.")] [string]$componentPath, - [Parameter(HelpMessage = "The heads that should be generated. If excluded, all heads will be generated. (Currently Ignored)")] - [string[]]$heads = @("uwp", "wasm", "winappsdk", "tests.uwp", "tests.winappsdk"), - [Parameter(HelpMessage = "Add extra diagnostic output to slngen generator.")] [switch]$UseDiagnostics = $false ) @@ -39,11 +56,55 @@ if ($null -ne $Env:Path -and $Env:Path.ToLower().Contains("msbuild") -eq $false) Exit } +# If componentPath is not provided or is an empty string, use the $PSScriptRoot +if ($null -eq $componentPath -or $componentPath -eq '') +{ + $componentPath = $pwd +} + +# Multitarget handling +# ----------------- + +if ($MultiTargets.Contains('all')) { + $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android') +} + +if ($null -eq $ExcludeMultiTargets) +{ + $ExcludeMultiTargets = @() +} + +# Both uwp and wasdk share a targetframework. Both cannot be enabled at once. +# If both are supplied, remove one based on WinUIMajorVersion. +if ($MultiTargets.Contains('uwp') -and $MultiTargets.Contains('wasdk')) +{ + if ($WinUIMajorVersion -eq 2) + { + $ExcludeMultiTargets = $ExcludeMultiTargets + 'wasdk' + } + else + { + $ExcludeMultiTargets = $ExcludeMultiTargets + 'uwp' + } +} + +$MultiTargets = $MultiTargets | Where-Object { $_ -notin $ExcludeMultiTargets } +$ExcludeMultiTargets = $ExcludeMultiTargets | Where-Object { $_ -notin $MultiTargets } + +# Generate required props for preferences +& $PSScriptRoot/../MultiTarget/UseTargetFrameworks.ps1 -MultiTargets $MultiTargets +& $PSScriptRoot/../MultiTarget/UseUnoWinUI.ps1 $WinUIMajorVersion + +# Head generation +# ----------------- + $headsFolderName = "heads" $componentName = (Get-Item $componentPath -ErrorAction Stop).Name +$outputHeadsDir = "$componentPath/$headsFolderName"; + # Remove existing heads directory to refresh -Remove-Item -Recurse -Force "$componentPath/$headsFolderName/" -ErrorAction SilentlyContinue; +Remove-Item -Recurse -Force $outputHeadsDir -ErrorAction SilentlyContinue; # Intall our heads as a temporary template dotnet new --install "$PSScriptRoot/SingleComponent" --force @@ -58,9 +119,14 @@ dotnet new ct-tooling-heads -n $componentName -o $headsFolderName # Remove template, as just for script dotnet new --uninstall "$PSScriptRoot/SingleComponent" - # Generate Solution -#------------------ +# ------------------ + +# Projects to include +$projects = [System.Collections.ArrayList]::new() + +# Include all projects in component folder +[void]$projects.Add(".\*\*.*proj") # Install slgnen dotnet tool restore @@ -76,18 +142,35 @@ if (Test-Path -Path $generatedSolutionFilePath) Write-Host "Removed previous solution file" } -# Projects to include -$projects = [System.Collections.ArrayList]::new() - -# Include all projects in component folder -[void]$projects.Add(".\**.*proj") +# Deployable sample gallery heads +# All heads are included by default since they reside in the same folder as the component. +# Remove any heads that are not required for the solution. +# TODO: this handles separate project heads, but won't directly handle the unified Skia head from Uno. +# Once we have that, just do a transform on the csproj filename inside this loop to decide the same csproj for those separate MultiTargets. +foreach ($multitarget in $MultiTargets) { + # capitalize first letter, avoid case sensitivity issues on linux + $csprojFileNamePartForMultiTarget = $multitarget.substring(0,1).ToUpper() + $multitarget.Substring(1).ToLower() + + $path = "$outputHeadsDir\**\*$csprojFileNamePartForMultiTarget.csproj"; + + if (Test-Path $path) { + # iterate the wildcards caught by $path + foreach ($foundItem in Get-ChildItem $path) + { + $projects = $projects + $foundItem.FullName + } + } + else { + Write-Warning "No project head could be found at $path for MultiTarget $multitarget. Skipping." + } +} # Include common dependencies required for solution to build -[void]$projects.Add("..\..\tooling\CommunityToolkit.App.Shared\**\*.*proj") -[void]$projects.Add("..\..\tooling\CommunityToolkit.Tests.Shared\**\*.*proj") -[void]$projects.Add("..\..\tooling\CommunityToolkit.Tooling.SampleGen\*.csproj") -[void]$projects.Add("..\..\tooling\CommunityToolkit.Tooling.TestGen\*.csproj") -[void]$projects.Add("..\..\tooling\CommunityToolkit.Tooling.XamlNamedPropertyRelay\*.csproj") +$projects = $projects + "..\..\tooling\CommunityToolkit.App.Shared\**\*.*proj" +$projects = $projects + "..\..\tooling\CommunityToolkit.Tests.Shared\**\*.*proj" +$projects = $projects + "..\..\tooling\CommunityToolkit.Tooling.SampleGen\*.csproj" +$projects = $projects + "..\..\tooling\CommunityToolkit.Tooling.TestGen\*.csproj" +$projects = $projects + "..\..\tooling\CommunityToolkit.Tooling.XamlNamedPropertyRelay\*.csproj" if ($UseDiagnostics.IsPresent) { diff --git a/ProjectHeads/Head.Uwp.props b/ProjectHeads/Head.Uwp.props index 55d631b2..be7b3483 100644 --- a/ProjectHeads/Head.Uwp.props +++ b/ProjectHeads/Head.Uwp.props @@ -1,5 +1,17 @@ + + + UAP + $(TargetPlatformIdentifier) + + + + @@ -12,7 +24,6 @@ AppContainerExe Properties en-US - UAP 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/ProjectHeads/Head.WinAppSdk.props b/ProjectHeads/Head.WinAppSdk.props index 76c28338..8df952db 100644 --- a/ProjectHeads/Head.WinAppSdk.props +++ b/ProjectHeads/Head.WinAppSdk.props @@ -5,6 +5,7 @@ x86;x64;arm64 win-$(Platform).pubxml true + windows true true true @@ -14,6 +15,12 @@ + + + + + $(NoWarn);IL2026 + win-$(Platform) diff --git a/ProjectHeads/SingleComponent/Tests.WinAppSdk/Package.appxmanifest b/ProjectHeads/SingleComponent/Tests.Wasdk/Package.appxmanifest similarity index 100% rename from ProjectHeads/SingleComponent/Tests.WinAppSdk/Package.appxmanifest rename to ProjectHeads/SingleComponent/Tests.Wasdk/Package.appxmanifest diff --git a/ProjectHeads/SingleComponent/Tests.WinAppSdk/ProjectTemplate.Tests.WinAppSdk.csproj b/ProjectHeads/SingleComponent/Tests.Wasdk/ProjectTemplate.Tests.Wasdk.csproj similarity index 100% rename from ProjectHeads/SingleComponent/Tests.WinAppSdk/ProjectTemplate.Tests.WinAppSdk.csproj rename to ProjectHeads/SingleComponent/Tests.Wasdk/ProjectTemplate.Tests.Wasdk.csproj diff --git a/ProjectHeads/SingleComponent/Tests.WinAppSdk/Properties/launchSettings.json b/ProjectHeads/SingleComponent/Tests.Wasdk/Properties/launchSettings.json similarity index 100% rename from ProjectHeads/SingleComponent/Tests.WinAppSdk/Properties/launchSettings.json rename to ProjectHeads/SingleComponent/Tests.Wasdk/Properties/launchSettings.json diff --git a/ProjectHeads/SingleComponent/Tests.WinAppSdk/app.manifest b/ProjectHeads/SingleComponent/Tests.Wasdk/app.manifest similarity index 100% rename from ProjectHeads/SingleComponent/Tests.WinAppSdk/app.manifest rename to ProjectHeads/SingleComponent/Tests.Wasdk/app.manifest diff --git a/ProjectHeads/SingleComponent/WinAppSdk/Package.appxmanifest b/ProjectHeads/SingleComponent/Wasdk/Package.appxmanifest similarity index 100% rename from ProjectHeads/SingleComponent/WinAppSdk/Package.appxmanifest rename to ProjectHeads/SingleComponent/Wasdk/Package.appxmanifest diff --git a/ProjectHeads/SingleComponent/WinAppSdk/ProjectTemplate.WinAppSdk.csproj b/ProjectHeads/SingleComponent/Wasdk/ProjectTemplate.Wasdk.csproj similarity index 100% rename from ProjectHeads/SingleComponent/WinAppSdk/ProjectTemplate.WinAppSdk.csproj rename to ProjectHeads/SingleComponent/Wasdk/ProjectTemplate.Wasdk.csproj diff --git a/ProjectHeads/SingleComponent/WinAppSdk/Properties/launchSettings.json b/ProjectHeads/SingleComponent/Wasdk/Properties/launchSettings.json similarity index 100% rename from ProjectHeads/SingleComponent/WinAppSdk/Properties/launchSettings.json rename to ProjectHeads/SingleComponent/Wasdk/Properties/launchSettings.json diff --git a/ProjectHeads/SingleComponent/WinAppSdk/app.manifest b/ProjectHeads/SingleComponent/Wasdk/app.manifest similarity index 100% rename from ProjectHeads/SingleComponent/WinAppSdk/app.manifest rename to ProjectHeads/SingleComponent/Wasdk/app.manifest diff --git a/ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj b/ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj index e0b6be0c..25f62528 100644 --- a/ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj +++ b/ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj @@ -1,4 +1,4 @@ - + true diff --git a/ProjectHeads/Tests.Head.WinAppSdk.props b/ProjectHeads/Tests.Head.WinAppSdk.props index 7260103d..2e306263 100644 --- a/ProjectHeads/Tests.Head.WinAppSdk.props +++ b/ProjectHeads/Tests.Head.WinAppSdk.props @@ -6,7 +6,7 @@ - + build diff --git a/ProjectHeads/Tests.Head.props b/ProjectHeads/Tests.Head.props index 0dff7352..354c480b 100644 --- a/ProjectHeads/Tests.Head.props +++ b/ProjectHeads/Tests.Head.props @@ -1,8 +1,8 @@ - - + + diff --git a/ToolkitComponent.SampleProject.props b/ToolkitComponent.SampleProject.props index d1c5e023..43095c9c 100644 --- a/ToolkitComponent.SampleProject.props +++ b/ToolkitComponent.SampleProject.props @@ -6,12 +6,12 @@ - + - + diff --git a/global.json b/global.json index 91187a7c..27a18775 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.403", + "version": "9.0.101", "rollForward": "latestFeature" }, "msbuild-sdks":