Skip to content

Commit 890fa73

Browse files
committed
Merge branch 'main' into marquee
2 parents f0b3158 + c10c2f1 commit 890fa73

File tree

56 files changed

+521
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+521
-344
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
]
1010
},
1111
"xamlstyler.console": {
12-
"version": "3.2008.4",
12+
"version": "3.2206.4",
1313
"commands": [
1414
"xstyler"
1515
]

.github/workflows/build.yml

Lines changed: 21 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ jobs:
2424

2525
# Steps represent a sequence of tasks that will be executed as part of the job
2626
steps:
27-
# Needed until XAML Styler updates to .NET 6
28-
- name: Install .NET Core 3.1 SDK
27+
- name: Install .NET 6 SDK
2928
uses: actions/setup-dotnet@v1
3029
with:
31-
dotnet-version: '3.1.x'
30+
dotnet-version: '6.0.x'
3231

3332
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3433
- name: Checkout Repository
@@ -41,84 +40,16 @@ jobs:
4140
- name: Check XAML Styling
4241
run: powershell -version 5.1 -command "./ApplyXamlStyling.ps1 -Passive" -ErrorAction Stop
4342

44-
# This workflow contains a single job called "Build-WinUI-2"
45-
Build-WinUI-2:
43+
# Build both Uno.UI/WinUI2/UWP and Uno.WinUI/WinUI3/WindowsAppSDK versions of our packages using a matrix
44+
build:
4645
needs: [Xaml-Style-Check]
4746
runs-on: windows-latest
4847

49-
# Steps represent a sequence of tasks that will be executed as part of the job
50-
steps:
51-
- name: Install .NET 6 SDK
52-
uses: actions/setup-dotnet@v1
53-
with:
54-
dotnet-version: '6.0.202'
55-
56-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
57-
- name: Checkout Repository
58-
uses: actions/checkout@v2
59-
60-
# Restore Tools from Manifest list in the Repository
61-
- name: Restore dotnet tools
62-
run: dotnet tool restore
63-
64-
- name: Run Uno Check to Install Dependencies
65-
run: dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --verbose
66-
67-
- name: Add msbuild to PATH
68-
uses: microsoft/[email protected]
69-
70-
- name: Enable all TargetFrameworks
71-
working-directory: ./common/Scripts/
72-
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 all" -ErrorAction Stop
73-
74-
- name: Generate solution
75-
run: powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop
76-
77-
- name: MSBuild
78-
# working-directory: ./
79-
run: msbuild.exe Toolkit.Labs.All.sln /restore -p:Configuration=Release
80-
81-
# Build All Packages
82-
- name: pack experiments
83-
working-directory: ./common/Scripts/
84-
run: ./PackEachExperiment.ps1 all
85-
86-
# Push Packages to our DevOps Artifacts Feed
87-
- name: Add source
88-
if: ${{github.ref == 'refs/heads/main'}}
89-
run: dotnet nuget add source "https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" --name LabsFeed --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
90-
91-
- name: Push packages
92-
if: ${{github.ref == 'refs/heads/main'}}
93-
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate
94-
95-
# Run tests
96-
- name: Setup VSTest Path
97-
uses: darenm/Setup-VSTest@v1
98-
99-
- name: Install Testspace Module
100-
uses: testspace-com/setup-testspace@v1
101-
with:
102-
domain: ${{ github.repository_owner }}
103-
104-
- name: Run SourceGenerators tests
105-
run: vstest.console.exe ./common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"
106-
107-
- name: Run experiment tests against UWP
108-
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx"
109-
110-
- name: Run experiment tests against WinAppSDK
111-
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx"
112-
113-
- name: Create test reports
114-
run: |
115-
testspace '[WinUI2]./TestResults/*.trx'
116-
if: always()
117-
118-
# This workflow contains a single job called "Build-WinUI-3"
119-
Build-WinUI-3:
120-
needs: [Xaml-Style-Check]
121-
runs-on: windows-latest
48+
# See https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs
49+
strategy:
50+
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion.
51+
matrix:
52+
platform: [WinUI2, WinUI3]
12253

12354
# Steps represent a sequence of tasks that will be executed as part of the job
12455
steps:
@@ -148,12 +79,12 @@ jobs:
14879
- name: Generate solution
14980
run: powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop
15081

151-
- name: Enable WinUI 3
82+
- name: Enable Uno.WinUI (in WinUI3 matrix only)
15283
working-directory: ./common/Scripts/
15384
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
85+
if: ${{ matrix.platform == 'WinUI3' }}
15486

15587
- name: MSBuild
156-
# working-directory: ./
15788
run: msbuild.exe Toolkit.Labs.All.sln /restore /nowarn:MSB4011 -p:Configuration=Release
15889

15990
# Build All Packages
@@ -180,21 +111,24 @@ jobs:
180111
domain: ${{ github.repository_owner }}
181112

182113
- name: Run SourceGenerators tests
114+
id: test-generator
183115
run: vstest.console.exe ./common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"
184116

185117
- name: Run experiment tests against UWP
118+
id: test-uwp
186119
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx"
187120

188121
- name: Run experiment tests against WinAppSDK
122+
id: test-winappsdk
189123
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx"
190124

191125
- name: Create test reports
192126
run: |
193-
testspace '[WinUI3]./TestResults/*.trx'
194-
if: always()
127+
testspace '[${{ matrix.platform }}]./TestResults/*.trx'
128+
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
195129

196-
# Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
197-
experiment:
130+
# Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
131+
new-experiment:
198132
needs: [Xaml-Style-Check]
199133
runs-on: windows-latest
200134

@@ -239,15 +173,17 @@ jobs:
239173
domain: ${{ github.repository_owner }}
240174

241175
- name: Run tests in the generated experiment against UWP
176+
id: test-uwp
242177
run: vstest.console.exe ./labs/CiTestExp/**/CiTestExp.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpUWP.trx"
243178

244179
- name: Run tests in the generated experiment against WinAppSDK
180+
id: test-winappsdk
245181
run: vstest.console.exe ./labs/CiTestExp/**/CiTestExp.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpWinAppSdk.trx"
246182

247183
- name: Create test reports
248184
run: |
249185
testspace '[New Experiment]./TestResults/*.trx'
250-
if: always()
186+
if: ${{ always() && (steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
251187

252188
wasm-linux:
253189
needs: [Xaml-Style-Check]

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,4 +357,4 @@ MigrationBackup/
357357

358358
# Community Toolkit Labs generated files
359359
Toolkit.Labs.All.sln
360-
Labs.SampleRefs.props
360+
common/MultiTarget/Generated/**

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"type": "PowerShell",
2828
"request": "launch",
2929
"name": "Discover samples",
30-
"script": "${workspaceFolder}/DiscoverSamples.ps1",
30+
"script": "${workspaceFolder}/common/MultiTarget/GenerateAllProjectReferences.ps1; ${workspaceFolder}/common/GenerateVSCodeLaunchConfig.ps1; ",
3131
"presentation": {
3232
"group": "2",
3333
"order": 2

DiscoverSamples.ps1

Lines changed: 0 additions & 104 deletions
This file was deleted.

GenerateAllSolution.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Param (
44
[string]$UseUnoWinUI = 2
55
)
66

7+
# Generate required props for "All" solution.
8+
& ./common/MultiTarget/GenerateAllProjectReferences.ps1
9+
& ./common/GenerateVSCodeLaunchConfig.ps1
10+
711
# Set WinUI version for Uno projects
812
$originalWorkingDirectory = Get-Location;
913

@@ -243,6 +247,3 @@ $solutionTemplate = $solutionTemplate -replace "(?m)^\s*`r`n", "";
243247
# Save
244248
Set-Content -Path $generatedSolutionFilePath -Value $solutionTemplate;
245249
Write-Output "Solution generated at $generatedSolutionFilePath";
246-
247-
# Run sample discovery
248-
& ./DiscoverSamples.ps1
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Param (
2+
[Parameter(HelpMessage = "Disables suppressing changes to the ./.vscode/launch.json file in git, allowing changes to be committed.")]
3+
[switch]$allowGitChanges = $false
4+
)
5+
6+
function CreateVsCodeLaunchConfigJson {
7+
param (
8+
[string]$projectName
9+
)
10+
11+
return "{
12+
`"name`": `"$projectName`",
13+
`"type`": `"coreclr`",
14+
`"request`": `"launch`",
15+
`"program`": `"dotnet`",
16+
`"args`": [
17+
`"run`",
18+
`"build`",
19+
`"/r`",
20+
`"/p:UnoSourceGeneratorUseGenerationHost=true`",
21+
`"/p:UnoSourceGeneratorUseGenerationController=false`",
22+
`"/p:UnoRemoteControlPort=443`",
23+
`"--project=`$`{workspaceFolder`}/labs/$projectName/samples/$projectName.Wasm/$projectName.Wasm.csproj`"
24+
],
25+
`"presentation`": {
26+
`"group`": `"2`"
27+
},
28+
`"cwd`": `"`$`{workspaceFolder`}/labs/$projectName/samples/$projectName.Wasm`"
29+
}";
30+
}
31+
32+
$launchConfigJson = Get-Content -Path "$PSScriptRoot/../.vscode/launch.json" -ErrorAction Stop;
33+
$launchConfig = $launchConfigJson | ConvertFrom-Json;
34+
35+
# Remove all non-generated configurations
36+
$originalConfigurations = $launchConfig.configurations;
37+
$launchConfig.configurations = @();
38+
$launchConfig.configurations += $originalConfigurations[0];
39+
$launchConfig.configurations += $originalConfigurations[1];
40+
41+
foreach ($wasmProjectPath in Get-ChildItem -Recurse -Path "$PSScriptRoot/../*/*/samples/*.Wasm/*.Wasm.csproj") {
42+
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($wasmProjectPath) -Replace ".Wasm", "";
43+
Write-Host "Generating VSCode launch config for $projectName";
44+
45+
$configJson = CreateVsCodeLaunchConfigJson $projectName;
46+
$config = $configJson | ConvertFrom-Json;
47+
48+
$launchConfig.configurations += $config;
49+
}
50+
51+
if ($allowGitChanges.IsPresent) {
52+
Write-Warning "Changes to the default launch.json can now be committed. Run this command again without the -allowGitChanges flag to disable committing further changes.";
53+
git update-index --no-assume-unchanged $PSScriptRoot/../.vscode/launch.json
54+
}
55+
else {
56+
Write-Output "Changes to the default launch.json are now suppressed. To switch branches, run git reset --hard with a clean working tree. Include the -allowGitChanges flag to enable committing changes.";
57+
git update-index --assume-unchanged $PSScriptRoot/../.vscode/launch.json
58+
}
59+
60+
# Save
61+
Set-Content -Path "$PSScriptRoot/../.vscode/launch.json" -Value ($launchConfig | ConvertTo-Json -Depth 9);
62+
Write-Output "Saved VSCode launch configs to $(Resolve-Path $PSScriptRoot/../.vscode/launch.json)";

common/Labs.Head.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<IsAllExperimentHead Condition="$(MSBuildProjectName.StartsWith('CommunityToolkit.Labs.')) == 'true'">true</IsAllExperimentHead>
3030
<IsProjectTemplateHead Condition="$(MSBuildProjectName.StartsWith('ProjectTemplate')) == 'true'">true</IsProjectTemplateHead>
3131
<IsSingleExperimentHead Condition="'$(IsAllExperimentHead)' != 'true' AND '$(IsProjectTemplateHead)' != 'true'">true</IsSingleExperimentHead>
32+
33+
<DefineConstants Condition="$(IsAllExperimentHead) == 'true'">$(DefineConstants);LABS_ALL_SAMPLES</DefineConstants>
3234
</PropertyGroup>
3335

3436
<!-- See https://github.com/CommunityToolkit/Labs-Windows/issues/142 -->

0 commit comments

Comments
 (0)