Skip to content

Commit 6b2f89e

Browse files
authored
Merge pull request #350 from michael-hawker/llama/winui-package-fix
Use slngen and remove UWP target from WinUI packages
2 parents db27aeb + 1aa2235 commit 6b2f89e

File tree

12 files changed

+192
-1300
lines changed

12 files changed

+192
-1300
lines changed

.config/dotnet-tools.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
"commands": [
1414
"xstyler"
1515
]
16+
},
17+
"microsoft.visualstudio.slngen.tool": {
18+
"version": "9.5.1",
19+
"commands": [
20+
"slngen"
21+
]
1622
}
1723
}
1824
}

.github/workflows/build.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ jobs:
5151
matrix:
5252
platform: [WinUI2, WinUI3]
5353

54+
env:
55+
# faux-ternary expression to select which platforms to build for each platform vs. duplicating step below.
56+
TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all' || 'all-uwp' }}
57+
TEST_PLATFORM: ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }}
58+
5459
# Steps represent a sequence of tasks that will be executed as part of the job
5560
steps:
5661
- name: Install .NET 6 SDK
@@ -72,12 +77,13 @@ jobs:
7277
- name: Add msbuild to PATH
7378
uses: microsoft/[email protected]
7479

75-
- name: Enable all TargetFrameworks
80+
- name: Enable ${{ env.TARGET_PLATFORMS }} TargetFrameworks
7681
working-directory: ./common/Scripts/
77-
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 all" -ErrorAction Stop
82+
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 ${{ env.TARGET_PLATFORMS }}" -ErrorAction Stop
7883

79-
- name: Generate solution
80-
run: powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop
84+
- name: Generate solution w/ ${{ env.TEST_PLATFORM }} Tests
85+
working-directory: ./
86+
run: powershell -version 5.1 -command "./common/GenerateAllSolution.ps1 -IncludeHeads ${{ env.TEST_PLATFORM }}" -ErrorAction Stop
8187

8288
- name: Enable Uno.WinUI (in WinUI3 matrix only)
8389
working-directory: ./common/Scripts/
@@ -94,11 +100,11 @@ jobs:
94100

95101
# Push Packages to our DevOps Artifacts Feed
96102
- name: Add source
97-
if: ${{github.ref == 'refs/heads/main'}}
103+
if: ${{ github.ref == 'refs/heads/main' }}
98104
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 }}
99105

100106
- name: Push packages
101-
if: ${{github.ref == 'refs/heads/main'}}
107+
if: ${{ github.ref == 'refs/heads/main' }}
102108
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate
103109

104110
# Run tests
@@ -114,18 +120,21 @@ jobs:
114120
id: test-generator
115121
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"
116122

117-
- name: Run experiment tests against UWP
118-
id: test-uwp
119-
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx"
120-
121-
- name: Run experiment tests against WinAppSDK
122-
id: test-winappsdk
123-
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx"
123+
- name: Run experiment tests against ${{ env.TEST_PLATFORM }}
124+
id: test-platform
125+
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.${{ env.TEST_PLATFORM }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PLATFORM }}.trx"
124126

125127
- name: Create test reports
126128
run: |
127129
testspace '[${{ matrix.platform }}]./TestResults/*.trx'
128-
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
130+
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-platform.conclusion == 'success') }}
131+
132+
#- name: Artifact - Slngen Logs
133+
# uses: actions/upload-artifact@v3
134+
# if: success() || failure()
135+
# with:
136+
# name: slngen-logs
137+
# path: ./**/slngen.*log
129138

130139
# Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
131140
new-experiment:
@@ -199,9 +208,14 @@ jobs:
199208
- name: Checkout Repository
200209
uses: actions/checkout@v3
201210

211+
# Restore Tools from Manifest list in the Repository
212+
- name: Restore dotnet tools
213+
run: dotnet tool restore
214+
202215
- name: Generate solution
203216
shell: pwsh
204-
run: ./GenerateAllSolution.ps1
217+
working-directory: ./
218+
run: ./common/GenerateAllSolution.ps1
205219

206220
- name: Install ninja for WASM native dependencies
207221
run: sudo apt-get install ninja-build
@@ -213,3 +227,10 @@ jobs:
213227
run: dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false
214228

215229
# TODO: Do we want to run tests here? Can we do that on linux easily?
230+
231+
#- name: Artifact - Slngen Logs
232+
# uses: actions/upload-artifact@v3
233+
# if: success() || failure()
234+
# with:
235+
# name: slngen-logs
236+
# path: ./**/slngen.*log

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"label": "generateAllSolution",
88
"type": "shell",
9-
"command": "pwsh ./GenerateAllSolution.ps1",
9+
"command": "pwsh ./common/GenerateAllSolution.ps1",
1010
"group": "build"
1111
}
1212
]

Directory.Build.targets

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,11 @@
1818
<None Include="$(RepositoryDirectory)ThirdPartyNotices.txt" Pack="true" PackagePath="\" />
1919
</ItemGroup>-->
2020

21+
<ItemGroup>
22+
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory).editorconfig" />
23+
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)settings.xamlstyler" />
24+
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)*.md" />
25+
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)common\GlobalUsings*.cs" />
26+
</ItemGroup>
27+
2128
</Project>

GenerateAllSolution.bat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@ECHO OFF
2+
SET "IncludeHeads=%1"
3+
IF "%IncludeHeads%"=="" SET "IncludeHeads=all"
4+
5+
powershell .\common\GenerateAllSolution.ps1 -IncludeHeads %IncludeHeads%

GenerateAllSolution.ps1

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

0 commit comments

Comments
 (0)