Skip to content

Commit f95f0b1

Browse files
authored
Merge branch 'main' into mstest-sdk
2 parents a0a6555 + 565b315 commit f95f0b1

42 files changed

Lines changed: 721 additions & 303 deletions

Some content is hidden

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

.config/dotnet-tools.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
"isRoot": true,
44
"tools": {
55
"uno.check": {
6-
"version": "1.27.4",
6+
"version": "1.33.1",
77
"commands": [
88
"uno-check"
99
]
1010
},
1111
"xamlstyler.console": {
12-
"version": "3.2206.4",
12+
"version": "3.2501.8",
1313
"commands": [
1414
"xstyler"
1515
]
1616
},
1717
"microsoft.visualstudio.slngen.tool": {
18-
"version": "11.2.3",
18+
"version": "12.0.13",
1919
"commands": [
2020
"slngen"
2121
]

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525
jobs:
2626
# This workflow contains a single job called "Xaml-Style-Check"
2727
Xaml-Style-Check:
28-
runs-on: windows-latest
28+
runs-on: windows-2022
2929

3030
# Steps represent a sequence of tasks that will be executed as part of the job
3131
steps:
@@ -89,7 +89,7 @@ jobs:
8989

9090
# Test job to build the project template
9191
project-template:
92-
runs-on: windows-latest
92+
runs-on: windows-2022
9393
env:
9494
HEADS_DIRECTORY: tooling/ProjectHeads
9595
PROJECT_DIRECTORY: tooling/ProjectTemplate
@@ -139,7 +139,7 @@ jobs:
139139

140140
# Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
141141
new-experiment:
142-
runs-on: windows-latest
142+
runs-on: windows-2022
143143

144144
strategy:
145145
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.

.github/workflows/config/nuget.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<packageSources>
33
<clear />
44
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
5-
<add key="MainLatest" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest/nuget/v3/index.json" protocolVersion="3" />
65
</packageSources>
76
<disabledPackageSources>
87
<clear />

Build-Toolkit-Components.ps1

Lines changed: 33 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
Param (
6060
[ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')]
6161
[Alias("mt")]
62-
[string[]]$MultiTargets = @('uwp', 'wasm'), # default settings
62+
[string[]]$MultiTargets = @('uwp', 'wasm', 'wasdk'), # default settings
6363

6464
[ValidateSet('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')]
6565
[string[]]$ExcludeMultiTargets = @(), # default settings
@@ -85,7 +85,7 @@ Param (
8585
[hashtable]$AdditionalProperties,
8686

8787
[Alias("winui")]
88-
[int]$WinUIMajorVersion = 2,
88+
[int]$WinUIMajorVersion = 3,
8989

9090
[string]$ComponentDir = "src",
9191

@@ -95,9 +95,6 @@ Param (
9595
[switch]$Verbose
9696
)
9797

98-
# Use the specified MultiTarget TFM and WinUI version
99-
& $PSScriptRoot\MultiTarget\UseUnoWinUI.ps1 $WinUIMajorVersion
100-
& $PSScriptRoot\MultiTarget\UseTargetFrameworks.ps1 -MultiTargets $MultiTargets -ExcludeMultiTargets $ExcludeMultiTargets
10198

10299
if ($MultiTargets -eq 'all') {
103100
$MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')
@@ -110,28 +107,32 @@ if ($null -eq $ExcludeMultiTargets)
110107

111108
# Both uwp and wasdk share a targetframework. Both cannot be enabled at once.
112109
# If both are supplied, remove one based on WinUIMajorVersion.
113-
if ($MultiTargets.Contains('uwp') -and $MultiTargets.Contains('wasdk'))
110+
if ($WinUIMajorVersion -eq 2)
114111
{
115-
if ($WinUIMajorVersion -eq 2)
116-
{
117-
$ExcludeMultiTargets = $ExcludeMultiTargets + 'wasdk'
118-
}
119-
else
120-
{
121-
$ExcludeMultiTargets = $ExcludeMultiTargets + 'uwp'
122-
}
112+
$ExcludeMultiTargets = $ExcludeMultiTargets + 'wasdk'
113+
}
114+
115+
if ($WinUIMajorVersion -eq 3)
116+
{
117+
$ExcludeMultiTargets = $ExcludeMultiTargets + 'uwp'
123118
}
124119

125120
$MultiTargets = $MultiTargets | Where-Object { $_ -notin $ExcludeMultiTargets }
126121

127-
if ($Components -eq @('all')) {
128-
$Components = @('**')
129-
}
122+
Write-Output "Building components '$Components' for MultiTargets: $MultiTargets"
130123

131124
if ($ExcludeComponents) {
132125
$Components = $Components | Where-Object { $_ -notin $ExcludeComponents }
133126
}
134127

128+
# Use the specified MultiTarget TFM and WinUI version
129+
# WinUI 0 indicates non-WinUI projects (e.g. netstandard) should be built.
130+
if ($WinUIMajorVersion -ne 0) {
131+
& $PSScriptRoot\MultiTarget\UseUnoWinUI.ps1 $WinUIMajorVersion
132+
}
133+
134+
& $PSScriptRoot\MultiTarget\UseTargetFrameworks.ps1 -MultiTargets $MultiTargets -ExcludeMultiTargets $ExcludeMultiTargets
135+
135136
function Invoke-MSBuildWithBinlog {
136137
param (
137138
[string]$TargetHeadPath
@@ -207,11 +208,9 @@ function Invoke-MSBuildWithBinlog {
207208
}
208209
}
209210

210-
# List of WinUI-2 compatible multitargets
211-
$WinUI2MultiTargets = @('uwp', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android')
212-
213-
# List of WinUI-3 compatible multitargets
214-
$WinUI3MultiTargets = @('wasdk', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android')
211+
if ($Components -eq @('all')) {
212+
$Components = @('**')
213+
}
215214

216215
# Components are built individually
217216
foreach ($ComponentName in $Components) {
@@ -228,40 +227,21 @@ foreach ($ComponentName in $Components) {
228227
# Get supported MultiTarget for this component
229228
$supportedMultiTargets = & $PSScriptRoot\MultiTarget\Get-MultiTargets.ps1 -component $componentName
230229

231-
# If the component does not support at least one target that supports the requested WinUI major version, skip the component
232-
$isWinUIMajorVersionSupported = $false
233-
234-
# Flag to check if any of the requested targets are supported by the component
235-
$isRequestedTargetSupported = $false
236-
237-
foreach ($requestedTarget in $MultiTargets) {
238-
if ($false -eq $isRequestedTargetSupported) {
239-
$isRequestedTargetSupported = $requestedTarget -in $supportedMultiTargets
240-
}
241-
}
242-
243-
foreach ($supportedMultiTarget in $supportedMultiTargets) {
244-
if ($false -eq $isWinUIMajorVersionSupported) {
245-
if ($WinUIMajorVersion -eq 2) {
246-
$isWinUIMajorVersionSupported = $supportedMultiTarget -in $WinUI2MultiTargets;
247-
}
248-
249-
if ($WinUIMajorVersion -eq 3) {
250-
$isWinUIMajorVersionSupported = $supportedMultiTarget -in $WinUI3MultiTargets;
251-
}
252-
}
253-
}
254-
255-
# If none of the requested targets are supported by the component, we can skip build to save time and avoid errors.
256-
if (-not $isRequestedTargetSupported) {
257-
Write-Warning "Skipping $($componentPath.BaseName), none of the requested MultiTargets '$MultiTargets' are enabled for this component."
230+
$shouldBuild = & $PSScriptRoot\MultiTarget\Test-Component-Support.ps1 `
231+
-RequestedMultiTargets $MultiTargets `
232+
-SupportedMultiTargets $supportedMultiTargets `
233+
-Component $componentName `
234+
-WinUIMajorVersion $WinUIMajorVersion
235+
236+
if (-not $shouldBuild.IsSupported) {
237+
Write-Warning "Skipping $componentName. $($shouldBuild.Reason)"
258238
continue
259239
}
260240

261-
if (-not $isWinUIMajorVersionSupported) {
262-
Write-Warning "Skipping $($componentPath.BaseName), none of the supported MultiTargets '$supportedMultiTargets' support WinUI $WinUIMajorVersion."
263-
continue
264-
}
241+
# Filter ExcludeMultiTargets out of supportedMultiTargets
242+
# For display purposes only. The actual build uses the EnabledMultiTargets.props + EnabledTargetFrameworks.props to calculate supported targets at build time.
243+
$supportedMultiTargets = $supportedMultiTargets | Where-Object { $_ -notin $ExcludeMultiTargets }
244+
Write-Output "Building $componentName for MultiTargets '$supportedMultiTargets'"
265245

266246
Invoke-MSBuildWithBinlog $componentCsproj.FullName $EnableBinLogs $BinlogOutput
267247
}

Build-Toolkit-Docs.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function ProcessMarkdownFile($markdownFile) {
3737

3838
# Insert Header
3939
$contents = $contents.Substring(0, $endIndex + 5) + "`n# $header`n" + $contents.Substring($endIndex + 5)
40-
40+
4141
# Find Sample Placeholders, replace with code content
4242
foreach ($sample in ($contents | Select-String -Pattern '>\s*\[!SAMPLE\s*(?<sampleid>.*)\s*\]\s*' -AllMatches).Matches) {
4343
$sampleid = $sample.Groups[1].Value
@@ -47,8 +47,8 @@ function ProcessMarkdownFile($markdownFile) {
4747
foreach ($csFile in Get-ChildItem -Recurse -Path ($markdownFile.DirectoryName + '\**\*.xaml.cs').Replace('\', '/') |
4848
Where-Object { $_.FullName -notlike "*\bin\*" -and $_FullName -notlike "*\obj\*" }) {
4949
$csSample = Get-Content $csFile -Raw
50-
51-
if ($csSample -match '\[ToolkitSample\s?\(\s*id:\s*(?:"|nameof\()\s?' + $sampleid + '\s?(?:"|\))') {
50+
51+
if ($csSample -match '\[ToolkitSample\s?\(\s*(?:id\:)?\s*(?:"|nameof\()\s?' + $sampleid + '\s?(?:"|\))') {
5252
# Get Relative Path
5353
$docPath = $(Join-Path "components" $($csfile.FullName.Replace($componentsRoot.Path, ''))).Replace('\', '/').Trim('/')
5454

Build-Toolkit-Gallery.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Param (
6969
[hashtable]$AdditionalProperties,
7070

7171
[Alias("winui")]
72-
[int]$WinUIMajorVersion = 2,
72+
[int]$WinUIMajorVersion = 3,
7373

7474
[Alias("c")]
7575
[string[]]$Components = @("all"),

CommunityToolkit.App.Shared/Pages/Shell.xaml.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public Shell()
2727
BackdropMaterial.SetApplyToRootOrPageBackground(this, true);
2828
#endif
2929
Current = this;
30+
31+
Loaded += Shell_Loaded;
3032
}
3133

3234
/// <summary>
@@ -36,9 +38,13 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
3638
{
3739
samplePages = e.Parameter as IEnumerable<ToolkitFrontMatter>;
3840
SetupNavigationMenu();
39-
base.OnNavigatedTo(e);
41+
base.OnNavigatedTo(e);
4042
}
4143

44+
private void Shell_Loaded(object sender, RoutedEventArgs e)
45+
{
46+
searchBox.Focus(FocusState.Programmatic);
47+
}
4248

4349
private void SetupNavigationMenu()
4450
{

CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- 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. -->
1+
<!-- 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. -->
22
<Page x:Class="CommunityToolkit.App.Shared.Renderers.ToolkitDocumentationRenderer"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -230,7 +230,7 @@
230230
</StackPanel>
231231
<interactivity:Interaction.Behaviors>
232232
<interactivity:EventTriggerBehavior EventName="Click">
233-
<behaviors:NavigateToUriAction NavigateUri="{x:Bind renderer:ToolkitDocumentationRenderer.ToComponentUri(Metadata.ComponentName), Mode=OneWay}" />
233+
<behaviors:NavigateToUriAction NavigateUri="{x:Bind renderer:ToolkitDocumentationRenderer.ToComponentUri(Metadata.ComponentName, Metadata.IsExperimental), Mode=OneWay}" />
234234
</interactivity:EventTriggerBehavior>
235235
</interactivity:Interaction.Behaviors>
236236
</Button>
@@ -258,16 +258,16 @@
258258
Text="NuGet package" />
259259
<TextBlock IsTextSelectionEnabled="True">
260260
<Hyperlink FontFamily="Consolas"
261-
NavigateUri="{x:Bind renderer:ToolkitDocumentationRenderer.ToPackageUri('Uwp', Metadata.CsProjName), Mode=OneWay}"
261+
NavigateUri="{x:Bind renderer:ToolkitDocumentationRenderer.ToPackageUri('Uwp', Metadata.CsProjName, Metadata.IsExperimental), Mode=OneWay}"
262262
TextDecorations="None">
263-
<Run Text="{x:Bind renderer:ToolkitDocumentationRenderer.ToPackageName('Uwp', Metadata.CsProjName), Mode=OneWay}" />
263+
<Run Text="{x:Bind renderer:ToolkitDocumentationRenderer.ToPackageName('Uwp', Metadata.CsProjName, Metadata.IsExperimental), Mode=OneWay}" />
264264
</Hyperlink>
265265
</TextBlock>
266266
<TextBlock IsTextSelectionEnabled="True">
267267
<Hyperlink FontFamily="Consolas"
268-
NavigateUri="{x:Bind renderer:ToolkitDocumentationRenderer.ToPackageUri('WinUI', Metadata.CsProjName), Mode=OneWay}"
268+
NavigateUri="{x:Bind renderer:ToolkitDocumentationRenderer.ToPackageUri('WinUI', Metadata.CsProjName, Metadata.IsExperimental), Mode=OneWay}"
269269
TextDecorations="None">
270-
<Run Text="{x:Bind renderer:ToolkitDocumentationRenderer.ToPackageName('WinUI', Metadata.CsProjName), Mode=OneWay}" />
270+
<Run Text="{x:Bind renderer:ToolkitDocumentationRenderer.ToPackageName('WinUI', Metadata.CsProjName, Metadata.IsExperimental), Mode=OneWay}" />
271271
</Hyperlink>
272272
</TextBlock>
273273
</StackPanel>

CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,35 @@ private async void MarkdownTextBlock_LinkClicked(object sender, LinkClickedEvent
216216

217217
public static Uri? ToGitHubUri(string path, int id) => IsProjectPathValid() ? new Uri($"{ProjectUrl}/{path}/{id}") : null;
218218

219-
public static Uri? ToComponentUri(string name) => IsProjectPathValid() ? new Uri($"{ProjectUrl}/tree/main/components/{name}") : null;
219+
public static Uri? ToComponentUri(string name, bool? isExperimental = null)
220+
{
221+
if (IsProjectPathValid() is not true)
222+
{
223+
return null;
224+
}
220225

221-
public static Uri? ToPackageUri(string platform, string projectFileName) => new Uri($"https://www.nuget.org/packages/{RemoveFileExtension(projectFileName).Replace("WinUI", platform)}");
226+
string? url = (isExperimental is null || isExperimental is false)
227+
? ProjectUrl
228+
: ProjectUrl?.Replace("Windows", "Labs-Windows");
222229

223-
public static string ToPackageName(string platform, string projectFileName) => RemoveFileExtension(projectFileName).Replace("WinUI", platform);
230+
return new Uri($"{url}/tree/main/components/{name}");
231+
}
232+
233+
public static Uri? ToPackageUri(string platform, string projectFileName, bool? isExperimental = null)
234+
{
235+
if (isExperimental is null || isExperimental is false)
236+
{
237+
return new Uri($"https://www.nuget.org/packages/{ToPackageName(platform, projectFileName, isExperimental)}");
238+
}
239+
else
240+
{
241+
// Labs feed for experimental packages (currently)
242+
// See inconsistency for Labs package names/project names https://github.com/CommunityToolkit/Windows/issues/587#issuecomment-2738529086
243+
return new Uri($"https://dev.azure.com/dotnet/CommunityToolkit/_artifacts/feed/CommunityToolkit-Labs/NuGet/{ToPackageName(platform, projectFileName, isExperimental)}");
244+
}
245+
}
246+
247+
public static string ToPackageName(string platform, string projectFileName, bool? isExperimental) => RemoveFileExtension(projectFileName).Replace("CommunityToolkit.WinUI", isExperimental == true ? "CommunityToolkit.Labs.WinUI" : "CommunityToolkit.WinUI").Replace("WinUI", platform);
224248

225249
// TODO: Think this is most of the special cases with Controls and the Extensions/Triggers using the base namespace
226250
// See: https://github.com/CommunityToolkit/Tooling-Windows-Submodule/issues/105#issuecomment-1698306420

0 commit comments

Comments
 (0)