Skip to content

Commit 730ba7f

Browse files
committed
Merge branch 'refactor/component-folder-structure' into marquee
2 parents 487c05c + e87ec5c commit 730ba7f

File tree

729 files changed

+2689
-11829
lines changed

Some content is hidden

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

729 files changed

+2689
-11829
lines changed

.config/dotnet-tools.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"uno.check": {
6-
"version": "1.3.1",
6+
"version": "1.10.0",
77
"commands": [
88
"uno-check"
99
]
@@ -13,6 +13,12 @@
1313
"commands": [
1414
"xstyler"
1515
]
16+
},
17+
"microsoft.visualstudio.slngen.tool": {
18+
"version": "9.5.4",
19+
"commands": [
20+
"slngen"
21+
]
1622
}
1723
}
18-
}
24+
}

.github/workflows/build.yml

Lines changed: 112 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
# Allows you to run this workflow manually from the Actions tab
1616
workflow_dispatch:
1717

18+
env:
19+
DOTNET_VERSION: ${{ '6.0.x' }}
20+
ENABLE_DIAGNOSTICS: false
21+
#COREHOST_TRACE: 1
22+
COREHOST_TRACEFILE: corehosttrace.log
1823

1924
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2025
jobs:
@@ -24,14 +29,14 @@ jobs:
2429

2530
# Steps represent a sequence of tasks that will be executed as part of the job
2631
steps:
27-
- name: Install .NET 6 SDK
28-
uses: actions/setup-dotnet@v1
32+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
33+
uses: actions/setup-dotnet@v3
2934
with:
30-
dotnet-version: '6.0.x'
35+
dotnet-version: ${{ env.DOTNET_VERSION }}
3136

3237
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3338
- name: Checkout Repository
34-
uses: actions/checkout@v2
39+
uses: actions/checkout@v3
3540

3641
# Restore Tools from Manifest list in the Repository
3742
- name: Restore dotnet tools
@@ -51,16 +56,25 @@ jobs:
5156
matrix:
5257
platform: [WinUI2, WinUI3]
5358

59+
env:
60+
# faux-ternary expression to select which platforms to build for each platform vs. duplicating step below.
61+
TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all' || 'all-uwp' }}
62+
TEST_PLATFORM: ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }}
63+
5464
# Steps represent a sequence of tasks that will be executed as part of the job
5565
steps:
56-
- name: Install .NET 6 SDK
57-
uses: actions/setup-dotnet@v1
66+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
67+
uses: actions/setup-dotnet@v3
5868
with:
59-
dotnet-version: '6.0.202'
69+
dotnet-version: ${{ env.DOTNET_VERSION }}
70+
71+
- name: .NET Info (if diagnostics)
72+
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
73+
run: dotnet --info
6074

6175
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
6276
- name: Checkout Repository
63-
uses: actions/checkout@v2
77+
uses: actions/checkout@v3
6478

6579
# Restore Tools from Manifest list in the Repository
6680
- name: Restore dotnet tools
@@ -70,17 +84,18 @@ jobs:
7084
run: dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --verbose
7185

7286
- name: Add msbuild to PATH
73-
uses: microsoft/setup-msbuild@v1.0.3
87+
uses: microsoft/setup-msbuild@v1.3.1
7488

75-
- name: Enable all TargetFrameworks
76-
working-directory: ./common/Scripts/
77-
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 all" -ErrorAction Stop
89+
- name: Enable ${{ env.TARGET_PLATFORMS }} TargetFrameworks
90+
working-directory: ./common/MultiTarget/
91+
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 ${{ env.TARGET_PLATFORMS }}" -ErrorAction Stop
7892

79-
- name: Generate solution
80-
run: powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop
93+
- name: Generate solution w/ ${{ env.TEST_PLATFORM }} Tests
94+
working-directory: ./
95+
run: powershell -version 5.1 -command "./common/GenerateAllSolution.ps1 -IncludeHeads ${{ env.TEST_PLATFORM }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" -ErrorAction Stop
8196

8297
- name: Enable Uno.WinUI (in WinUI3 matrix only)
83-
working-directory: ./common/Scripts/
98+
working-directory: ./common/MultiTarget/
8499
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
85100
if: ${{ matrix.platform == 'WinUI3' }}
86101

@@ -94,11 +109,11 @@ jobs:
94109

