Skip to content

Commit 71679cb

Browse files
committed
Adjust scripts and workflows
1 parent 2881145 commit 71679cb

6 files changed

Lines changed: 131 additions & 19 deletions

File tree

.github/workflows/build.yml

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,26 @@ jobs:
111111
with:
112112
global-json-file: tooling/global.json
113113

114+
- name: Install .NET workloads
115+
run: dotnet workload install wasm-tools
116+
114117
- name: .NET Info (if diagnostics)
115118
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
116119
run: dotnet --info
117120

118121
- name: Copy props files to root
119122
shell: pwsh
120123
working-directory: ./
121-
run: copy ./tooling/.github/workflows/config/* ./
124+
run: |
125+
copy ./tooling/.github/workflows/config/* ./
126+
copy ./tooling/global.json ./
122127
123128
- name: Add msbuild to PATH
124129
uses: microsoft/setup-msbuild@v2
125130

126131
- name: Add project heads to ProjectTemplate
127132
working-directory: ./${{ env.PROJECT_DIRECTORY }}
128-
run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
133+
run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -IncludeUnoSdkHead -componentPath ${{ github.workspace }}/${{ env.PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
129134

130135
# Build and use template for creating new experiments
131136
- name: Build ProjectTemplate
@@ -177,6 +182,10 @@ jobs:
177182
with:
178183
global-json-file: tooling/global.json
179184

185+
- name: Install .NET workloads
186+
if: ${{ matrix.multitarget == 'wasm' }}
187+
run: dotnet workload install wasm-tools
188+
180189
- name: .NET Info (if diagnostics)
181190
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
182191
run: dotnet --info
@@ -186,6 +195,7 @@ jobs:
186195
working-directory: ./
187196
run: |
188197
copy ./tooling/.github/workflows/config/* ./
198+
copy ./tooling/global.json ./
189199
mkdir ./.config
190200
copy ./tooling/.config/dotnet-tools.json ./.config/dotnet-tools.json
191201
mkdir ./components
@@ -209,12 +219,29 @@ jobs:
209219

210220
- name: Add project heads to ${{ env.TEST_PROJECT_NAME }}
211221
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
212-
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' || '' }}"
222+
run: >-
223+
${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1
224+
-MultiTargets ${{ matrix.multitarget }}
225+
-winui ${{ matrix.winui }}
226+
-componentPath "${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}"
227+
${{ matrix.multitarget == 'wasm' && matrix.winui == 3 && ' -IncludeUnoSdkHead' || '' }}
228+
${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
213229
214230
- name: MSBuild
231+
if: ${{ matrix.multitarget != 'wasm' || matrix.winui == 2 }}
215232
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
216233
run: msbuild.exe ${{ env.TEST_PROJECT_NAME }}.sln /restore /nowarn:MSB4011 -p:Configuration=Release
217234

235+
- name: Build Uno head (browserwasm)
236+
if: ${{ matrix.multitarget == 'wasm' && matrix.winui == 3 }}
237+
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
238+
run: dotnet build heads/Uno/${{ env.TEST_PROJECT_NAME }}.Uno.csproj -f net9.0-browserwasm -p:Configuration=Release
239+
240+
- name: Build Uno head (desktop)
241+
if: ${{ matrix.multitarget == 'wasm' && matrix.winui == 3 }}
242+
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
243+
run: dotnet build heads/Uno/${{ env.TEST_PROJECT_NAME }}.Uno.csproj -f net9.0-desktop -p:Configuration=Release
244+
218245
# Run tests
219246
- name: Setup VSTest Path
220247
uses: darenm/setup-vstest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44
@@ -241,10 +268,11 @@ jobs:
241268
name: new-experiment-logs
242269
path: ./**/*.*log
243270

244-
wasm-linux:
245-
runs-on: ubuntu-latest
271+
uno-linux:
272+
runs-on: windows-2022
246273
env:
247274
HEADS_DIRECTORY: tooling/ProjectHeads
275+
PROJECT_DIRECTORY: tooling/ProjectTemplate
248276
TEST_PROJECT_NAME: CiTestExp
249277

250278
steps:
@@ -259,6 +287,9 @@ jobs:
259287
with:
260288
global-json-file: tooling/global.json
261289

