Skip to content

Commit 10640a3

Browse files
Consolidated ProjectHeads and supporting infrastructure (#360)
* Moved project heads to common folder * Fixed broken reference to props file * Fix broken path references * Fixed broken file references * Fixed broken path * Move asset references to props file * Consolidated ProjectHeads and supporting infrastructure * Migrating projects to new infra * Migrating files to new infra * Added missing assemblyname and rootnamespace declaration * Fixed building WinAppSdk * Fixed build errors for UWP under "All" solution * Fixed working directory for UseTargetFrameworks.ps1 * Switch GenerateSingleSampleHeads.ps1 to use dotnet templating tool Update WindowsAppSDK version and MSTest tools Add properties to allow tests to run on 1.2.x, see microsoft/testfx#1127 Remove solution files from experiments Add bat file to copy heads and run slngen Tested locally running all heads and tests for an experiment * Update folder for linux CI build and Codespaces to WASM project * Clean-up and re-work build script for testing the project template * Use expanded form for environment variables everywhere * Use repo root path for script when in working directory of template * Use github syntax for environment variable for path, see actions/runner-images#1794 * Re-work path structure for project template test in ci * Setup paths again to use full path into GenerateSingleSampleHeads script * Fixed comment referencing outdated file name * Use absolute path for project references in the "All" solution * Removed leading directory separator on generated path * Update slngen to fix build issues with not finding SDK due to global.json See details in microsoft/slngen#453 * Add flag to build to enable easily getting diagnostics from tools * Clean-up labels and conditions for diagnostics * Add COREHOST_TRACE diagnostics for dotnet * Move conditional for COREHOST_TRACE into step * Just have COREHOST_TRACE defined at top * Add calling dotnet --info * Fixed missing markdown/cs files. Changed "Experiment" to "ToolkitComponent" * Revert initial work renaming Experiment to Component. * Fixed markdown exclude path * Moved project out of double nested folder * Removed restored files that should have been deleted * Move SourceGenerators.Tests project up a folder and fix in build.yml path Wasn't being built as was excluded from wildcard in solution generator * Fixed path for test output * Improved and shortened project names * Rename LabsUITestMethod to UIThreadTestMethod * Renamed to CommunityToolkit.Tooling.TestGen * New names for UITestMethodAttribute and UITestMethodGenerator * Fixed incorrect namespace * Fixed a bad find/replace * Renamed "all" component heads and App/Test shared projects * Added "App" to app head names * Fixed runtime error * Move SourceGenerators.Tests project up a folder and fix in build.yml path Wasn't being built as was excluded from wildcard in solution generator * Fixed path for test output * Improved and shortened project names * Rename LabsUITestMethod to UIThreadTestMethod * Renamed to CommunityToolkit.Tooling.TestGen * New names for UITestMethodAttribute and UITestMethodGenerator * Renamed "all" component heads and App/Test shared projects * Added "App" to app head names * Turn off diagnostics for our powershell scripts as slngen has error with diagnostics Fix diagnostic flag detection * Enable git long path support for the clean operation * Update microsoft/setup-msbuild github action * Cleaned up moved files that weren't deleted properly * Update slngen to 9.5.4 Should hopefully resolve CI issues from microsoft/slngen#453 and its initial fix --------- Co-authored-by: michael-hawker <[email protected]>
1 parent 1a40ef4 commit 10640a3

File tree

576 files changed

+1201
-9757
lines changed

Some content is hidden

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

576 files changed

+1201
-9757
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
]
1616
},
1717
"microsoft.visualstudio.slngen.tool": {
18-
"version": "9.5.1",
18+
"version": "9.5.4",
1919
"commands": [
2020
"slngen"
2121
]

.github/workflows/build.yml

Lines changed: 81 additions & 39 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,10 +29,10 @@ 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
32+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
2833
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
@@ -58,10 +63,14 @@ jobs:
5863

5964
# Steps represent a sequence of tasks that will be executed as part of the job
6065
steps:
61-
- name: Install .NET 6 SDK
66+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
6267
uses: actions/setup-dotnet@v3
6368
with:
64-
dotnet-version: '6.0.x'
69+
dotnet-version: ${{ env.DOTNET_VERSION }}
70+
71+
- name: .NET Info (if diagnostics)
72+
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
73+
run: dotnet --info
6574

6675
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
6776
- name: Checkout Repository
@@ -75,18 +84,18 @@ jobs:
7584
run: dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --verbose
7685

7786
- name: Add msbuild to PATH
78-
uses: microsoft/setup-msbuild@v1.0.3
87+
uses: microsoft/setup-msbuild@v1.3.1
7988

8089
- name: Enable ${{ env.TARGET_PLATFORMS }} TargetFrameworks
81-
working-directory: ./common/Scripts/
90+
working-directory: ./common/MultiTarget/
8291
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 ${{ env.TARGET_PLATFORMS }}" -ErrorAction Stop
8392

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

8897
- name: Enable Uno.WinUI (in WinUI3 matrix only)
89-
working-directory: ./common/Scripts/
98+
working-directory: ./common/MultiTarget/
9099
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
91100
if: ${{ matrix.platform == 'WinUI3' }}
92101

@@ -118,59 +127,82 @@ jobs:
118127

119128
- name: Run SourceGenerators tests
120129
id: test-generator
121-
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"
122131

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

127136
- name: Create test reports
128137
run: |
129138
testspace '[${{ matrix.platform }}]./TestResults/*.trx'
130139
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-platform.conclusion == 'success') }}
131140

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
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
138147

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

