Skip to content

Commit

Permalink
Merge pull request #485 from CommunityToolkit/upgrade/net7
Browse files Browse the repository at this point in the history
Upgrade to .NET 7, enable WASM optimizations
  • Loading branch information
Arlodotexe authored Oct 24, 2023
2 parents dff647f + dda9f2c commit 9929509
Show file tree
Hide file tree
Showing 19 changed files with 148 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"uno.check": {
"version": "1.10.0",
"version": "1.16.1",
"commands": [
"uno-check"
]
Expand Down
8 changes: 5 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ dotnet_diagnostic.CA2200.severity = warning
dotnet_diagnostic.CA2202.severity = warning
dotnet_diagnostic.CA2207.severity = warning
dotnet_diagnostic.CA2212.severity = warning
dotnet_diagnostic.CA2213.severity = warning
dotnet_diagnostic.CA2214.severity = warning
dotnet_diagnostic.CA2216.severity = warning
dotnet_diagnostic.CA2220.severity = warning
Expand Down Expand Up @@ -433,5 +432,8 @@ csharp_style_prefer_extended_property_pattern = true:suggestion
# Require file header
dotnet_diagnostic.IDE0073.severity = warning

# Uno platform exposes IDisposable on Storyboard publicly when it should be internal. Ignore this.
dotnet_code_quality.CA1001.excluded_type_names_with_derived_types = T:Windows.UI.Xaml.Media.Animation.Storyboard
# Member owns disposable field
# Todo: Clean up suppression of CA1063 and implement IDisposable correctly
# https://github.com/CommunityToolkit/Labs-Windows/issues/443
dotnet_diagnostic.CA2213.severity = none
dotnet_diagnostic.CA1001.severity = none
93 changes: 67 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@ on:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
merge_group:

env:
DOTNET_VERSION: ${{ '7.0.x' }}
DOTNET_VERSION: ${{ '7.0.100' }}
ENABLE_DIAGNOSTICS: false
#COREHOST_TRACE: 1
MSBUILD_VERBOSITY: normal
COREHOST_TRACEFILE: corehosttrace.log
IS_MAIN: ${{ github.ref == 'refs/heads/main' }}
IS_PR: ${{ startsWith(github.ref, 'refs/pull/') }}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "Xaml-Style-Check"
Xaml-Style-Check:
runs-on: windows-latest
runs-on: windows-latest-large

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -61,8 +65,9 @@ jobs:
env:
MULTI_TARGET_DIRECTORY: tooling/MultiTarget
# faux-ternary expression to select which platforms to build for each platform vs. duplicating step below.
TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all' || 'all-uwp' }}
TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all-wasdk' || 'all-uwp' }}
TEST_PLATFORM: ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }}
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -72,16 +77,15 @@ jobs:
minimum-size: 32GB
maximum-size: 32GB
disk-root: "C:"

- name: Configure User-Mode crash dump type
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '' }}
run: |
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpType /t REG_DWORD /d 2 /f
- name: Configure User-Mode crash dump folder

- name: Enable User-Mode Dumps collecting
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '' }}
shell: powershell
run: |
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpFolder /t REG_EXPAND_SZ /d C:\CrashDumps\ /f
New-Item '${{ github.workspace }}\CrashDumps' -Type Directory
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpFolder' -Type ExpandString -Value '${{ github.workspace }}\CrashDumps'
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpCount' -Type DWord -Value '10'
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpType' -Type DWord -Value '2'
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v3
Expand All @@ -103,7 +107,15 @@ jobs:
run: dotnet tool restore

- name: Run Uno Check to Install Dependencies
run: dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --verbose
run: >
dotnet tool run uno-check
--ci
--fix
--non-interactive
--skip wsl
--skip androidemulator
--skip vswinworkloads
--verbose
- name: Add msbuild to PATH
uses: microsoft/[email protected]
Expand All @@ -117,13 +129,23 @@ jobs:
run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -IncludeHeads ${{ env.TEST_PLATFORM }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" -ErrorAction Stop

- name: Enable Uno.WinUI (in WinUI3 matrix only)
if: ${{ matrix.platform == 'WinUI3' }}
working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }}
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
if: ${{ matrix.platform == 'WinUI3' }}