290+
- name: Install .NET workloads
291+
run: dotnet workload install android ios maui wasm-tools
292+
262293
- name: .NET Info (if diagnostics)
263294
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
264295
run: dotnet --info
@@ -268,10 +299,14 @@ jobs:
268299
working-directory: ./
269300
run: |
270301
copy ./tooling/.github/workflows/config/* ./
302+
copy ./tooling/global.json ./
271303
mkdir ./.config
272304
copy ./tooling/.config/dotnet-tools.json ./.config/dotnet-tools.json
273305
mkdir ./components
274306
307+
- name: Add msbuild to PATH
308+
uses: microsoft/setup-msbuild@v2
309+
275310
# Restore Tools from Manifest list in the Repository
276311
- name: Restore dotnet tools
277312
working-directory: ./
@@ -289,20 +324,36 @@ jobs:
289324
- name: Generate solution
290325
shell: pwsh
291326
working-directory: ./
292-
run: ./tooling/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -MultiTargets wasm
327+
run: ./tooling/GenerateAllSolution.ps1 -IncludeUnoSdkHead${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -MultiTargets wasm
293328

294329
- name: dotnet build
295330
shell: pwsh
296331
working-directory: ./
297332
run: ./tooling/Build-Toolkit-Components.ps1 -Release -MultiTargets wasm ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -BinlogOutput ./ -EnableBinLogs' || '' }}
298-
299-
# TODO: Do we want to run tests here? Can we do that on linux easily?
333+
334+
- name: Build Uno head (browserwasm)
335+
shell: pwsh
336+
working-directory: ./
337+
run: >-
338+
dotnet build
339+
tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj
340+
-f net9.0-browserwasm
341+
-p:Configuration=Release
342+
343+
- name: Build Uno head (desktop)
344+
shell: pwsh
345+
working-directory: ./
346+
run: >-
347+
dotnet build
348+
tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj
349+
-f net9.0-desktop
350+
-p:Configuration=Release
300351
301352
- name: Artifact - Diagnostic Logs
302353
uses: actions/upload-artifact@v4
303354
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
304355
with:
305-
name: linux-logs
356+
name: uno-linux-logs
306357
path: ./**/*.*log
307358

308359

GenerateAllSolution.ps1

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ Param (
5454
[string[]]$ExcludeComponents,
5555

5656
[switch]$UseDiagnostics = $false,
57-
58-
[bool]$Launch = $true
57+
58+
[bool]$Launch = $true,
59+
60+
[switch]$IncludeUnoSdkHead = $false
5961
)
6062

