diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2049b492..8349fb7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,6 +112,9 @@ jobs: with: global-json-file: tooling/global.json + - name: Install .NET workloads + run: dotnet workload install wasm-tools + - name: .NET Info (if diagnostics) if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} run: dotnet --info @@ -119,14 +122,16 @@ jobs: - name: Copy props files to root shell: pwsh working-directory: ./ - run: copy ./tooling/.github/workflows/config/* ./ + run: | + copy ./tooling/.github/workflows/config/* ./ + copy ./tooling/global.json ./ - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - name: Add project heads to ProjectTemplate working-directory: ./${{ env.PROJECT_DIRECTORY }} - run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} + run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -IncludeUnoSdkHead -componentPath ${{ github.workspace }}/${{ env.PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} # Build and use template for creating new experiments - name: Build ProjectTemplate @@ -149,6 +154,12 @@ jobs: # WinUI 3 not supported on uwp - winui: 3 multitarget: uwp + include: + # The Uno.Sdk head replaces the classic Wasm head on WinUI 3, so it rides on the + # existing wasm/winui3 job as a flag rather than a fake entry in the multitarget axis. + - winui: 3 + multitarget: wasm + unoSdkHead: true env: HEADS_DIRECTORY: tooling/ProjectHeads @@ -178,6 +189,10 @@ jobs: with: global-json-file: tooling/global.json + - name: Install .NET workloads + if: ${{ matrix.multitarget == 'wasm' }} + run: dotnet workload install wasm-tools ${{ matrix.unoSdkHead && 'android ios maui' || '' }} + - name: .NET Info (if diagnostics) if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} run: dotnet --info @@ -187,6 +202,7 @@ jobs: working-directory: ./ run: | copy ./tooling/.github/workflows/config/* ./ + copy ./tooling/global.json ./ mkdir ./.config copy ./tooling/.config/dotnet-tools.json ./.config/dotnet-tools.json mkdir ./components @@ -214,12 +230,24 @@ jobs: - name: Add project heads to ${{ env.TEST_PROJECT_NAME }} working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }} - 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' || '' }} + run: >- + ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 + -MultiTargets ${{ matrix.multitarget }} + -winui ${{ matrix.winui }} + -componentPath "${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}" + ${{ matrix.unoSdkHead && ' -IncludeUnoSdkHead' || '' }} + ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} - name: MSBuild + if: ${{ !matrix.unoSdkHead }} working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }} run: msbuild.exe ${{ env.TEST_PROJECT_NAME }}.sln /restore /nowarn:MSB4011 -p:Configuration=Release /m ${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }} /v:${{ env.MSBUILD_VERBOSITY }} + - name: Build Uno head + if: ${{ matrix.unoSdkHead }} + working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }} + run: dotnet build heads/Uno/${{ env.TEST_PROJECT_NAME }}.Uno.csproj -p:Configuration=Release + # Run tests - name: Setup VSTest Path uses: darenm/setup-vstest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 @@ -246,10 +274,11 @@ jobs: name: new-experiment-logs-${{ matrix.multitarget }}-winui${{ matrix.winui }} path: ./**/*.*log - wasm-linux: + uno-linux: runs-on: ubuntu-latest env: HEADS_DIRECTORY: tooling/ProjectHeads + PROJECT_DIRECTORY: tooling/ProjectTemplate TEST_PROJECT_NAME: CiTestExp steps: @@ -264,6 +293,18 @@ jobs: with: global-json-file: tooling/global.json + # iOS/maccatalyst workloads aren't installable on Linux (Uno.Sdk + # auto-filters those TFMs there). android + wasm-tools are both + # required: even a `-f net9.0-browserwasm` build restores all of the + # head's TargetFrameworks, so the net9.0-android TFM's workload is + # validated during restore. + # Run from ./tooling so global.json scopes the install to the pinned + # SDK feature band; otherwise the workloads land on the runner's newer + # preinstalled SDK and the 9.0.x build can't see them (NETSDK1147). + - name: Install .NET workloads + working-directory: tooling + run: dotnet workload install android wasm-tools + - name: .NET Info (if diagnostics) if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} run: dotnet --info @@ -273,6 +314,7 @@ jobs: working-directory: ./ run: | copy ./tooling/.github/workflows/config/* ./ + copy ./tooling/global.json ./ mkdir ./.config copy ./tooling/.config/dotnet-tools.json ./.config/dotnet-tools.json mkdir ./components @@ -294,20 +336,36 @@ jobs: - name: Generate solution shell: pwsh working-directory: ./ - run: ./tooling/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -MultiTargets wasm + run: ./tooling/GenerateAllSolution.ps1 -IncludeUnoSdkHead${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -MultiTargets wasm,linux - name: dotnet build shell: pwsh working-directory: ./ - run: ./tooling/Build-Toolkit-Components.ps1 -Release -MultiTargets wasm ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -BinlogOutput ./ -EnableBinLogs' || '' }} - - # TODO: Do we want to run tests here? Can we do that on linux easily? + run: ./tooling/Build-Toolkit-Components.ps1 -Release -MultiTargets wasm,linux ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -BinlogOutput ./ -EnableBinLogs' || '' }} + + - name: Build Uno head (browserwasm) + shell: pwsh + working-directory: ./ + run: >- + dotnet build + tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj + -f net9.0-browserwasm + -p:Configuration=Release + + - name: Build Uno head (desktop) + shell: pwsh + working-directory: ./ + run: >- + dotnet build + tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj + -f net9.0-desktop + -p:Configuration=Release - name: Artifact - Diagnostic Logs uses: actions/upload-artifact@v4 if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} with: - name: linux-logs + name: uno-linux-logs path: ./**/*.*log diff --git a/Build-Toolkit-Components.ps1 b/Build-Toolkit-Components.ps1 index 6cbc0ec5..4fac8c41 100644 --- a/Build-Toolkit-Components.ps1 +++ b/Build-Toolkit-Components.ps1 @@ -57,11 +57,11 @@ Date: 2/19/2024 #> Param ( - [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [Alias("mt")] [string[]]$MultiTargets = @('uwp', 'wasm', 'wasdk'), # default settings - - [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + + [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [string[]]$ExcludeMultiTargets = @(), # default settings [Alias("c")] @@ -97,7 +97,7 @@ Param ( if ($MultiTargets -eq 'all') { - $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') + $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard') } if ($null -eq $ExcludeMultiTargets) diff --git a/Build-Toolkit-Gallery.ps1 b/Build-Toolkit-Gallery.ps1 index 7d92154e..cbfb0821 100644 --- a/Build-Toolkit-Gallery.ps1 +++ b/Build-Toolkit-Gallery.ps1 @@ -9,7 +9,7 @@ Specifies the MultiTarget TFM(s) to include for building the components. The default value is 'all'. .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: 'wpf', 'linuxgtk', 'macos', 'ios', and 'android'. Run uno-check to install the required workloads. + Specifies the MultiTarget TFM(s) to exclude for building the components. The default value excludes targets that require additional tooling or workloads to build: 'wpf', 'linux', 'macos', 'ios', and 'android'. Run uno-check to install the required workloads. .PARAMETER Heads The heads to include in the build. Default is 'Uwp', 'Wasdk', 'Wasm'. @@ -46,11 +46,11 @@ Date: 2/19/2024 #> Param ( - [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [Alias("mt")] [string[]]$MultiTargets = @('uwp', 'wasdk', 'wasm'), # default settings - - [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + + [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [string[]]$ExcludeMultiTargets = @(), # default settings [ValidateSet('all', 'Uwp', 'Wasdk', 'Wasm', 'Tests.Uwp', 'Tests.Wasdk')] @@ -102,7 +102,7 @@ if ($MultiTargets.Contains('uwp') -and $MultiTargets.Contains('wasdk')) } if ($MultiTargets -eq 'all') { - $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') + $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard') } if ($ExcludeMultiTargets) { diff --git a/CommunityToolkit.App.Shared/Renderers/Markdown/MarkdownTextBlock.cs b/CommunityToolkit.App.Shared/Renderers/Markdown/MarkdownTextBlock.cs index 2b0d3293..76ef5e8d 100644 --- a/CommunityToolkit.App.Shared/Renderers/Markdown/MarkdownTextBlock.cs +++ b/CommunityToolkit.App.Shared/Renderers/Markdown/MarkdownTextBlock.cs @@ -16,7 +16,7 @@ #endif #endif -#if HAS_UNO_WASM +#if HAS_UNO_WASM && !WINUI3 using Markdig; using Uno.Foundation.Interop; using Uno.UI.Runtime.WebAssembly; @@ -27,7 +27,7 @@ namespace CommunityToolkit.App.Shared.Renderers; /// /// Provide an abstraction around the Toolkit MarkdownTextBlock for both UWP and WinUI 3 in the same namespace (until 8.0) as well as a polyfill for WebAssembly/WASM. /// -#if HAS_UNO_WASM +#if HAS_UNO_WASM && !WINUI3 [HtmlElement("div")] public partial class MarkdownTextBlock : TextBlock { diff --git a/GenerateAllSolution.ps1 b/GenerateAllSolution.ps1 index 72eb9bac..25b3afcd 100644 --- a/GenerateAllSolution.ps1 +++ b/GenerateAllSolution.ps1 @@ -38,11 +38,11 @@ Date: April 27, 2022 #> Param ( - [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [Alias("mt")] - [string[]]$MultiTargets = @('uwp', 'wasm', 'wasdk'), + [string[]]$MultiTargets = @('uwp', 'wasm', 'wasdk', 'win32'), - [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [string[]]$ExcludeMultiTargets = @(), # default settings [Alias("c")] @@ -54,12 +54,14 @@ Param ( [string[]]$ExcludeComponents, [switch]$UseDiagnostics = $false, - - [bool]$Launch = $true + + [bool]$Launch = $true, + + [switch]$IncludeUnoSdkHead = $false ) if ($MultiTargets.Contains('all')) { - $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') + $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard') } if ($null -eq $ExcludeMultiTargets) @@ -150,11 +152,19 @@ foreach ($componentName in $Components) { # Deployable sample gallery heads # Only include heads for requested MultiTargets if components were included that use them. -# === -# 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. -# === +# These have no head project of their own - they're served by the unified Uno.Sdk head added below. +$unoSdkHeadMultiTargets = @('win32', 'linux', 'macos', 'ios', 'android') + foreach ($multitarget in $allUsedMultiTargetPrefs) { + if ($unoSdkHeadMultiTargets -contains $multitarget) { + continue + } + + # When using the Uno.Sdk head, skip the traditional Wasm head (Uno.Sdk covers wasm for WinUI 3) + if ($multitarget -eq 'wasm' -and $IncludeUnoSdkHead) { + continue + } + # capitalize first letter, avoid case sensitivity issues on linux $csprojFileNamePartForMultiTarget = $multitarget.substring(0,1).ToUpper() + $multitarget.Substring(1).ToLower() @@ -168,6 +178,15 @@ foreach ($multitarget in $allUsedMultiTargetPrefs) { } } +if ($IncludeUnoSdkHead) { + $unoHeadPath = "./tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj" + if (Test-Path $unoHeadPath) { + [void]$projects.Add($unoHeadPath) + } else { + Write-Warning "Uno.Sdk head project not found at $unoHeadPath." + } +} + if ($UseDiagnostics.IsPresent) { $sdkoptions = "-d" diff --git a/GenerateSingleSolution.ps1 b/GenerateSingleSolution.ps1 index e0e73d7d..ea0b0c3c 100644 --- a/GenerateSingleSolution.ps1 +++ b/GenerateSingleSolution.ps1 @@ -33,7 +33,7 @@ Date: Feb 9, 2023 #> Param ( - [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android')] + [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android')] [Alias("mt")] [string[]]$MultiTargets = @('uwp', 'wasm', 'wasdk'), @@ -49,7 +49,9 @@ Param ( [string]$componentPath, [Parameter(HelpMessage = "Add extra diagnostic output to slngen generator.")] - [switch]$UseDiagnostics = $false + [switch]$UseDiagnostics = $false, + + [switch]$IncludeUnoSdkHead = $false ) if ($null -ne $Env:Path -and $Env:Path.ToLower().Contains("msbuild") -eq $false) { @@ -98,7 +100,7 @@ if (-not (Test-Path "$componentPath/src" -PathType Container)) # ----------------- if ($MultiTargets.Contains('all')) { - $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android') + $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android') } if ($null -eq $ExcludeMultiTargets) @@ -188,9 +190,19 @@ Write-Output "Generating solution for $componentName in $generatedSolutionFilePa # 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. +# These have no head project of their own - they're served by the unified Uno.Sdk head added below. +$unoSdkHeadMultiTargets = @('win32', 'linux', 'macos', 'ios', 'android') + foreach ($multitarget in $MultiTargets) { + if ($unoSdkHeadMultiTargets -contains $multitarget) { + continue + } + + # When using the Uno.Sdk head, skip the traditional Wasm head (Uno.Sdk covers wasm for WinUI 3) + if ($multitarget -eq 'wasm' -and $IncludeUnoSdkHead) { + continue + } + # capitalize first letter, avoid case sensitivity issues on linux $csprojFileNamePartForMultiTarget = $multitarget.substring(0,1).ToUpper() + $multitarget.Substring(1).ToLower() @@ -208,6 +220,17 @@ foreach ($multitarget in $MultiTargets) { } } +if ($IncludeUnoSdkHead) { + $unoHeadPath = "$outputHeadsDir\Uno\*Uno.csproj" + if (Test-Path $unoHeadPath) { + foreach ($foundItem in Get-ChildItem $unoHeadPath) { + $projects = $projects + $foundItem.FullName + } + } else { + Write-Warning "Uno.Sdk head project not found at $unoHeadPath." + } +} + # Include common dependencies required for solution to build $projects = $projects + "$PSScriptRoot\CommunityToolkit.App.Shared\**\*.*proj" $projects = $projects + "$PSScriptRoot\CommunityToolkit.Tests.Shared\**\*.*proj" diff --git a/GenerateVSCodeLaunchConfig.ps1 b/GenerateVSCodeLaunchConfig.ps1 index 58ced9ed..f8809ea2 100644 --- a/GenerateVSCodeLaunchConfig.ps1 +++ b/GenerateVSCodeLaunchConfig.ps1 @@ -9,7 +9,7 @@ function CreateVsCodeLaunchConfigJson { ) return "{ - `"name`": `"$projectName`", + `"name`": `"$projectName (Wasm)`", `"type`": `"coreclr`", `"request`": `"launch`", `"program`": `"dotnet`", @@ -29,6 +29,32 @@ function CreateVsCodeLaunchConfigJson { }"; } +function CreateUnoVsCodeLaunchConfigJson { + param ( + [string]$projectName + ) + + return "{ + `"name`": `"$projectName (Uno)`", + `"type`": `"coreclr`", + `"request`": `"launch`", + `"program`": `"dotnet`", + `"args`": [ + `"run`", + `"build`", + `"/r`", + `"/p:UnoSourceGeneratorUseGenerationHost=true`", + `"/p:UnoSourceGeneratorUseGenerationController=false`", + `"/p:UnoRemoteControlPort=443`", + `"--project=`$`{workspaceFolder`}/components/$projectName/heads/Uno/$projectName.Uno.csproj`" + ], + `"presentation`": { + `"group`": `"2`" + }, + `"cwd`": `"`$`{workspaceFolder`}/components/$projectName/heads/Uno`" + }"; +} + $launchConfigJson = Get-Content -Path "$PSScriptRoot/../.vscode/launch.json" -ErrorAction Stop; $launchConfig = $launchConfigJson | ConvertFrom-Json; @@ -46,8 +72,11 @@ foreach ($projectPath in Get-ChildItem -Directory -Depth 0 -Path "$PSScriptRoot/ $configJson = CreateVsCodeLaunchConfigJson $projectName; $config = $configJson | ConvertFrom-Json; - $launchConfig.configurations += $config; + + $unoConfigJson = CreateUnoVsCodeLaunchConfigJson $projectName; + $unoConfig = $unoConfigJson | ConvertFrom-Json; + $launchConfig.configurations += $unoConfig; } if ($allowGitChanges.IsPresent) { diff --git a/MultiTarget/AvailableTargetFrameworks.props b/MultiTarget/AvailableTargetFrameworks.props index 02f9d9aa..7339cf90 100644 --- a/MultiTarget/AvailableTargetFrameworks.props +++ b/MultiTarget/AvailableTargetFrameworks.props @@ -15,7 +15,7 @@ net9.0; net9.0; net9.0; - + net9.0-android; net9.0-maccatalyst; net9.0-ios; @@ -24,6 +24,7 @@ net9.0; net9.0; net9.0; + net9.0; netstandard2.0; diff --git a/MultiTarget/Defaults.props b/MultiTarget/Defaults.props index 86e5e82f..fbf71733 100644 --- a/MultiTarget/Defaults.props +++ b/MultiTarget/Defaults.props @@ -1,5 +1,5 @@ - uwp;wasdk;wpf;wasm;linuxgtk;macos;ios;android; + uwp;wasdk;wpf;win32;wasm;linux;macos;ios;android; \ No newline at end of file diff --git a/MultiTarget/DefinedConstants.props b/MultiTarget/DefinedConstants.props index b5c8c2c9..6152d9e8 100644 --- a/MultiTarget/DefinedConstants.props +++ b/MultiTarget/DefinedConstants.props @@ -13,7 +13,10 @@ $(DefineConstants);__IOS__; $(DefineConstants);__MACOS__; $(DefineConstants);HAS_UNO_SKIA;__SKIA__;WINDOWS_WPF; - $(DefineConstants);HAS_UNO_SKIA;__SKIA__;__GTK__; + $(DefineConstants);HAS_UNO_SKIA;__SKIA__;__GTK__; + $(DefineConstants);HAS_UNO_SKIA;__SKIA__; + + $(DefineConstants);HAS_UNO_SKIA;__SKIA__; $(DefineConstants);NET9_0_OR_GREATER $(DefineConstants);NET8_0_OR_GREATER diff --git a/MultiTarget/EnabledTargetFrameworks.props b/MultiTarget/EnabledTargetFrameworks.props index 6f1c0ab9..1b368907 100644 --- a/MultiTarget/EnabledTargetFrameworks.props +++ b/MultiTarget/EnabledTargetFrameworks.props @@ -10,14 +10,20 @@ $(TargetFrameworks);$(WinAppSdkTargetFrameworks) - true - true + true + true $(TargetFrameworks);$(DotnetCommonTargetFramework) - $(TargetFrameworks);$(MacOSLibTargetFrameworks) + + $(TargetFrameworks);$(MacOSLibTargetFrameworks) $(TargetFrameworks);$(iOSLibTargetFrameworks) $(TargetFrameworks);$(AndroidLibTargetFrameworks) diff --git a/MultiTarget/Filter-Supported-Components.ps1 b/MultiTarget/Filter-Supported-Components.ps1 index bc187e85..2ba1a0bb 100644 --- a/MultiTarget/Filter-Supported-Components.ps1 +++ b/MultiTarget/Filter-Supported-Components.ps1 @@ -17,7 +17,7 @@ Date: 6/6/2025 #> Param ( - [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [Alias("mt")] [Parameter(Mandatory=$true)] [string[]]$MultiTargets, @@ -32,7 +32,7 @@ Param ( ) if ($MultiTargets -eq 'all') { - $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') + $MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard') } $supportedComponents = @(); diff --git a/MultiTarget/GenerateAllProjectReferences.ps1 b/MultiTarget/GenerateAllProjectReferences.ps1 index 62ca3b02..ab495bf4 100644 --- a/MultiTarget/GenerateAllProjectReferences.ps1 +++ b/MultiTarget/GenerateAllProjectReferences.ps1 @@ -4,8 +4,8 @@ Param ( [Parameter(HelpMessage = "Only projects that support these targets will have references generated for use by deployable heads.")] [Alias("mt")] - [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] - [string[]]$MultiTargets = @("uwp", "wasdk", "wpf", "wasm", "linuxgtk", "macos", "ios", "android", "netstandard"), + [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] + [string[]]$MultiTargets = @("uwp", "wasdk", "wpf", "win32", "wasm", "linux", "macos", "ios", "android", "netstandard"), [Parameter(HelpMessage = "The names of the components to generate references for. Defaults to all components.")] [string[]]$Components = @("all"), diff --git a/MultiTarget/GenerateMultiTargetAwareProjectReferenceProps.ps1 b/MultiTarget/GenerateMultiTargetAwareProjectReferenceProps.ps1 index dbbd6728..461ca388 100644 --- a/MultiTarget/GenerateMultiTargetAwareProjectReferenceProps.ps1 +++ b/MultiTarget/GenerateMultiTargetAwareProjectReferenceProps.ps1 @@ -15,9 +15,9 @@ Param ( [string]$projectRootPlaceholder = "[ProjectRoot]", [Parameter(HelpMessage = "Only projects that support these targets will have references generated for use by deployable heads.")] - [ValidateSet("uwp", "wasdk", "wpf", "wasm", "linuxgtk", "macos", "ios", "android", "netstandard")] + [ValidateSet("uwp", "wasdk", "wpf", "win32", "wasm", "linux", "macos", "ios", "android", "netstandard")] [Alias("mt")] - [string[]] $MultiTargets = @("uwp", "wasdk", "wpf", "wasm", "linuxgtk", "macos", "ios", "android", "netstandard") + [string[]] $MultiTargets = @("uwp", "wasdk", "wpf", "win32", "wasm", "linux", "macos", "ios", "android", "netstandard") ) if ($projectPath.EndsWith(".projitems")) { @@ -74,7 +74,7 @@ function ShouldMultiTargetMsBuildValue([string] $target) { return $(ShouldMultiTarget $target).ToString().ToLower() } -$targeted = @("uwp", "wasdk", "wpf", "wasm", "linuxgtk", "macos", "ios", "android", "netstandard").Where({ ShouldMultiTarget $_ }) +$targeted = @("uwp", "wasdk", "wpf", "win32", "wasm", "linux", "macos", "ios", "android", "netstandard").Where({ ShouldMultiTarget $_ }) if ($targeted.Count -gt 0) { Write-Host "Generating project references for $([System.IO.Path]::GetFileNameWithoutExtension($projectFileName)): $($targeted -Join ', ')" @@ -84,7 +84,8 @@ $templateContents = $templateContents -replace [regex]::escape("[CanTargetWasm]" $templateContents = $templateContents -replace [regex]::escape("[CanTargetUwp]"), "'$(ShouldMultiTargetMsBuildValue "uwp")'"; $templateContents = $templateContents -replace [regex]::escape("[CanTargetWasdk]"), "'$(ShouldMultiTargetMsBuildValue "wasdk")'"; $templateContents = $templateContents -replace [regex]::escape("[CanTargetWpf]"), "'$(ShouldMultiTargetMsBuildValue "wpf")'"; -$templateContents = $templateContents -replace [regex]::escape("[CanTargetLinuxGtk]"), "'$(ShouldMultiTargetMsBuildValue "linuxgtk")'"; +$templateContents = $templateContents -replace [regex]::escape("[CanTargetWin32]"), "'$(ShouldMultiTargetMsBuildValue "win32")'"; +$templateContents = $templateContents -replace [regex]::escape("[CanTargetLinux]"), "'$(ShouldMultiTargetMsBuildValue "linux")'"; $templateContents = $templateContents -replace [regex]::escape("[CanTargetMacOS]"), "'$(ShouldMultiTargetMsBuildValue "macos")'"; $templateContents = $templateContents -replace [regex]::escape("[CanTargetiOS]"), "'$(ShouldMultiTargetMsBuildValue "ios")'"; $templateContents = $templateContents -replace [regex]::escape("[CanTargetDroid]"), "'$(ShouldMultiTargetMsBuildValue "android")'"; diff --git a/MultiTarget/Library.props b/MultiTarget/Library.props index 61ab36c8..99e59e36 100644 --- a/MultiTarget/Library.props +++ b/MultiTarget/Library.props @@ -7,13 +7,15 @@ + + + - - diff --git a/MultiTarget/MultiTargetAwareProjectReference.props.template b/MultiTarget/MultiTargetAwareProjectReference.props.template index 86b3c4d8..2a1de1a2 100644 --- a/MultiTarget/MultiTargetAwareProjectReference.props.template +++ b/MultiTarget/MultiTargetAwareProjectReference.props.template @@ -11,7 +11,9 @@ ($(IsUwp) == 'true' AND [CanTargetUwp] == 'true') OR ($(IsWinAppSdk) == 'true' AND [CanTargetWasdk] == 'true') OR ($(IsWpf) == 'true' AND [CanTargetWpf] == 'true') OR - ($(IsGtk) == 'true' AND [CanTargetLinuxGtk] == 'true') OR + ($(IsWin32) == 'true' AND [CanTargetWin32] == 'true') OR + ($(IsLinux) == 'true' AND [CanTargetLinux] == 'true') OR + ($(IsDesktop) == 'true' AND ([CanTargetWin32] == 'true' OR [CanTargetLinux] == 'true' OR [CanTargetMacOS] == 'true')) OR ($(IsMacOS) == 'true' AND [CanTargetMacOS] == 'true') OR ($(IsiOS) == 'true' AND [CanTargetiOS] == 'true') OR ($(IsDroid) == 'true' AND [CanTargetDroid] == 'true') OR diff --git a/MultiTarget/MultiTargetAwareSharedProjectImport.props.template b/MultiTarget/MultiTargetAwareSharedProjectImport.props.template index 06c9c8e0..0108d531 100644 --- a/MultiTarget/MultiTargetAwareSharedProjectImport.props.template +++ b/MultiTarget/MultiTargetAwareSharedProjectImport.props.template @@ -7,7 +7,7 @@ ($(IsUwp) == 'true' AND 'false' == 'true') OR ($(IsWinAppSdk) == 'true' AND 'true' == 'true') OR ($(IsWpf) == 'true' AND 'false' == 'true') OR - ($(IsGtk) == 'true' AND 'false' == 'true') OR + ($(IsLinux) == 'true' AND 'false' == 'true') OR ($(IsMacOS) == 'true' AND 'false' == 'true') OR ($(IsiOS) == 'true' AND 'false' == 'true') OR ($(IsDroid) == 'true' AND 'false' == 'true') OR diff --git a/MultiTarget/MultiTargetIdentifiers.props b/MultiTarget/MultiTargetIdentifiers.props index ff961168..f69d607c 100644 --- a/MultiTarget/MultiTargetIdentifiers.props +++ b/MultiTarget/MultiTargetIdentifiers.props @@ -17,7 +17,8 @@ true true - true + true + true true true true @@ -33,9 +34,14 @@ true true - true - true - true + + true + true + + true + true + true true true @@ -47,7 +53,7 @@ true true - true + true + 5.5.87 + + 6.4.229 + + $(UnoUIPackageVersion) + $(UnoWinUIPackageVersion) - - + - + + + + + + + + true - - + + + + + + + + - - + + + - - + + @@ -45,7 +64,12 @@ $(NoWarn);CS1570; - + + + + + + diff --git a/MultiTarget/ReadMe.md b/MultiTarget/ReadMe.md index fd8d7f19..d6ad1704 100644 --- a/MultiTarget/ReadMe.md +++ b/MultiTarget/ReadMe.md @@ -17,7 +17,7 @@ By default, all available targets are enabled: ```xml - uwp;wasdk;wpf;wasm;linuxgtk;macos;ios;android; + uwp;wasdk;wpf;win32;wasm;linux;macos;ios;android; ``` @@ -32,6 +32,32 @@ For example, to only target UWP, WASM and Android: ``` +### Available targets + +A MultiTarget names a *platform your component runs on*, not a TFM. The TFMs and the deployable +head it maps to depend on which WinUI version is selected, since Uno 5.x (WinUI 2, `Uno.UI`) and +Uno 6.x (WinUI 3, `Uno.WinUI`) ship different heads. + +| MultiTarget | Platform | WinUI 2 (Uno 5.x) | WinUI 3 (Uno 6.x) | +| --- | --- | --- | --- | +| `uwp` | Windows, UWP XAML | `uap10.0.17763`, `net{x}-windows10.0.26100` | n/a | +| `wasdk` | Windows, Windows App SDK | n/a | `net{x}-windows10.0.19041` | +| `wasm` | WebAssembly | `net{x}`, Wasm head | `net{x}`, `net{x}-browserwasm` head | +| `wpf` | Windows desktop, Skia WPF | `net{x}`, Skia WPF head | n/a — use `win32` | +| `win32` | Windows desktop, Skia Win32 | n/a — use `wpf` | `net{x}`, `net{x}-desktop` head | +| `linux` | Linux desktop | `net{x}`, Skia GTK head | `net{x}`, `net{x}-desktop` head | +| `macos` | macOS | `net{x}-maccatalyst` | `net{x}`, `net{x}-desktop` head | +| `ios` | iOS | `net{x}-ios` | `net{x}-ios` | +| `android` | Android | `net{x}-android` | `net{x}-android` | +| `netstandard` | .NET Standard, no WinUI | `netstandard2.0` | `netstandard2.0` | + +`win32`, `linux` and `macos` all deploy from the same build output on WinUI 3: Uno 6 replaced the +per-OS Skia heads with a single cross-platform `net{x}-desktop` head that picks its backend at +runtime. They stay separate MultiTargets so a component can declare — and solution generation and +CI can request — only the desktop platforms that are actually supported. + +Mac Catalyst is WinUI 2 only. Uno 7 removes support for it, and on WinUI 3 macOS is reached through +the Skia desktop head instead, so `net{x}-maccatalyst` is not part of the WinUI 3 package surface. ## ProjectReference Generation diff --git a/MultiTarget/Test-Component-Support.ps1 b/MultiTarget/Test-Component-Support.ps1 index 3844dedd..1ef8f054 100644 --- a/MultiTarget/Test-Component-Support.ps1 +++ b/MultiTarget/Test-Component-Support.ps1 @@ -32,11 +32,11 @@ Date: 6/6/2025 #> Param ( - [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [Alias("smt")] [string[]]$SupportedMultiTargets, - [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [Alias("rmt")] [Parameter(Mandatory=$true)] [string[]]$RequestedMultiTargets, @@ -51,17 +51,20 @@ Param ( ) if ($RequestedMultiTargets -eq 'all') { - $RequestedMultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') + $RequestedMultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard') } # List of WinUI-0 (non-WinUI) compatible multitargets $WinUI0MultiTargets = @('netstandard') -# List of WinUI-2 compatible multitargets -$WinUI2MultiTargets = @('uwp', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android') +# List of WinUI-2 (Uno 5.x / Uno.UI) compatible multitargets. +# 'linux' is the Skia GTK head there; 'wpf' is the Skia WPF head. +$WinUI2MultiTargets = @('uwp', 'wasm', 'wpf', 'linux', 'macos', 'ios', 'android') -# List of WinUI-3 compatible multitargets -$WinUI3MultiTargets = @('wasdk', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android') +# List of WinUI-3 (Uno 6.x / Uno.WinUI) compatible multitargets. +# win32, linux and macos are the desktop surface, all served by the single net9.0-desktop head that +# replaced Uno 5's per-OS Skia heads. 'wpf' stays WinUI 2 only, since Uno 6 dropped Uno.UI.Skia.Wpf. +$WinUI3MultiTargets = @('wasdk', 'wasm', 'win32', 'linux', 'macos', 'ios', 'android') # If WinUI 0 is requested, the component must not support WinUI 2 or WinUI 3 to be built. # If WinUI 2 or 3 is requested, the component must have a target that supports WinUI 2 or 3 to be built. diff --git a/MultiTarget/UseTargetFrameworks.ps1 b/MultiTarget/UseTargetFrameworks.ps1 index 1fa00ae4..927df5dc 100644 --- a/MultiTarget/UseTargetFrameworks.ps1 +++ b/MultiTarget/UseTargetFrameworks.ps1 @@ -22,19 +22,19 @@ #> Param ( [Parameter(HelpMessage = "The target frameworks to enable.")] - [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [Alias("mt")] [string[]]$MultiTargets = @('uwp', 'wasdk', 'wasm'), # default settings [Parameter(HelpMessage = "The target frameworks to disable.")] - [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')] + [ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard')] [string[]]$ExcludeMultiTargets = @() # default settings ) $fileContents = Get-Content -Path $PSScriptRoot/EnabledMultiTargets.props $newFileContents = $fileContents; -$AllMultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard') +$AllMultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'win32', 'linux', 'macos', 'ios', 'android', 'netstandard') # Exclude as needed foreach ($excluded in $ExcludeMultiTargets) { diff --git a/MultiTarget/UseUnoWinUI.ps1 b/MultiTarget/UseUnoWinUI.ps1 index 7b419a43..e260c3dd 100644 --- a/MultiTarget/UseUnoWinUI.ps1 +++ b/MultiTarget/UseUnoWinUI.ps1 @@ -11,14 +11,12 @@ function ApplyWinUISwap([string] $filePath) { $fileContents = $fileContents -replace '2', '3'; $fileContents = $fileContents -replace 'Uwp', 'WinUI'; $fileContents = $fileContents -replace 'Uwp', 'WinUI'; - $fileContents = $fileContents -replace 'Uno.UI', 'Uno.WinUI'; } if ($winUIMajorVersion -eq "2") { $fileContents = $fileContents -replace '3', '2'; $fileContents = $fileContents -replace 'WinUI', 'Uwp'; $fileContents = $fileContents -replace 'WinUI', 'Uwp'; - $fileContents = $fileContents -replace 'Uno.WinUI', 'Uno.UI'; } Set-Content -Force -Path $filePath -Value $fileContents; @@ -27,7 +25,6 @@ function ApplyWinUISwap([string] $filePath) { Write-Output "Switching Uno to WinUI $winUIMajorVersion"; -ApplyWinUISwap $PSScriptRoot/../ProjectHeads/App.Head.Uno.props ApplyWinUISwap $PSScriptRoot/PackageReferences/Uno.props ApplyWinUISwap $PSScriptRoot/WinUI.TargetVersion.props diff --git a/ProjectHeads/AllComponents/Uno/Assets/Icons/icon.svg b/ProjectHeads/AllComponents/Uno/Assets/Icons/icon.svg new file mode 100644 index 00000000..a15af53a --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Assets/Icons/icon.svg @@ -0,0 +1,42 @@ + + + + + + diff --git a/ProjectHeads/AllComponents/Uno/Assets/Icons/icon_foreground.svg b/ProjectHeads/AllComponents/Uno/Assets/Icons/icon_foreground.svg new file mode 100644 index 00000000..8ffc41ae --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Assets/Icons/icon_foreground.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ProjectHeads/AllComponents/Uno/Assets/SharedAssets.md b/ProjectHeads/AllComponents/Uno/Assets/SharedAssets.md new file mode 100644 index 00000000..b1cc4e76 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Assets/SharedAssets.md @@ -0,0 +1,32 @@ +# Shared Assets + +See documentation about assets here: https://github.com/unoplatform/uno/blob/master/doc/articles/features/working-with-assets.md + +## Here is a cheat sheet + +1. Add the image file to the `Assets` directory of a shared project. +2. Set the build action to `Content`. +3. (Recommended) Provide an asset for various scales/dpi + +### Examples + +```text +\Assets\Images\logo.scale-100.png +\Assets\Images\logo.scale-200.png +\Assets\Images\logo.scale-400.png + +\Assets\Images\scale-100\logo.png +\Assets\Images\scale-200\logo.png +\Assets\Images\scale-400\logo.png +``` + +### Table of scales + +| Scale | WinUI | iOS | Android | +|-------|:-----------:|:---------------:|:-------:| +| `100` | scale-100 | @1x | mdpi | +| `125` | scale-125 | N/A | N/A | +| `150` | scale-150 | N/A | hdpi | +| `200` | scale-200 | @2x | xhdpi | +| `300` | scale-300 | @3x | xxhdpi | +| `400` | scale-400 | N/A | xxxhdpi | diff --git a/ProjectHeads/AllComponents/Uno/Assets/Splash/splash_screen.svg b/ProjectHeads/AllComponents/Uno/Assets/Splash/splash_screen.svg new file mode 100644 index 00000000..8ffc41ae --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Assets/Splash/splash_screen.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj b/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj new file mode 100644 index 00000000..4f299089 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj @@ -0,0 +1,127 @@ + + + + + + + + true + + + $(TargetFrameworks)net9.0-desktop; + $(TargetFrameworks)net9.0-browserwasm; + $(TargetFrameworks)net9.0-android; + $(TargetFrameworks)net9.0-ios; + + + + Exe + + + SkiaRenderer; + + + false + true + CommunityToolkit.App.Uno + + + true + true + true + true + true + true + true + 3 + true + WinUI + + $(DefineConstants);WINUI3 + + + + + + + + + + + + net9.0 + net9.0-android + net9.0-ios + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SourceAssets/%(RecursiveDir)%(FileName)%(Extension) + + + SourceAssets/%(RecursiveDir)%(FileName)%(Extension) + + + SourceAssets/%(RecursiveDir)%(FileName)%(Extension).dat + + + + + + $(NoWarn);IL2026;Uno0006 + + + + + false + + diff --git a/ProjectHeads/AllComponents/Uno/Platforms/Android/AndroidManifest.xml b/ProjectHeads/AllComponents/Uno/Platforms/Android/AndroidManifest.xml new file mode 100644 index 00000000..24ee4aea --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/Android/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ProjectHeads/AllComponents/Uno/Platforms/Android/Assets/AboutAssets.txt b/ProjectHeads/AllComponents/Uno/Platforms/Android/Assets/AboutAssets.txt new file mode 100644 index 00000000..6b8fc66e --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/Android/Assets/AboutAssets.txt @@ -0,0 +1,5 @@ +Any raw assets you want to be deployed with your application can be placed in this +directory (and child directories). Deployment of the asset to your application is done +using the IDE or by using the following MSBuild property in your .csproj: + + diff --git a/ProjectHeads/AllComponents/Uno/Platforms/Android/Main.Android.cs b/ProjectHeads/AllComponents/Uno/Platforms/Android/Main.Android.cs new file mode 100644 index 00000000..31d89a6f --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/Android/Main.Android.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Android.App; +using Android.Runtime; + +namespace CommunityToolkit.App.Uno; + +[global::Android.App.ApplicationAttribute( + Label = "@string/ApplicationName", + Icon = "@mipmap/icon", + LargeHeap = true, + HardwareAccelerated = true, + Theme = "@style/AppTheme" +)] +public class Application : Microsoft.UI.Xaml.NativeApplication +{ + public Application(IntPtr javaReference, JniHandleOwnership transfer) + : base(() => new CommunityToolkit.App.Shared.App(), javaReference, transfer) + { + } +} \ No newline at end of file diff --git a/ProjectHeads/AllComponents/Uno/Platforms/Android/MainActivity.Android.cs b/ProjectHeads/AllComponents/Uno/Platforms/Android/MainActivity.Android.cs new file mode 100644 index 00000000..ad38d011 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/Android/MainActivity.Android.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Android.App; +using Android.Content.PM; +using Android.OS; +using Android.Views; +using Android.Widget; + +namespace CommunityToolkit.App.Uno; + +[Activity( + MainLauncher = true, + ConfigurationChanges = global::Uno.UI.ActivityHelper.AllConfigChanges, + WindowSoftInputMode = SoftInput.AdjustNothing | SoftInput.StateHidden +)] +public class MainActivity : Microsoft.UI.Xaml.ApplicationActivity +{ +} \ No newline at end of file diff --git a/ProjectHeads/AllComponents/Uno/Platforms/Android/Resources/values/Strings.xml b/ProjectHeads/AllComponents/Uno/Platforms/Android/Resources/values/Strings.xml new file mode 100644 index 00000000..ee06a129 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/Android/Resources/values/Strings.xml @@ -0,0 +1,4 @@ + + + CommunityToolkit + diff --git a/ProjectHeads/AllComponents/Uno/Platforms/Android/Resources/values/Styles.xml b/ProjectHeads/AllComponents/Uno/Platforms/Android/Resources/values/Styles.xml new file mode 100644 index 00000000..2c3bf24a --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/Android/Resources/values/Styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/ProjectHeads/AllComponents/Uno/Platforms/Android/environment.conf b/ProjectHeads/AllComponents/Uno/Platforms/Android/environment.conf new file mode 100644 index 00000000..9d9709a9 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/Android/environment.conf @@ -0,0 +1,2 @@ +## Mono GC tuning params +MONO_GC_PARAMS=soft-heap-limit=512m,nursery-size=64m,evacuation-threshold=66,major=marksweep,concurrent-sweep diff --git a/ProjectHeads/AllComponents/Uno/Platforms/Desktop/Program.cs b/ProjectHeads/AllComponents/Uno/Platforms/Desktop/Program.cs new file mode 100644 index 00000000..2f5400b3 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/Desktop/Program.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Uno.UI.Hosting; +using CommunityToolkit.App.Shared; + +internal class Program +{ + [STAThread] + public static void Main(string[] args) + { + var host = UnoPlatformHostBuilder.Create() + .App(() => new CommunityToolkit.App.Shared.App()) + .UseX11() + .UseLinuxFrameBuffer() + .UseMacOS() + .UseWin32() + .Build(); + + host.Run(); + } +} \ No newline at end of file diff --git a/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/LinkerConfig.xml b/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/LinkerConfig.xml new file mode 100644 index 00000000..cc3e5cdd --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/LinkerConfig.xml @@ -0,0 +1,3 @@ + + + diff --git a/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/Program.cs b/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/Program.cs new file mode 100644 index 00000000..f07914ec --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/Program.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Uno.UI.Hosting; +using CommunityToolkit.App.Shared; + +public class Program +{ + public static async Task Main(string[] args) + { + var host = UnoPlatformHostBuilder.Create() + .App(() => new CommunityToolkit.App.Shared.App()) + .UseWebAssembly() + .Build(); + + await host.RunAsync(); + } +} \ No newline at end of file diff --git a/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/WasmScripts/AppManifest.js b/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/WasmScripts/AppManifest.js new file mode 100644 index 00000000..8018667f --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/WasmScripts/AppManifest.js @@ -0,0 +1,3 @@ +var UnoAppManifest = { + displayName: "CommunityToolkit" +} diff --git a/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/manifest.webmanifest b/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/manifest.webmanifest new file mode 100644 index 00000000..8d6e55be --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/WebAssembly/manifest.webmanifest @@ -0,0 +1,10 @@ +{ + "name": "CommunityToolkit", + "description": "CommunityToolkit", + "short_name": "CommunityToolkit", + "start_url": "/index.html", + "display": "standalone", + "background_color": "#FFFFFF", + "theme_color": "#FFFFFF", + "scope": "/" +} diff --git a/ProjectHeads/AllComponents/Uno/Platforms/iOS/Entitlements.plist b/ProjectHeads/AllComponents/Uno/Platforms/iOS/Entitlements.plist new file mode 100644 index 00000000..6631ffa6 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/iOS/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/ProjectHeads/AllComponents/Uno/Platforms/iOS/Info.plist b/ProjectHeads/AllComponents/Uno/Platforms/iOS/Info.plist new file mode 100644 index 00000000..8f81dd88 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/iOS/Info.plist @@ -0,0 +1,43 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + + CFBundleIdentifier + com.companyname.CommunityToolkit + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + CommunityToolkit + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + MinimumOSVersion + 16.0 + UIDeviceFamily + + 1 + 2 + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/ProjectHeads/AllComponents/Uno/Platforms/iOS/Main.iOS.cs b/ProjectHeads/AllComponents/Uno/Platforms/iOS/Main.iOS.cs new file mode 100644 index 00000000..b163d7dd --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/iOS/Main.iOS.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Uno.UI.Hosting; +using CommunityToolkit.App.Shared; + +namespace CommunityToolkit.App.Uno; + +public class EntryPoint +{ + public static void Main(string[] args) + { + var host = UnoPlatformHostBuilder.Create() + .App(() => new CommunityToolkit.App.Shared.App()) + .UseAppleUIKit() + .Build(); + + host.Run(); + } +} \ No newline at end of file diff --git a/ProjectHeads/AllComponents/Uno/Platforms/iOS/Media.xcassets/LaunchImages.launchimage/Contents.json b/ProjectHeads/AllComponents/Uno/Platforms/iOS/Media.xcassets/LaunchImages.launchimage/Contents.json new file mode 100644 index 00000000..4103a707 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/iOS/Media.xcassets/LaunchImages.launchimage/Contents.json @@ -0,0 +1,20 @@ +{ + "images": [ + { + "idiom": "universal", + "scale": "1x" + }, + { + "idiom": "universal", + "scale": "2x" + }, + { + "idiom": "universal", + "scale": "3x" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} diff --git a/ProjectHeads/AllComponents/Uno/Platforms/iOS/PrivacyInfo.xcprivacy b/ProjectHeads/AllComponents/Uno/Platforms/iOS/PrivacyInfo.xcprivacy new file mode 100644 index 00000000..1d00d2f5 --- /dev/null +++ b/ProjectHeads/AllComponents/Uno/Platforms/iOS/PrivacyInfo.xcprivacy @@ -0,0 +1,31 @@ + + + + + NSPrivacyTracking + + NSPrivacyTrackingDomains + + NSPrivacyCollectedDataTypes + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + + diff --git a/ProjectHeads/AllComponents/Wasm/Program.cs b/ProjectHeads/AllComponents/Wasm/Program.cs index 43e990c1..a7aae2ee 100644 --- a/ProjectHeads/AllComponents/Wasm/Program.cs +++ b/ProjectHeads/AllComponents/Wasm/Program.cs @@ -5,7 +5,7 @@ using CommunityToolkit.App.Shared; #if WINAPPSDK -using Microsoft.UI.Xaml; +using Uno.UI.Hosting; #else using Windows.UI.Xaml; #endif @@ -14,6 +14,17 @@ namespace CommunityToolkit.App.Wasm; public class Program { +#if WINAPPSDK + static async Task Main(string[] args) + { + var host = UnoPlatformHostBuilder.Create() + .App(() => new CommunityToolkit.App.Shared.App()) + .UseWebAssembly() + .Build(); + + await host.RunAsync(); + } +#else private static CommunityToolkit.App.Shared.App? _app; static int Main(string[] args) @@ -22,4 +33,5 @@ static int Main(string[] args) return 0; } +#endif } diff --git a/ProjectHeads/App.Head.Uno.UI.Dependencies.props b/ProjectHeads/App.Head.Uno.UI.Dependencies.props index 361463b9..49fe326c 100644 --- a/ProjectHeads/App.Head.Uno.UI.Dependencies.props +++ b/ProjectHeads/App.Head.Uno.UI.Dependencies.props @@ -6,5 +6,3 @@ - - diff --git a/ProjectHeads/App.Head.Uno.WinUI.Dependencies.props b/ProjectHeads/App.Head.Uno.WinUI.Dependencies.props index d18fbfb5..77c9bc88 100644 --- a/ProjectHeads/App.Head.Uno.WinUI.Dependencies.props +++ b/ProjectHeads/App.Head.Uno.WinUI.Dependencies.props @@ -4,6 +4,6 @@ - + diff --git a/ProjectHeads/App.Head.Uno.props b/ProjectHeads/App.Head.Uno.props index 865ea717..7e9235e4 100644 --- a/ProjectHeads/App.Head.Uno.props +++ b/ProjectHeads/App.Head.Uno.props @@ -1,6 +1,7 @@ - WinUI + WinUI + Uwp @@ -25,8 +26,9 @@ - + + diff --git a/ProjectHeads/App.Head.Wasm.props b/ProjectHeads/App.Head.Wasm.props index ed7c9705..32487037 100644 --- a/ProjectHeads/App.Head.Wasm.props +++ b/ProjectHeads/App.Head.Wasm.props @@ -2,6 +2,7 @@ Exe $(WasmHeadTargetFramework.Split(';')[0]) + false + + + + + true + + + $(TargetFrameworks)net9.0-desktop; + $(TargetFrameworks)net9.0-browserwasm; + $(TargetFrameworks)net9.0-android; + $(TargetFrameworks)net9.0-ios; + + + + Exe + + + SkiaRenderer; + + + false + true + + + true + true + true + true + true + true + true + 3 + true + WinUI + + $(DefineConstants);WINUI3 + + + + + + + + net9.0 + net9.0-android + net9.0-ios + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SourceAssets/%(RecursiveDir)%(FileName)%(Extension).dat + + + + + + + $(NoWarn);IL2026;Uno0006 + + + + + false + + diff --git a/ProjectHeads/SingleComponent/Wasm/Program.cs b/ProjectHeads/SingleComponent/Wasm/Program.cs index 9522ede6..91bd1b52 100644 --- a/ProjectHeads/SingleComponent/Wasm/Program.cs +++ b/ProjectHeads/SingleComponent/Wasm/Program.cs @@ -4,10 +4,25 @@ using CommunityToolkit.App.Shared; +#if WINAPPSDK +using Uno.UI.Hosting; +#endif + namespace ProjectTemplateExperiment.Samples.Wasm; public class Program { +#if WINAPPSDK + static async Task Main(string[] args) + { + var host = UnoPlatformHostBuilder.Create() + .App(() => new App()) + .UseWebAssembly() + .Build(); + + await host.RunAsync(); + } +#else private static App? _app; static int Main(string[] args) @@ -16,4 +31,5 @@ static int Main(string[] args) return 0; } +#endif } diff --git a/ProjectHeads/Targets/AddMultiTargetCompatibleSampleDocs.targets b/ProjectHeads/Targets/AddMultiTargetCompatibleSampleDocs.targets index 02d0ea88..496a7912 100644 --- a/ProjectHeads/Targets/AddMultiTargetCompatibleSampleDocs.targets +++ b/ProjectHeads/Targets/AddMultiTargetCompatibleSampleDocs.targets @@ -8,10 +8,17 @@ uwp wasm wasdk + wpf + win32 + linux macos ios android netstandard + + + win32;linux;macos diff --git a/ProjectHeads/Tasks/CheckMultiTarget.props b/ProjectHeads/Tasks/CheckMultiTarget.props index 812b68fe..2b9c581b 100644 --- a/ProjectHeads/Tasks/CheckMultiTarget.props +++ b/ProjectHeads/Tasks/CheckMultiTarget.props @@ -120,7 +120,22 @@ multiTargetIdentifier = ExtractMultiTargetIdentifier(multiTargetPropsContent); } - IsSupported = multiTargetIdentifier.Split(';').Contains(MultiTargetIdentifier); + // MultiTargetIdentifier may be a ';' separated list: the unified Uno desktop head covers + // several MultiTargets with a single build, so a doc matching any one of them is supported. + string[] componentMultiTargets = multiTargetIdentifier.Split(';'); + IsSupported = false; + + foreach (string headMultiTarget in MultiTargetIdentifier.Split(';')) + { + string trimmedHeadMultiTarget = headMultiTarget.Trim(); + + if (trimmedHeadMultiTarget.Length > 0 && componentMultiTargets.Contains(trimmedHeadMultiTarget)) + { + IsSupported = true; + break; + } + } + FilePath.SetMetadata("IsSupported", IsSupported.ToString()); ]]> diff --git a/ProjectTemplate/src/MultiTarget.props b/ProjectTemplate/src/MultiTarget.props index b11c1942..7d1e11c3 100644 --- a/ProjectTemplate/src/MultiTarget.props +++ b/ProjectTemplate/src/MultiTarget.props @@ -4,6 +4,6 @@ MultiTarget is a custom property that indicates which target a project is designed to be built for / run on. Used to create project references, generate solution files, enable/disable TargetFrameworks, and build nuget packages. --> - uwp;wasdk;wpf;wasm;linuxgtk;macos;ios;android; + uwp;wasdk;wpf;win32;wasm;linux;macos;ios;android; \ No newline at end of file diff --git a/global.json b/global.json index cfa58f62..200291be 100644 --- a/global.json +++ b/global.json @@ -3,8 +3,9 @@ "version": "9.0.310", "rollForward": "latestFeature" }, - "msbuild-sdks": + "msbuild-sdks": { - "MSBuild.Sdk.Extras":"3.0.23" + "MSBuild.Sdk.Extras":"3.0.23", + "Uno.Sdk": "6.4.58" } }