Skip to content

Commit cc95e34

Browse files
committed
Merge
2 parents f8c94e3 + 35c03df commit cc95e34

64 files changed

Lines changed: 523 additions & 401 deletions

File tree

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ jobs:
9595
PROJECT_DIRECTORY: tooling/ProjectTemplate
9696

9797
steps:
98+
- name: Configure Pagefile
99+
uses: al-cheb/configure-pagefile-action@v1.2
100+
with:
101+
minimum-size: 32GB
102+
maximum-size: 32GB
103+
disk-root: "C:"
104+
98105
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
99106
uses: actions/setup-dotnet@v3
100107
with:
@@ -116,7 +123,7 @@ jobs:
116123
- name: Copy props files to root
117124
shell: pwsh
118125
working-directory: ./
119-
run: copy ./tooling/.github/workflows/Directory.Build.* ./
126+
run: copy ./tooling/.github/workflows/config/* ./
120127

121128
- name: Add msbuild to PATH
122129
uses: microsoft/setup-msbuild@v1.3.1
@@ -140,6 +147,13 @@ jobs:
140147
TEST_PROJECT_DIRECTORY: components/CiTestExp
141148

142149
steps:
150+
- name: Configure Pagefile
151+
uses: al-cheb/configure-pagefile-action@v1.2
152+
with:
153+
minimum-size: 32GB
154+
maximum-size: 32GB
155+
disk-root: "C:"
156+
143157
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
144158
uses: actions/setup-dotnet@v3
145159
with:
@@ -162,7 +176,7 @@ jobs:
162176
shell: pwsh
163177
working-directory: ./
164178
run: |
165-
copy ./tooling/.github/workflows/Directory.Build.* ./
179+
copy ./tooling/.github/workflows/config/* ./
166180
mkdir ./.config
167181
copy ./tooling/.config/dotnet-tools.json ./.config/dotnet-tools.json
168182
mkdir ./components
@@ -247,7 +261,7 @@ jobs:
247261
shell: pwsh
248262
working-directory: ./
249263
run: |
250-
copy ./tooling/.github/workflows/Directory.Build.* ./
264+
copy ./tooling/.github/workflows/config/* ./
251265
mkdir ./.config
252266
copy ./tooling/.config/dotnet-tools.json ./.config/dotnet-tools.json
253267
mkdir ./components
File renamed without changes.
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<configuration>
2+
<packageSources>
3+
<clear />
4+
<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" />
6+
</packageSources>
7+
<disabledPackageSources>
8+
<clear />
9+
</disabledPackageSources>
10+
</configuration>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
# Tooling Config Folder
3+
4+
This folder contains the minimum configuration required by the tooling module to be built and needs to be in the root of a repository using it.
5+
6+
These files are contained here in the `config` folder to be copied by the tooling `build.yml` file for self-validation within the tooling module CI pipeline.
7+
8+
They can also be used as a starting point for a custom repository that uses the `tooling` sub-module.
9+
10+
## Components
11+
12+
### Directory.Build.props
13+
14+
Contains properties like `RepositoryDirectory` and `ToolingDirectory` which are used within the property files of the tooling module to understand the proper path setup for dependencies and references.
15+
16+
### Directory.Build.targets
17+
18+
Contains `SlnGenSolutionItem` items that we wish to appear within the generated solution files.
19+
20+
### nuget.config
21+
22+
Contains any NuGet feeds required for dependent packages not found on NuGet.org at the moment (for instance the current unified port of the Community Toolkit Extensions used by testing).

CommunityToolkit.App.Shared/Renderers/Markdown/MarkdownTextBlock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#endif
1717
#endif
1818

19-
#if WASM
19+
#if HAS_UNO_WASM
2020
using Markdig;
2121
using Uno.Foundation.Interop;
2222
using Uno.UI.Runtime.WebAssembly;
@@ -27,7 +27,7 @@ namespace CommunityToolkit.App.Shared.Renderers;
2727
/// <summary>
2828
/// Provide an abstraction around the Toolkit MarkdownTextBlock for both UWP and WinUI 3 in the same namespace (until 8.0) as well as a polyfill for WebAssembly/WASM.
2929
/// </summary>
30-
#if WASM
30+
#if HAS_UNO_WASM
3131
[HtmlElement("div")]
3232
public partial class MarkdownTextBlock : TextBlock
3333
{

CommunityToolkit.Tests.Shared/CommunityToolkit.Tests.Shared.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<Compile Include="$(MSBuildThisFileDirectory)App.xaml.cs">
1919
<DependentUpon>App.xaml</DependentUpon>
2020
</Compile>
21+
<Compile Include="$(MSBuildThisFileDirectory)Internal\CompositionTargetHelper.cs" />
2122
<Compile Include="$(MSBuildThisFileDirectory)Log.cs" />
2223
<Compile Include="$(MSBuildThisFileDirectory)VisualUITestBase.cs" />
2324
</ItemGroup>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace CommunityToolkit.Tests.Internal;
6+
7+
/// <summary>
8+
/// Provides helpers for the <see cref="CompositionTarget"/> class.
9+
/// </summary>
10+
public static class CompositionTargetHelper
11+
{
12+
/// <summary>
13+
/// Provides a method to execute code after the rendering pass is completed.
14+
/// <seealso href="https://github.com/microsoft/microsoft-ui-xaml/blob/c045cde57c5c754683d674634a0baccda34d58c4/dev/dll/SharedHelpers.cpp#L399"/>
15+
/// <seealso href="https://devblogs.microsoft.com/premier-developer/the-danger-of-taskcompletionsourcet-class/"/>
16+
/// </summary>
17+
/// <param name="action">Action to be executed after render pass</param>
18+
/// <param name="options"><see cref="TaskCreationOptions"/> for how to handle async calls with <see cref="TaskCompletionSource{TResult}"/>.</param>
19+
/// <returns>Awaitable Task</returns>
20+
public static Task<bool> ExecuteAfterCompositionRenderingAsync(Action action, TaskCreationOptions? options = null)
21+
{
22+
if (action is null)
23+
{
24+
ThrowArgumentNullException();
25+
}
26+
27+
TaskCompletionSource<bool> taskCompletionSource = options.HasValue ? new(options.Value)
28+
: new();
29+
30+
try
31+
{
32+
void Callback(object? sender, object args)
33+
{
34+
CompositionTarget.Rendering -= Callback;
35+
36+
action!();
37+
38+
taskCompletionSource.SetResult(true);
39+
}
40+
41+
CompositionTarget.Rendering += Callback;
42+
}
43+
catch (Exception e)
44+
{
45+
taskCompletionSource.SetException(e); // Note this can just sometimes be a wrong thread exception, see WinUI function notes.
46+
}
47+
48+
return taskCompletionSource.Task;
49+
50+
static void ThrowArgumentNullException() => throw new ArgumentNullException("The parameter \"action\" must not be null.");
51+
}
52+
}

CommunityToolkit.Tests.Shared/VisualUITestBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
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.Tests.Internal;
6+
using CommunityToolkit.WinUI;
7+
58
namespace CommunityToolkit.Tests;
69

710
/// <summary>

CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
<LangVersion>preview</LangVersion>
99
</PropertyGroup>
1010

11-
<ItemGroup>
12-
<Compile Include="..\GlobalUsings.cs" Link="GlobalUsings.cs" />
13-
</ItemGroup>
14-
1511
<ItemGroup>
1612
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
1713
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
1814
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
1915
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
2016
</ItemGroup>
2117

18+
<ItemGroup>
19+
<Compile Include="..\GlobalUsings.cs" Link="GlobalUsings.cs" />
20+
</ItemGroup>
21+
2222
<ItemGroup>
2323
<ProjectReference Include="..\CommunityToolkit.Tooling.SampleGen\CommunityToolkit.Tooling.SampleGen.csproj" />
2424
</ItemGroup>

0 commit comments

Comments
 (0)