- name: Format Date/Time of Commit for Package Version
run: |
echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV
- name: MSBuild (With diagnostics)
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release /bl -v:diag
run: >
msbuild.exe /restore /nowarn:MSB4011
/p:Configuration=Release
/m
${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }}
/v:${{ env.MSBUILD_VERBOSITY }}
CommunityToolkit.AllComponents.sln
- name: MSBuild
if: ${{ env.ENABLE_DIAGNOSTICS == 'false' }}
Expand All @@ -132,12 +154,16 @@ jobs:
# Build All Packages
- name: pack experiments
working-directory: ./tooling/Scripts/
run: ./PackEachExperiment.ps1 all

# Push Packages to our DevOps Artifacts Feed
- name: Add source
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget update source LabsFeed --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
run: ./PackEachExperiment.ps1 -date ${{ env.VERSION_DATE }}${{ env.VERSION_PROPERTY != '' && format(' -postfix {0}', env.VERSION_PROPERTY) || '' }}

# Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
- name: Push Pull Request Packages (if not fork)
if: ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
run: |
dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json `
--name PullRequests `
--username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
dotnet nuget push "**/*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
- name: Push packages
if: ${{ github.ref == 'refs/heads/main' }}
Expand All @@ -154,7 +180,7 @@ jobs:

- name: Run experiment tests against ${{ env.TEST_PLATFORM }}
id: test-platform
run: vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ env.TEST_PLATFORM }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PLATFORM }}.trx"
run: vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ env.TEST_PLATFORM }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PLATFORM }}.trx" /Blame