6163
if ($MultiTargets.Contains('all')) {
@@ -155,6 +157,11 @@ foreach ($componentName in $Components) {
155157
# Once we have that, just do a transform on the csproj filename inside this loop to decide the same csproj for those separate MultiTargets.
156158
# ===
157159
foreach ($multitarget in $allUsedMultiTargetPrefs) {
160+
# When using Uno.Sdk head, skip the traditional Wasm head (Uno SDK covers wasm for WinUI 3)
161+
if ($multitarget -eq 'wasm' -and $IncludeUnoSdkHead) {
162+
continue
163+
}
164+
158165
# capitalize first letter, avoid case sensitivity issues on linux
159166
$csprojFileNamePartForMultiTarget = $multitarget.substring(0,1).ToUpper() + $multitarget.Substring(1).ToLower()
160167

@@ -168,6 +175,15 @@ foreach ($multitarget in $allUsedMultiTargetPrefs) {
168175
}
169176
}
170177

178+
if ($IncludeUnoSdkHead) {
179+
$unoHeadPath = "./tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj"
180+
if (Test-Path $unoHeadPath) {
181+
[void]$projects.Add($unoHeadPath)
182+
} else {
183+
Write-Warning "Uno.Sdk head project not found at $unoHeadPath."
184+
}
185+
}
186+
171187
if ($UseDiagnostics.IsPresent)
172188
{
173189
$sdkoptions = "-d"

GenerateSingleSolution.ps1

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ Param (
4949
[string]$componentPath,
5050

5151
[Parameter(HelpMessage = "Add extra diagnostic output to slngen generator.")]
52-
[switch]$UseDiagnostics = $false
52+
[switch]$UseDiagnostics = $false,
53+
54+
[switch]$IncludeUnoSdkHead = $false
5355
)
5456

5557
if ($null -ne $Env:Path -and $Env:Path.ToLower().Contains("msbuild") -eq $false) {
@@ -185,6 +187,11 @@ Write-Output "Generating solution for $componentName in $generatedSolutionFilePa
185187
# TODO: this handles separate project heads, but won't directly handle the unified Skia head from Uno.
186188
# Once we have that, just do a transform on the csproj filename inside this loop to decide the same csproj for those separate MultiTargets.
187189
foreach ($multitarget in $MultiTargets) {
190+
# When using Uno.Sdk head, skip the traditional Wasm head (Uno SDK covers wasm for WinUI 3)
191+
if ($multitarget -eq 'wasm' -and $IncludeUnoSdkHead) {
192+
continue
193+
}
194+
188195
# capitalize first letter, avoid case sensitivity issues on linux
189196
$csprojFileNamePartForMultiTarget = $multitarget.substring(0,1).ToUpper() + $multitarget.Substring(1).ToLower()
190197

@@ -202,6 +209,17 @@ foreach ($multitarget in $MultiTargets) {
202209
}
203210
}
204211

212+
if ($IncludeUnoSdkHead) {
213+
$unoHeadPath = "$outputHeadsDir\Uno\*Uno.csproj"
214+
if (Test-Path $unoHeadPath) {
215+
foreach ($foundItem in Get-ChildItem $unoHeadPath) {
216+
$projects = $projects + $foundItem.FullName
217+
}
218+
} else {
219+
Write-Warning "Uno.Sdk head project not found at $unoHeadPath."
220+
}
221+
}
222+
205223
# Include common dependencies required for solution to build
206224
$projects = $projects + "$PSScriptRoot\CommunityToolkit.App.Shared\**\*.*proj"
207225
$projects = $projects + "$PSScriptRoot\CommunityToolkit.Tests.Shared\**\*.*proj"

GenerateVSCodeLaunchConfig.ps1

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function CreateVsCodeLaunchConfigJson {
99
)
1010

1111
return "{
12-
`"name`": `"$projectName`",
12+
`"name`": `"$projectName (Wasm)`",
1313
`"type`": `"coreclr`",
1414
`"request`": `"launch`",
1515
`"program`": `"dotnet`",
@@ -29,6 +29,32 @@ function CreateVsCodeLaunchConfigJson {
2929
}";
3030
}
3131

32+
function CreateUnoVsCodeLaunchConfigJson {
33+
param (
34+
[string]$projectName
35+
)
36+
37+
return "{
38+
`"name`": `"$projectName (Uno)`",
39+
`"type`": `"coreclr`",
40+
`"request`": `"launch`",
41+
`"program`": `"dotnet`",
42+
`"args`": [
43+
`"run`",
44+
`"build`",
45+
`"/r`",
46+
`"/p:UnoSourceGeneratorUseGenerationHost=true`",
47+
`"/p:UnoSourceGeneratorUseGenerationController=false`",
48+
`"/p:UnoRemoteControlPort=443`",
49+
`"--project=`$`{workspaceFolder`}/components/$projectName/heads/Uno/$projectName.Uno.csproj`"
50+
],
51+
`"presentation`": {
52+
`"group`": `"2`"
53+
},
54+
`"cwd`": `"`$`{workspaceFolder`}/components/$projectName/heads/Uno`"
55+
}";
56+
}
57+
3258
$launchConfigJson = Get-Content -Path "$PSScriptRoot/../.vscode/launch.json" -ErrorAction Stop;
3359
$launchConfig = $launchConfigJson | ConvertFrom-Json;
3460

@@ -46,8 +72,11 @@ foreach ($projectPath in Get-ChildItem -Directory -Depth 0 -Path "$PSScriptRoot/
4672

4773
$configJson = CreateVsCodeLaunchConfigJson $projectName;
4874
$config = $configJson | ConvertFrom-Json;
49-
5075
$launchConfig.configurations += $config;
76+
77+
$unoConfigJson = CreateUnoVsCodeLaunchConfigJson $projectName;
78+
$unoConfig = $unoConfigJson | ConvertFrom-Json;
79+
$launchConfig.configurations += $unoConfig;
5180
}
5281

5382
if ($allowGitChanges.IsPresent) {

MultiTarget/UseUnoWinUI.ps1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ function ApplyWinUISwap([string] $filePath) {
1111
$fileContents = $fileContents -replace '<WinUIMajorVersion>2</WinUIMajorVersion>', '<WinUIMajorVersion>3</WinUIMajorVersion>';
1212
$fileContents = $fileContents -replace '<PackageIdVariant>Uwp</PackageIdVariant>', '<PackageIdVariant>WinUI</PackageIdVariant>';
1313
$fileContents = $fileContents -replace '<DependencyVariant>Uwp</DependencyVariant>', '<DependencyVariant>WinUI</DependencyVariant>';
14-
$fileContents = $fileContents -replace 'Uno.UI', 'Uno.WinUI';
1514
}
1615

1716
if ($winUIMajorVersion -eq "2") {
1817
$fileContents = $fileContents -replace '<WinUIMajorVersion>3</WinUIMajorVersion>', '<WinUIMajorVersion>2</WinUIMajorVersion>';
1918
$fileContents = $fileContents -replace '<PackageIdVariant>WinUI</PackageIdVariant>', '<PackageIdVariant>Uwp</PackageIdVariant>';
2019
$fileContents = $fileContents -replace '<DependencyVariant>WinUI</DependencyVariant>', '<DependencyVariant>Uwp</DependencyVariant>';
21-
$fileContents = $fileContents -replace 'Uno.WinUI', 'Uno.UI';
2220
}
2321

2422
Set-Content -Force -Path $filePath -Value $fileContents;
@@ -27,7 +25,6 @@ function ApplyWinUISwap([string] $filePath) {
2725

2826
Write-Output "Switching Uno to WinUI $winUIMajorVersion";
2927

30-
ApplyWinUISwap $PSScriptRoot/../ProjectHeads/App.Head.Uno.props
3128
ApplyWinUISwap $PSScriptRoot/PackageReferences/Uno.props
3229
ApplyWinUISwap $PSScriptRoot/WinUI.TargetVersion.props
3330

global.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "9.0.310",
44
"rollForward": "latestFeature"
55
},
6-
"msbuild-sdks":
6+
"msbuild-sdks":
77
{
8-
"MSBuild.Sdk.Extras":"3.0.23"
8+
"MSBuild.Sdk.Extras":"3.0.23",
9+
"Uno.Sdk": "6.4.58"
910
}
1011
}

0 commit comments

Comments
 (0)