Skip to content

Commit bd2d553

Browse files
authored
Merge branch 'main' into user/juosori/Markdown_Tables_Style
2 parents e793148 + 519358d commit bd2d553

File tree

273 files changed

+36979
-12484
lines changed

Some content is hidden

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

273 files changed

+36979
-12484
lines changed

.config/dotnet-tools.json

Lines changed: 2 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.20.2",
6+
"version": "1.27.4",
77
"commands": [
88
"uno-check"
99
]
@@ -15,7 +15,7 @@
1515
]
1616
},
1717
"microsoft.visualstudio.slngen.tool": {
18-
"version": "11.2.6",
18+
"version": "12.0.13",
1919
"commands": [
2020
"slngen"
2121
]

.devcontainer/Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.208.0/containers/dotnet/.devcontainer/base.Dockerfile
2-
3-
# [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.0-focal, 3.1-focal, etc
4-
ARG VARIANT="8.0-bullseye-slim"
5-
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}
1+
# See https://github.com/devcontainers/images/tree/main/src/dotnet for image choices
2+
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:9.0
63

74
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
85
ARG NODE_VERSION="none"

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"args": {
88
// Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0
99
// Append -bullseye or -focal to pin to an OS version.
10-
"VARIANT": "6.0",
10+
"VARIANT": "9.0",
1111
// Options
1212
"NODE_VERSION": "lts/*"
1313
}

.github/workflows/build.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ on:
1717
merge_group:
1818

1919
env:
20-
DOTNET_VERSION: ${{ '8.0.201' }}
21-
DOTNET_INSTALL_DIR: dotnet-install
22-
DOTNET_ROOT: dotnet-install
23-
ENABLE_DIAGNOSTICS: false
20+
DOTNET_VERSION: ${{ '9.0.x' }}
21+
ENABLE_DIAGNOSTICS: true
2422
#COREHOST_TRACE: 1
2523
MSBUILD_VERBOSITY: normal
2624
COREHOST_TRACEFILE: corehosttrace.log
@@ -31,7 +29,7 @@ env:
3129
jobs:
3230
# This workflow contains a single job called "Xaml-Style-Check"
3331
Xaml-Style-Check:
34-
runs-on: windows-latest-large
32+
runs-on: windows-latest
3533

3634
# Steps represent a sequence of tasks that will be executed as part of the job
3735
steps:
@@ -215,7 +213,7 @@ jobs:
215213
strategy:
216214
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.
217215
matrix:
218-
winui: [2, 3]
216+
winui: [0, 2, 3]
219217

220218
env:
221219
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
@@ -258,20 +256,10 @@ jobs:
258256
uses: microsoft/setup-msbuild@v2
259257
with:
260258
vs-version: '[17.9,)'
261-
262-
- name: Define excluded MultiTargets (WinUI 2)
263-
if: ${{ matrix.winui == '2' }}
264-
run: |
265-
echo "EXCLUDED_MULTITARGETS=wasdk" >> $env:GITHUB_ENV
266-
267-
- name: Define excluded MultiTargets (WinUI 3)
268-
if: ${{ matrix.winui == '3' }}
269-
run: |
270-
echo "EXCLUDED_MULTITARGETS=uwp" >> $env:GITHUB_ENV
271259

272260
# Build and pack component nupkg
273261
- name: Build and pack component packages
274-
run: ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -ExcludeMultiTargets ${{ env.EXCLUDED_MULTITARGETS }} -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release
262+
run: ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release
275263

276264
- name: Validate package names
277265
if: ${{ env.VERSION_PROPERTY != '' }}
@@ -356,4 +344,4 @@ jobs:
356344
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
357345
with:
358346
name: linux-logs
359-
path: ./**/*.*log
347+
path: ./**/*.*log

Directory.Build.props

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
<NoWarn>$(NoWarn);Uno0001</NoWarn>
1616

1717
<!-- See https://github.com/CommunityToolkit/Labs-Windows/pull/605#issuecomment-2498743676 -->
18-
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
18+
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904;</WarningsNotAsErrors>
19+
20+
<!-- Labs only: No error for 'Missing XML comment for publicly visible type or member' -->
21+
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS1591;CS1574;</WarningsNotAsErrors>
22+
23+
<!-- See https://github.com/CommunityToolkit/Windows/pull/609#issuecomment-2613505591 -->
24+
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS0419;CS1570;</WarningsNotAsErrors>
1925
</PropertyGroup>
2026

2127
<Import Project="Windows.Toolkit.Common.props" />

Directory.Build.targets

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<Project>
2+
<ItemGroup>
3+
<!-- Workaround for WebView2 on uap pulling in Microsoft.VCLibs.Desktop when it shouldn't -->
4+
<SDKReference Remove="Microsoft.VCLibs.Desktop, Version=14.0" />
5+
</ItemGroup>
26