- name: Create test reports
run: |
Expand All @@ -174,13 +200,28 @@ jobs:
with:
name: ilc-repro
path: ./*.zip


# https://github.com/dorny/paths-filter#custom-processing-of-changed-files
- name: Detect If any Dump Files
uses: dorny/[email protected]
id: filter
with:
list-files: shell
filters: |
dump:
- added: '${{ github.workspace }}/CrashDumps/*.dmp'
- name: Artifact - WER crash dumps
uses: actions/upload-artifact@v2
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
uses: actions/upload-artifact@v3
if: ${{ steps.filter.outputs.dump == 'true' && (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
with:
name: Crash Dumps
path: C:\CrashDumps\*
name: CrashDumps-${{ matrix.platform }}
path: '${{ github.workspace }}/CrashDumps'

- name: Analyze Dump
if: ${{ steps.filter.outputs.dump == 'true' && (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
run: |
dotnet tool install --global dotnet-dump
dotnet-dump analyze ${{ steps.filter.outputs.dump_files }} -c "clrstack" -c "pe -lines" -c "exit"
wasm-linux:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"csharp.suppressDotnetInstallWarning": true,
"csharp.suppressDotnetRestoreNotification": true,
"csharp.semanticHighlighting.enabled": true,
"omnisharp.enableImportCompletion": true,
"omnisharp.enableMsBuildLoadProjectsOnDemand": true
"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true
}
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);Uno0001</NoWarn>
</PropertyGroup>

<Import Project="Windows.Toolkit.Common.props" />
Expand Down
2 changes: 2 additions & 0 deletions components/AppServices/src/AppServiceHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public abstract class AppServiceHost
/// The name of the app service.
/// </summary>
private readonly string _appServiceName;
#pragma warning disable CA1001
private readonly SemaphoreSlim _semaphoreConnection = new(0, 1);
private readonly SemaphoreSlim _lockConnection = new(1, 1);
#pragma warning restore CA1001

/// <summary>
/// <para>
Expand Down
8 changes: 8 additions & 0 deletions components/CanvasLayout/samples/CanvasLayout.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@

<!-- Sets this up as a toolkit component's sample project -->
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />

<ItemGroup>
<None Remove="Assets\CanvasLayout.png" />

<Content Include="Assets\CanvasLayout.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions components/CanvasView/samples/CanvasView.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@

<!-- Sets this up as a toolkit component's sample project -->
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />

<ItemGroup>
<None Remove="Assets\CanvasView.png" />

<Content Include="Assets\CanvasView.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion components/CanvasView/src/CanvasView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected override void PrepareContainerForItemOverride(DependencyObject element
cp.ManipulationDelta += ContentPresenter_ManipulationDelta;
}

/// TODO: Do we want to support something else in a custom template?? else if (item is FrameworkElement fe && fe.FindDescendant/GetContentControl?)
// TODO: Do we want to support something else in a custom template?? else if (item is FrameworkElement fe && fe.FindDescendant/GetContentControl?)
}

protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Expand Down
8 changes: 8 additions & 0 deletions components/DataTable/samples/DataTable.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@

<!-- Sets this up as a toolkit component's sample project -->
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />

<ItemGroup>
<None Remove="Assets\DataTable.png" />

<Content Include="Assets\DataTable.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions components/MarqueeText/samples/MarqueeText.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@

<!-- Sets this up as a toolkit component's sample project -->
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />

<ItemGroup>
<None Remove="Assets\MarqueeText.png" />

<Content Include="Assets\MarqueeText.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions components/RivePlayer/samples/RivePlayer.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@

<!-- Sets this up as a toolkit component's sample project -->
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />

<ItemGroup>
<None Remove="Assets\RivePlayer.png" />

<Content Include="Assets\RivePlayer.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions components/RivePlayer/src/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@
<!-- WinUI 2 / UWP -->
<ItemGroup Condition="'$(IsUwp)' == 'true'">
<!-- <PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.2"/> -->
<PackageReference Include="SkiaSharp.Views" Version="2.88.2" />
<PackageReference Include="SkiaSharp.Views" Version="2.88.6" />
</ItemGroup>

<!-- WinUI 2 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '2'">
<!-- <PackageReference Include="Uno.Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.11"/> -->
<PackageReference Include="SkiaSharp.Views.Uno" Version="2.88.2" />
<PackageReference Include="SkiaSharp.Views.Uno" Version="2.88.6" />
</ItemGroup>

<!-- WinUI 3 / WinAppSdk -->
<ItemGroup Condition="'$(IsWinAppSdk)' == 'true'">
<!-- <PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.2"/> -->
<PackageReference Include="SkiaSharp.Views.WinUI" Version="2.88.2" />
<PackageReference Include="SkiaSharp.Views.WinUI" Version="2.88.6" />
</ItemGroup>

<!-- WinUI 3 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '3'">
<!-- <PackageReference Include="Uno.CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.100-dev.15.g12261e2626"/> -->
<PackageReference Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.2" />
<PackageReference Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.6" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions components/Shimmer/samples/Shimmer.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />
<ItemGroup>
<None Remove="Assets\Owl.jpg" />
<None Remove="Assets\Shimmer.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Owl.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Shimmer.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions components/TokenView/samples/TokenView.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@

<!-- Sets this up as a toolkit component's sample project -->
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />

<ItemGroup>
<None Remove="Assets\TokenView.png" />

<Content Include="Assets\TokenView.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public class TokenItemRemovingEventArgs : EventArgs
/// Initializes a new instance of the <see cref="TokenItemRemovingEventArgs"/> class.
/// </summary>
/// <param name="item">Item being removed.</param>
/// <param name="Token"><see cref="Token"/> container being closed.</param>
public TokenItemRemovingEventArgs(object item, TokenItem tokenITem)
/// <param name="tokenItem"><see cref="TokenItem"/> container being closed.</param>
public TokenItemRemovingEventArgs(object item, TokenItem tokenItem)
{
Item = item;
TokenItem = tokenITem;
TokenItem = tokenItem;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@

<!-- Sets this up as a toolkit component's sample project -->
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />

<ItemGroup>
<None Remove="Assets\TransitionHelper.png" />

<Content Include="Assets\TransitionHelper.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.405",
"version": "7.0.100",
"rollForward": "latestFeature"
},
"msbuild-sdks":
Expand Down
2 changes: 1 addition & 1 deletion tooling
Submodule tooling updated 282 files

0 comments on commit 9929509

Please sign in to comment.