Skip to content

Commit 58cdd50

Browse files
Upgrade to .NET 7, enable WASM optimizations (#173)
* Fixed build errors caused by .NET 7 upgrade * Updated tooling pointer Update tooling to latest upgrade/net7 * Bump uno-check * Skip vswinworkloads * Update Build Script to support Pull Request Packages Again Cleaned up some logic for diagnostic builds as well so we have a single build command * Update tooling to use maccatalyst * Fix for net7.0-maccatalyst, use dotnet 7.0.100 * Update tooling, additional net7-mobile error suppression * Update tooling: More error suppression for net7 mobile * Fixed invalid symbol references in comments * Update editorconfig * Update editorconfig * Update logic for Versioning of Build and ensure to pass to Packing Script * Use net7.0-android33.0 instead of net7.0-android * Fix and un-suppress CS1574 errors * Remove suppression of CS1587 * Update tooling pointer * Fixed remaining build errors * Update tooling to latest main * Suppress CS1587 * Move platfiorm conditionals to using statements * Fix issue with XML comment for StackedNotificationsBehavior 2023-08-17T20:08:53.7233918Z 5>D:\a\Windows\Windows\components\Behaviors\src\Notification\StackedNotificationsBehavior.cs(16,70): error CS1574: XML comment has cref attribute 'InfoBar' that could not be resolved --------- Co-authored-by: michael-hawker <24302614+michael-hawker@users.noreply.github.com>
1 parent 819071d commit 58cdd50

25 files changed

+72
-47
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"uno.check": {
6-
"version": "1.10.0",
6+
"version": "1.13.0",
77
"commands": [
88
"uno-check"
99
]

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,4 +434,4 @@ csharp_style_prefer_extended_property_pattern = true:suggestion
434434
dotnet_diagnostic.IDE0073.severity = warning
435435

436436
# Uno platform exposes IDisposable on Storyboard publicly when it should be internal. Ignore this.
437-
dotnet_code_quality.CA1001.excluded_type_names_with_derived_types = T:Windows.UI.Xaml.Media.Animation.Storyboard
437+
dotnet_code_quality.CA1001.excluded_type_names_with_derived_types = T:Windows.UI.Xaml.Media.Animation.Storyboard

.github/workflows/build.yml

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

1919
env:
20-
DOTNET_VERSION: ${{ '7.0.x' }}
20+
DOTNET_VERSION: ${{ '7.0.100' }}
2121
ENABLE_DIAGNOSTICS: true
22+
MSBUILD_VERBOSITY: normal
2223
#COREHOST_TRACE: 1
2324
COREHOST_TRACEFILE: corehosttrace.log
2425
MULTI_TARGET_DIRECTORY: tooling/MultiTarget
@@ -65,6 +66,7 @@ jobs:
6566
# faux-ternary expression to select which platforms to build for each platform vs. duplicating step below.
6667
TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all' || 'all-uwp' }}
6768
TEST_PLATFORM: ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }}
69+
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('-p:PreviewVersion=build.{0}', github.run_number) || format('-p:PreviewVersion=pull-{0}.{1}', github.event.number, github.run_number) }}
6870

6971
# Steps represent a sequence of tasks that will be executed as part of the job
7072
steps:
@@ -104,7 +106,7 @@ jobs:
104106
run: dotnet tool restore
105107

106108
- name: Run Uno Check to Install Dependencies
107-
run: dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --verbose
109+
run: dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --skip vswinworkloads --verbose
108110

109111
- name: Add msbuild to PATH
110112
uses: microsoft/setup-msbuild@v1.3.1
@@ -122,27 +124,25 @@ jobs:
122124
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
123125
if: ${{ matrix.platform == 'WinUI3' }}
124126

125-
- name: MSBuild (With diagnostics)
126-
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
127-
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m /bl -v:diag
128-
129127
- name: MSBuild
130-
if: ${{ env.ENABLE_DIAGNOSTICS == 'false' }}
131-
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m
128+
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m ${{ env.VERSION_PROPERTY }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }} -v:${{ env.MSBUILD_VERBOSITY }}
132129