37
<ItemGroup Condition="'$(Configuration)' == 'Release'">
4-
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.7.0" PrivateAssets="all" Pack="false" />
8+
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.12.1" PrivateAssets="all" Pack="false" />
59
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
610
</ItemGroup>
711

ReadMe.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ If you find an experiment useful, please up-vote 👍 its corresponding issue an
2121

2222
Otherwise, you can clone the repo, open the `components` directory, navigate within the folder for a particular experiment and open up it's solution file in Visual Studio. Run one of the project heads (_ExperimentName.Uwp/Wasm/WinAppSDK_) to see its samples.
2323

24+
**List of current experiments**
25+
- [AppServices](https://github.com/CommunityToolkit/Labs-Windows/tree/main/components/AppServices)
26+
- [CanvasLayout](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/CanvasLayout/samples/CanvasLayout.md)
27+
- [CanvasView](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/CanvasView/samples/CanvasView.md)
28+
- [DataTable](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/DataTable/samples/DataTable.md)
29+
- [Extensions.DependencyInjection](https://github.com/CommunityToolkit/Labs-Windows/tree/main/components/Extensions.DependencyInjection)
30+
- [MarkdownTextBlock](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/MarkdownTextBlock/samples/MarkdownTextBlock.md)
31+
- [MarqueeText](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/MarqueeText/samples/MarqueeText.md)
32+
- [Notifications](https://github.com/CommunityToolkit/Labs-Windows/tree/main/components/Notifications)
33+
- [Ribbon](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/Ribbon/samples/Ribbon.md)
34+
- [RivePlayer](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/RivePlayer/samples/RivePlayer.md)
35+
- [Shimmer](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/Shimmer/samples/Shimmer.md)
36+
- [TitleBar](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/TitleBar/samples/TitleBar.md)
37+
- [TokenView](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/TokenView/samples/TokenView.md)
38+
- [TransitionHelper](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/TransitionHelper/samples/TransitionHelper.md)
39+
2440
## Clone the repository
2541

2642
The [tooling](https://github.com/CommunityToolkit/Tooling-Windows-Submodule) is in a submodule, so you'll need to use `--recurse-submodules` when cloning or pulling for the first time:

Windows.Toolkit.Common.props

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,4 @@
2929
<IsPublishable>true</IsPublishable>
3030
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
3131
</PropertyGroup>
32-
33-
<ItemGroup>
34-
<Compile Include="$(RepositoryDirectory)tooling\GlobalUsings.cs" />
35-
</ItemGroup>
3632
</Project>

components/AppServices/CommunityToolkit.AppServices.SourceGenerators/AppServiceGenerator.Helpers.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
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

55
using Microsoft.CodeAnalysis;
6+
using Microsoft.CodeAnalysis.Diagnostics;
67

78
namespace CommunityToolkit.AppServices.SourceGenerators;
89

@@ -18,10 +19,27 @@ private static class Helpers
1819
/// Gets whether the current target is a UWP application.
1920
/// </summary>
2021
/// <param name="compilation">The input <see cref="Compilation"/> instance to inspect.</param>
22+
/// <param name="analyzerOptions">The analyzer options to use to get info on the target application.</param>
2123
/// <returns>Whether the current target is a UWP application.</returns>
22-
public static bool IsUwpTarget(Compilation compilation)
24+
public static bool IsUwpTarget(Compilation compilation, AnalyzerConfigOptions analyzerOptions)
2325
{
24-
return compilation.Options.OutputKind == OutputKind.WindowsRuntimeApplication;
26+
// If the application type is a Windows Runtime application, then it's for sure a UWP app
27+
if (compilation.Options.OutputKind == OutputKind.WindowsRuntimeApplication)
28+
{
29+
return true;
30+
}
31+
32+
// Otherwise, the application is UWP if "UseUwpTools" is set
33+
if (analyzerOptions.TryGetValue("build_property.UseUwpTools", out string? propertyValue))
34+
{
35+
if (bool.TryParse(propertyValue, out bool useUwpTools))
36+
{
37+
return useUwpTools;
38+
}
39+
}
40+
41+
// The app is definitely not a UWP app
42+
return false;
2543
}
2644
}
2745
}

components/AppServices/CommunityToolkit.AppServices.SourceGenerators/AppServiceGenerator.cs

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
2424
{
2525
// Get all app service class implementations, and only enable this branch if the target is not a UWP app (the component)
2626
IncrementalValuesProvider<(HierarchyInfo Hierarchy, AppServiceInfo Info)> appServiceComponentInfo =
27-
context.SyntaxProvider
28-
.CreateSyntaxProvider(
27+
context.CreateSyntaxProviderWithOptions(
2928
static (node, _) => node is ClassDeclarationSyntax classDeclaration && classDeclaration.HasOrPotentiallyHasBaseTypes(),
3029
static (context, token) =>
3130
{
3231
// Only retrieve host info if the target is not a UWP application
33-
if (Helpers.IsUwpTarget(context.SemanticModel.Compilation))
32+
if (Helpers.IsUwpTarget(context.SemanticModel.Compilation, context.GlobalOptions))
3433
{
3534
return default;
3635
}
@@ -79,15 +78,14 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
7978
});
8079

8180
// Gather all interfaces, and only enable this branch if the target is a UWP app (the host)
82-
IncrementalValuesProvider<(HierarchyInfo Hierarchy, AppServiceInfo Info)> appServiceHostInfo =
83-
context.SyntaxProvider
84-
.ForAttributeWithMetadataName(
81+
IncrementalValuesProvider<(HierarchyInfo, AppServiceInfo)> appServiceHostInfo =
82+
context.ForAttributeWithMetadataNameAndOptions(
8583
"CommunityToolkit.AppServices.AppServiceAttribute",
8684
static (node, _) => node is InterfaceDeclarationSyntax,
8785
static (context, token) =>
8886
{
8987
// Only retrieve host info if the target is a UWP application
90-
if (!Helpers.IsUwpTarget(context.SemanticModel.Compilation))
88+
if (!Helpers.IsUwpTarget(context.SemanticModel.Compilation, context.GlobalOptions))
9189
{
9290
return default;
9391
}
@@ -107,6 +105,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
107105

108106
token.ThrowIfCancellationRequested();
109107

108+
// Gather all methods for the app service type
110109
ImmutableArray<MethodInfo> methods = MethodInfo.From(typeSymbol, token);
111110

112111
token.ThrowIfCancellationRequested();
@@ -115,8 +114,47 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
115114
})
116115
.Where(static item => item.Hierarchy is not null);
117116

118-
// Produce the host type
119-
context.RegisterSourceOutput(appServiceHostInfo, static (context, item) =>
117+
// Also gather all explicitly requested host implementation types
118+
IncrementalValuesProvider<(HierarchyInfo, AppServiceInfo)> additionalAppServiceHostInfo =
119+
context.ForAttributeWithMetadataNameAndOptions(
120+
"CommunityToolkit.AppServices.GeneratedAppServiceHostAttribute",
121+
static (node, _) => true,
122+
static (context, token) =>
123+
{
124+
// Only retrieve host info if the target is a UWP application
125+
if (!Helpers.IsUwpTarget(context.SemanticModel.Compilation, context.GlobalOptions))
126+
{
127+
return default;
128+
}
129+
130+
// Get the target interface
131+
if (context.Attributes[0].ConstructorArguments is not [{ Kind: TypedConstantKind.Type, Value: INamedTypeSymbol appServiceType }])
132+
{
133+
return default;
134+
}
135+
136+
// Check if the current interface is in fact an app service type
137+
if (!appServiceType.TryGetAppServicesNameFromAttribute(out string? appServiceName))
138+
{
139+
return default;
140+
}
141+
142+
token.ThrowIfCancellationRequested();
143+
144+
HierarchyInfo hierarchy = HierarchyInfo.From(appServiceType, appServiceType.Name.Substring(1));
145+
146+
token.ThrowIfCancellationRequested();
147+
148+
ImmutableArray<MethodInfo> methods = MethodInfo.From(appServiceType, token);
149+
150+
token.ThrowIfCancellationRequested();
151+
152+
return (Hierarchy: hierarchy, new AppServiceInfo(methods, appServiceName, appServiceType.GetFullyQualifiedName()));
153+
})
154+
.Where(static item => item.Hierarchy is not null);
155+
156+
// Shared helper to emit all discovered types
157+
static void GenerateAppServiceHostType(SourceProductionContext context, (HierarchyInfo Hierarchy, AppServiceInfo Info) item)
120158
{
121159
ConstructorDeclarationSyntax constructorSyntax = Host.GetConstructorSyntax(item.Hierarchy, item.Info);
122160
ImmutableArray<MethodDeclarationSyntax> methodDeclarations = Host.GetMethodDeclarationsSyntax(item.Info);
@@ -128,6 +166,10 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
128166
$"/// <summary>A generated host implementation for the <see cref=\"{item.Info.InterfaceFullyQualifiedName}\"/> interface.</summary>");
129167

130168
context.AddSource($"{item.Hierarchy.FilenameHint}.g.cs", compilationUnit.GetText(Encoding.UTF8));
131-
});
169+
}
170+
171+
// Produce the host types
172+
context.RegisterSourceOutput(appServiceHostInfo, GenerateAppServiceHostType);
173+
context.RegisterSourceOutput(additionalAppServiceHostInfo, GenerateAppServiceHostType);
132174
}
133175
}

0 commit comments

Comments
 (0)