-
Notifications
You must be signed in to change notification settings - Fork 19
Migrate to Uno.Sdk #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Migrate to Uno.Sdk #305
Changes from all commits
d01dc7c
e70d8d9
b17dd30
566fc13
e213dce
54afbc3
0cbae24
608080f
c052b37
8503cf3
f4f33e6
93b31a4
4e11289
588a976
7b8fb29
039b688
54b711e
389f7b2
ce07079
9ba4c3e
5457779
8df4381
0ab40f3
ed352f7
01a12c0
3b1e7d1
7e9ebc9
8e7af1f
2a31505
3433dc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,21 +112,26 @@ 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 | ||
|
|
||
| - 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. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm very confused by the rationale for this comment, why would we need to explicitly define the behavior of switching between the classic wasm/winui2 and the modern wasm/winui3? The multitarget system exists to abstract away this complexity and reduce the platform choice (native or uno) down to their actual deployment targets from the developer perspective. Neither the consuming developer nor the CI matrix should have to manually activate Uno or switch around Uno complexity under the hood, our internals should handle this transparently. E.g. -- If WinUI 2 + wasm is requested, it uses the classic WASM head. If WinUI 3 + wasm is asked for, it uses the newer Uno SDK head. These implementation details should not leak into parameters that make it to the CLI or CI, they're implied by the requested WinUI version and the user-requested + component-supported MultiTargets. |
||
| - 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' || '' }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as https://github.com/CommunityToolkit/Tooling-Windows-Submodule/pull/305/changes#r3997101887, wondering if we can have |
||
|
|
||
| - 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' || '' }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment regarding |
||
| ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} | ||
|
|
||
| - name: MSBuild | ||
| if: ${{ !matrix.unoSdkHead }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we clean up the We need to double check that we're not making an excess/unnecessary change here, if we can build the Uno head in VS then it should also work via CLI with msbuild instead of dotnet and we won't need this line or L246-L250 below. |
||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
|
|
||
| - 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) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like you're running our custom scaffold + build script and then... building again?
This looks like an excess unexpected change. Presumably it's here so that we can make sure the Uno heads build on Linux and not just the components, but it's building the components multiple times and building every component at least one more time than it strictly needs to (looks like twice is minimum, currently 3x). Since the existing This script generates project references and builds the head you ask for based solely on the requested WinUI version and the requested MultiTargets in the same manner described in my comment above. Using
|
||
| 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 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment regarding |
||
| ) | ||
|
|
||
| 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" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment regarding |
||
| ) | ||
|
|
||
| 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" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MultiTargets imply the heads that need to be included when generating the solution, we don't need a separate switch parameter for it.
As example, if you request components that have UnoSdk-compatible MultiTargets supported and you also request to enable those same MultiTargets when generating the solution, then the UnoSdk head should be included implicitly without needing an explicit param flag/switch.
We do this on
mainin:Tooling-Windows-Submodule/GenerateAllSolution.ps1
Lines 125 to 169 in ebb5ee2
and
Tooling-Windows-Submodule/GenerateSingleSolution.ps1
Lines 189 to 209 in ebb5ee2
We'll want to do something similar here, having a dedicated parameter for this is an excess requirement that we can simplify by extending the method we already use to enable heads based on requested/supported multitargets.