95110
# Push Packages to our DevOps Artifacts Feed
96111
- name: Add source
97-
if: ${{github.ref == 'refs/heads/main'}}
112+
if: ${{ github.ref == 'refs/heads/main' }}
98113
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 }}
99114

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

104119
# Run tests
@@ -112,56 +127,82 @@ jobs:
112127

113128
- name: Run SourceGenerators tests
114129
id: test-generator
115-
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"
130+
run: vstest.console.exe ./common/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net6.0/CommunityToolkit.Tooling.SampleGen.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"
116131

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"
132+
- name: Run experiment tests against ${{ env.TEST_PLATFORM }}
133+
id: test-platform
134+
run: vstest.console.exe ./common/**/CommunityToolkit.Tests.${{ env.TEST_PLATFORM }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PLATFORM }}.trx"
124135

125136
- name: Create test reports
126137
run: |
127138
testspace '[${{ matrix.platform }}]./TestResults/*.trx'
128-
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
139+
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-platform.conclusion == 'success') }}
140+
141+
- name: Artifact - Diagnostic Logs
142+
uses: actions/upload-artifact@v3
143+
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
144+
with:
145+
name: build-logs
146+
path: ./**/*.*log
129147

130148
# Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
131149
new-experiment:
132-
needs: [Xaml-Style-Check]
150+
# TODO: We should only run this if something in the common or template folder changed...
133151
runs-on: windows-latest
152+
env:
153+
PROJECT_DIRECTORY: template/ProjectTemplate
154+
TEST_PROJECT_NAME: CiTestExp
155+
TEST_PROJECT_DIRECTORY: components/CiTestExp
134156

135157
steps:
136-
- name: Install .NET 6 SDK
137-
uses: actions/setup-dotnet@v1
158+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
159+
uses: actions/setup-dotnet@v3
138160
with:
139-
dotnet-version: '6.0.202'
161+
dotnet-version: ${{ env.DOTNET_VERSION }}
162+
163+
- name: .NET Info (if diagnostics)
164+
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
165+
run: dotnet --info
166+
167+
- name: Enable git long paths
168+
run: git config --system core.longpaths true
140169

141170
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
142171
- name: Checkout Repository
143-
uses: actions/checkout@v2
172+
uses: actions/checkout@v3
144173

145174
- name: Add msbuild to PATH
146-
uses: microsoft/[email protected]
175+
uses: microsoft/[email protected]
176+
177+
- name: Add project heads to ProjectTemplate
178+
working-directory: ./${{ env.PROJECT_DIRECTORY }}
179+
run: ${{ github.workspace }}/common/ProjectHeads/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
147180

148181
# Build and use template for creating new experiments
149182
- name: Build ProjectTemplate
150-
working-directory: ./template/lab
183+
working-directory: ./${{ env.PROJECT_DIRECTORY }}
151184
run: msbuild.exe ProjectTemplate.sln /restore /nowarn:MSB4011 -p:Configuration=Debug
152185

186+
- name: Clean environment
187+
working-directory: ./
188+
run: git clean -xdf
189+
153190
# Create a new experiment from the template and test using that
154191
- name: Install template
155-
working-directory: ./template/lab
192+
working-directory: ${{ env.PROJECT_DIRECTORY }}
156193
run: dotnet new --install ./
157194

158195
- name: Create new experiment
159-
working-directory: ./labs
160-
run: dotnet new labexp -n CiTestExp
196+
working-directory: ./components
197+
run: dotnet new labexp -n ${{ env.TEST_PROJECT_NAME }}
198+
199+
- name: Add project heads to ${{ env.TEST_PROJECT_NAME }}
200+
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
201+
run: ${{ github.workspace }}/common/ProjectHeads/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
161202

162203
- name: MSBuild
163-
working-directory: ./labs/CiTestExp
164-
run: msbuild.exe CiTestExp.sln /restore /nowarn:MSB4011 -p:Configuration=Release
204+
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
205+
run: msbuild.exe ${{ env.TEST_PROJECT_NAME }}.sln /restore /nowarn:MSB4011 -p:Configuration=Release
165206

166207
# Run tests
167208
- name: Setup VSTest Path
@@ -174,42 +215,64 @@ jobs:
174215