144157
steps:
145-
- name: Install .NET 6 SDK
158+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
146159
uses: actions/setup-dotnet@v3
147160
with:
148-
dotnet-version: '6.0.x'
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
149169

150170
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
151171
- name: Checkout Repository
152172
uses: actions/checkout@v3
153173

154174
- name: Add msbuild to PATH
155-
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' || '' }}
156180

157181
# Build and use template for creating new experiments
158182
- name: Build ProjectTemplate
159-
working-directory: ./template/lab
183+
working-directory: ./${{ env.PROJECT_DIRECTORY }}
160184
run: msbuild.exe ProjectTemplate.sln /restore /nowarn:MSB4011 -p:Configuration=Debug
161185

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

167195
- name: Create new experiment
168196
working-directory: ./labs
169-
run: dotnet new labexp -n CiTestExp
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' || '' }}
170202

171203
- name: MSBuild
172-
working-directory: ./labs/CiTestExp
173-
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
174206

175207
# Run tests
176208
- name: Setup VSTest Path
@@ -183,26 +215,36 @@ jobs:
183215

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

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

192224
- name: Create test reports
193225
run: |
194226
testspace '[New Experiment]./TestResults/*.trx'
195227
if: ${{ always() && (steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
196228

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+
197236
wasm-linux:
198-
needs: [Xaml-Style-Check]
199237
runs-on: ubuntu-latest
200238

201239
steps:
202-
- name: Install .NET 6 SDK
240+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
203241
uses: actions/setup-dotnet@v3
204242
with:
205-
dotnet-version: '6.0.x'
243+
dotnet-version: ${{ env.DOTNET_VERSION }}
244+
245+
- name: .NET Info (if diagnostics)
246+
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
247+
run: dotnet --info
206248

207249
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
208250
- name: Checkout Repository
@@ -215,22 +257,22 @@ jobs:
215257
- name: Generate solution
216258
shell: pwsh
217259
working-directory: ./
218-
run: ./common/GenerateAllSolution.ps1
260+
run: ./common/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
219261

220262
- name: Install ninja for WASM native dependencies
221263
run: sudo apt-get install ninja-build
222264

223265
# Issue with Comment Links currently, see: https://github.com/mrlacey/CommentLinks/issues/38
224-
# 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
225267
- name: dotnet build
226-
working-directory: ./platforms/CommunityToolkit.Labs.Wasm/
268+
working-directory: ./common/ProjectHeads/AllComponents/Wasm/
227269
run: dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false
228270

229271
# TODO: Do we want to run tests here? Can we do that on linux easily?
230272

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
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
{

ReadMe.md

Lines changed: 2 additions & 2 deletions

common/CommunityToolkit.Labs.Shared/App.xaml renamed to common/CommunityToolkit.App.Shared/App.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
2-
<Application x:Class="CommunityToolkit.Labs.Shared.App"
2+
<Application x:Class="CommunityToolkit.App.Shared.App"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
55
<Application.Resources>

common/CommunityToolkit.Labs.Shared/App.xaml.cs renamed to common/CommunityToolkit.App.Shared/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
namespace CommunityToolkit.Labs.Shared;
5+
namespace CommunityToolkit.App.Shared;
66

77
/// <summary>
88
/// Provides application-specific behavior to supplement the default Application class.

common/CommunityToolkit.Labs.Shared/AppLoadingView.xaml renamed to common/CommunityToolkit.App.Shared/AppLoadingView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
2-
<Page x:Class="CommunityToolkit.Labs.Shared.AppLoadingView"
2+
<Page x:Class="CommunityToolkit.App.Shared.AppLoadingView"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:local="using:CommunityToolkit.Labs.Shared"
6+
xmlns:local="using:CommunityToolkit.App.Shared"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
99
mc:Ignorable="d">

common/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs renamed to common/CommunityToolkit.App.Shared/AppLoadingView.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using CommunityToolkit.Labs.Core.SourceGenerators.Metadata;
6-
using CommunityToolkit.Labs.Core.SourceGenerators;
5+
using CommunityToolkit.Tooling.SampleGen.Metadata;
6+
using CommunityToolkit.Tooling.SampleGen;
77
using System.Runtime.InteropServices.WindowsRuntime;
88
using Windows.Foundation.Collections;
9-
using CommunityToolkit.Labs.Shared.Pages;
9+
using CommunityToolkit.App.Shared.Pages;
1010

1111
#if !WINAPPSDK
1212
using Windows.System;
@@ -24,7 +24,7 @@
2424
using Microsoft.UI.Xaml.Navigation;
2525
#endif
2626

27-
namespace CommunityToolkit.Labs.Shared;
27+
namespace CommunityToolkit.App.Shared;
2828

2929
/// <summary>
3030
/// Kicks off the loading process and determines whether to display a single-sample or multi-sample view.

0 commit comments

Comments
 (0)