133130
# Build All Packages
134131
- name: pack experiments
135132
working-directory: ./tooling/Scripts/
136-
run: ./PackEachExperiment.ps1 all
133+
run: ./PackEachExperiment.ps1 -extraBuildProperties "${{ env.VERSION_PROPERTY }}"
137134

138135
# Push Packages to our DevOps Artifacts Feed (see nuget.config)
139-
- name: Add source
136+
- name: Add source (main)
140137
if: ${{ github.ref == 'refs/heads/main' }}
141138
run: dotnet nuget update source MainLatest --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
142139

140+
- name: Add source (pull requests)
141+
if: ${{ github.ref != 'refs/heads/main' }}
142+
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 }}
143+
143144
- name: Push packages
144-
if: ${{ github.ref == 'refs/heads/main' }}
145-
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source MainLatest --skip-duplicate
145+
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source ${{ github.ref == 'refs/heads/main' && 'MainLatest' || 'PullRequests' }} --skip-duplicate
146146

147147
# Run tests
148148
- name: Setup VSTest Path
@@ -241,7 +241,7 @@ jobs:
241241
# See launch.json configuration file for analogous command we're emulating here to build LINK: ../../.vscode/launch.json:CommunityToolkit.App.Wasm.csproj
242242
- name: dotnet build
243243
working-directory: ./${{ env.HEADS_DIRECTORY }}/AllComponents/Wasm/
244-
run: dotnet build /r /bl
244+
run: dotnet build /r /bl -v:${{ env.MSBUILD_VERBOSITY }}
245245

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

components/Animations/src/ConnectedAnimations/Connected.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ public static void SetAnchorElement(DependencyObject obj, UIElement value)
5353
/// <summary>
5454
/// Gets the connected animation key associated with the ListViewBase item being animated
5555
/// </summary>
56-
/// <param name="obj">The <see cref="Windows.UI.Xaml.Controls.ListViewBase"/></param>
56+
/// <param name="obj">The <see cref="ListViewBase"/></param>
5757
/// <returns>The connected animation key</returns>
5858
public static string GetListItemKey(DependencyObject obj)
5959
{
6060
return (string)obj.GetValue(ListItemKeyProperty);
6161
}
6262