175216
- name: Run tests in the generated experiment against UWP
176217
id: test-uwp
177-
run: vstest.console.exe ./labs/CiTestExp/**/CiTestExp.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpUWP.trx"
218+
run: vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }}/**/${{ env.TEST_PROJECT_NAME }}.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}UWP.trx"
178219

179220
- name: Run tests in the generated experiment against WinAppSDK
180221
id: test-winappsdk
181-
run: vstest.console.exe ./labs/CiTestExp/**/CiTestExp.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpWinAppSdk.trx"
222+
run: vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }}/**/${{ env.TEST_PROJECT_NAME }}.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}WinAppSdk.trx"
182223

183224
- name: Create test reports
184225
run: |
185226
testspace '[New Experiment]./TestResults/*.trx'
186227
if: ${{ always() && (steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
187228

229+
- name: Artifact - Diagnostic Logs
230+
uses: actions/upload-artifact@v3
231+
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
232+
with:
233+
name: new-experiment-logs
234+
path: ./**/*.*log
235+
188236
wasm-linux:
189-
needs: [Xaml-Style-Check]
190237
runs-on: ubuntu-latest
191238

192239
steps:
193-
- name: Install .NET 6 SDK
194-
uses: actions/setup-dotnet@v1
240+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
241+
uses: actions/setup-dotnet@v3
195242
with:
196-
dotnet-version: '6.0.201'
243+
dotnet-version: ${{ env.DOTNET_VERSION }}
244+
245+
- name: .NET Info (if diagnostics)
246+
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
247+
run: dotnet --info
197248

198249
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
199250
- name: Checkout Repository
200-
uses: actions/checkout@v2
251+
uses: actions/checkout@v3
252+
253+
# Restore Tools from Manifest list in the Repository
254+
- name: Restore dotnet tools
255+
run: dotnet tool restore
201256

202257
- name: Generate solution
203258
shell: pwsh
204-
run: ./GenerateAllSolution.ps1
259+
working-directory: ./
260+
run: ./common/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
205261

206262
- name: Install ninja for WASM native dependencies
207263
run: sudo apt-get install ninja-build
208264

209265
# Issue with Comment Links currently, see: https://github.com/mrlacey/CommentLinks/issues/38
210-
# See launch.json configuration file for analogous command we're emulating here to build LINK: ../../.vscode/launch.json:CommunityToolkit.Labs.Wasm.csproj
266+
# See launch.json configuration file for analogous command we're emulating here to build LINK: ../../.vscode/launch.json:CommunityToolkit.App.Wasm.csproj
211267
- name: dotnet build
212-
working-directory: ./platforms/CommunityToolkit.Labs.Wasm/
213-
run: dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false -p:TargetFrameworks=netstandard2.0 -p:TargetFramework=net5.0
268+
working-directory: ./common/ProjectHeads/AllComponents/Wasm/
269+
run: dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false
214270

215271
# TODO: Do we want to run tests here? Can we do that on linux easily?
272+
273+
- name: Artifact - Diagnostic Logs
274+
uses: actions/upload-artifact@v3
275+
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
276+
with:
277+
name: linux-logs
278+
path: ./**/*.*log

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,7 @@ MigrationBackup/
358358
# Community Toolkit Labs generated files
359359
Toolkit.Labs.All.sln
360360
common/MultiTarget/Generated/**
361+
heads/
362+
363+
# We use slngen to generate solutions
364+
*.sln

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
"/p:UnoSourceGeneratorUseGenerationHost=true",
1515
"/p:UnoSourceGeneratorUseGenerationController=false",
1616
"/p:UnoRemoteControlPort=443",
17-
"--project=${workspaceFolder}/platforms/CommunityToolkit.Labs.Wasm/CommunityToolkit.Labs.Wasm.csproj"
17+
"--project=${workspaceFolder}/common/ProjectHeads/AllComponents/CommunityToolkit.Labs.Wasm/CommunityToolkit.Labs.Wasm.csproj"
1818
],
1919
"presentation": {
2020
"group": "1",
2121
"order": 1
2222
},
23-
"cwd": "${workspaceFolder}/platforms/CommunityToolkit.Labs.Wasm",
23+
"cwd": "${workspaceFolder}/common/ProjectHeads/AllComponents/CommunityToolkit.Labs.Wasm",
2424
"preLaunchTask": "generateAllSolution"
2525
},
2626
{

.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%

0 commit comments

Comments
 (0)