6363
/// <summary>
64-
/// Sets the connected animation key for the <see cref="Windows.UI.Xaml.Controls.ListViewBase"/> item being animated
64+
/// Sets the connected animation key for the <see cref="ListViewBase"/> item being animated
6565
/// </summary>
66-
/// <param name="obj">The <see cref="Windows.UI.Xaml.Controls.ListViewBase"/></param>
66+
/// <param name="obj">The <see cref="ListViewBase"/></param>
6767
/// <param name="value">The connected animation key</param>
6868
public static void SetListItemKey(DependencyObject obj, string value)
6969
{
@@ -73,7 +73,7 @@ public static void SetListItemKey(DependencyObject obj, string value)
7373
/// <summary>
7474
/// Gets the name of the element in the <see cref="DataTemplate"/> that is animated
7575
/// </summary>
76-
/// <param name="obj">The <see cref="Windows.UI.Xaml.Controls.ListViewBase"/></param>
76+
/// <param name="obj">The <see cref="ListViewBase"/></param>
7777
/// <returns>The name of the element being animated</returns>
7878
public static string GetListItemElementName(DependencyObject obj)
7979
{
@@ -83,7 +83,7 @@ public static string GetListItemElementName(DependencyObject obj)
8383
/// <summary>
8484
/// Sets the name of the element in the <see cref="DataTemplate"/> that is animated
8585
/// </summary>
86-
/// <param name="obj">The <see cref="Windows.UI.Xaml.Controls.ListViewBase"/></param>
86+
/// <param name="obj">The <see cref="ListViewBase"/></param>
8787
/// <param name="value">The name of the element to animate</param>
8888
public static void SetListItemElementName(DependencyObject obj, string value)
8989
{

components/Animations/src/Enums/FrameworkLayer.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
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+
#if WINUI2
6+
using Composition = Windows.UI.Composition;
7+
using Animation = Windows.UI.Xaml.Media.Animation;
8+
#elif WINUI3
9+
using Composition = Microsoft.UI.Composition;
10+
using Animation = Microsoft.UI.Xaml.Media.Animation;
11+
#endif
12+
513
namespace CommunityToolkit.WinUI.Animations;
614

715
/// <summary>
@@ -10,12 +18,12 @@ namespace CommunityToolkit.WinUI.Animations;
1018
public enum FrameworkLayer
1119
{
1220
/// <summary>
13-
/// Indicates the <see cref="Windows.UI.Composition"/> APIs.
21+
/// Indicates the <see cref="Composition"/> APIs.
1422
/// </summary>
1523
Composition,
16-
24+
1725
/// <summary>
18-
/// Indicates the <see cref="Windows.UI.Xaml.Media.Animation"/> APIs.
26+
/// Indicates the <see cref="Animation"/> APIs.
1927
/// </summary>
2028
Xaml
2129
}

components/Animations/src/Enums/VisualProperty.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
namespace CommunityToolkit.WinUI.Animations;
66

7+
#if WINUI2
8+
using Windows.UI.Composition;
9+
#else
10+
using Microsoft.UI.Composition;
11+
#endif
12+
713
/// <summary>
814
/// Indicates a property of a <see cref="Visual"/> object.
915
/// </summary>

components/Animations/src/Expressions/ReferenceNodes/AmbientLightReferenceNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace CommunityToolkit.WinUI.Animations.Expressions;
1313
/// <summary>
1414
/// Class AmbientLightReferenceNode. This class cannot be inherited.
1515
/// </summary>
16-
/// <seealso cref="Microsoft.Toolkit.Uwp.UI.Animations.Expressions.ReferenceNode" />
16+
/// <seealso cref="ReferenceNode" />
1717
public sealed class AmbientLightReferenceNode : ReferenceNode
1818
{
1919
/// <summary>

components/Animations/src/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public abstract class CustomAnimation<TValue, TKeyFrame> : ImplicitAnimation<TVa
1919
/// </summary>
2020
public string? Target { get; set; }
2121

22+
23+
// Suppression required for net7-android. The #if compilation conditionals are preventing the compiler from interpreting it correctly.
24+
#pragma warning disable CS1587 // XML comment is not placed on a valid language element
2225
/// <summary>
2326
/// Gets or sets the target framework layer for the animation. This is only supported
2427
/// for a set of animation types (see the docs for more on this). Furthermore, this is
@@ -31,6 +34,7 @@ public abstract class CustomAnimation<TValue, TKeyFrame> : ImplicitAnimation<TVa
3134
/// The default value is <see cref="FrameworkLayer.Xaml"/>.
3235
/// </summary>
3336
public FrameworkLayer Layer { get; set; } = FrameworkLayer.Xaml;
37+
#pragma warning restore CS1587 // XML comment is not placed on a valid language element
3438
#endif
3539

3640
/// <inheritdoc/>

components/Animations/src/Xaml/AnimationSet.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55
using System.Diagnostics.Contracts;
66
using System.Runtime.CompilerServices;
77

8+
#if WINUI2
9+
using Windows.UI.Xaml.Media.Animation;
10+
#else
11+
using Microsoft.UI.Xaml.Media.Animation;
12+
#endif
13+
814
namespace CommunityToolkit.WinUI.Animations;
915

1016
/// <summary>
1117
/// A collection of animations that can be grouped together. This type represents a composite animation
12-
/// (such as <see cref="Windows.UI.Xaml.Media.Animation.Storyboard"/>) that can be executed on a given element.
18+
/// (such as <see cref="Storyboard"/>) that can be executed on a given element.
1319
/// </summary>
1420
public sealed class AnimationSet : DependencyObjectCollection
1521
{

components/Behaviors/src/Notification/StackedNotificationsBehavior.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace CommunityToolkit.WinUI.Behaviors;
1414

1515
/// <summary>
16-
/// A behavior to add the stacked notification support to <see cref="InfoBar"/>.
16+
/// A behavior to add the stacked notification support to <see cref="MUXC.InfoBar"/>.
1717
/// </summary>
1818
public class StackedNotificationsBehavior : BehaviorBase<MUXC.InfoBar>
1919
{

0 commit comments

Comments
 (0)