Skip to content

Commit

Permalink
Upgrade to .NET 7, enable WASM optimizations (#173)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Arlodotexe and michael-hawker authored Aug 17, 2023
1 parent 819071d commit 58cdd50
Show file tree
Hide file tree
Showing 25 changed files with 72 additions and 47 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.13.0",
"commands": [
"uno-check"
]
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -434,4 +434,4 @@ csharp_style_prefer_extended_property_pattern = true:suggestion
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
dotnet_code_quality.CA1001.excluded_type_names_with_derived_types = T:Windows.UI.Xaml.Media.Animation.Storyboard
26 changes: 13 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ on:
merge_group:

env:
DOTNET_VERSION: ${{ '7.0.x' }}
DOTNET_VERSION: ${{ '7.0.100' }}
ENABLE_DIAGNOSTICS: true
MSBUILD_VERBOSITY: normal
#COREHOST_TRACE: 1
COREHOST_TRACEFILE: corehosttrace.log
MULTI_TARGET_DIRECTORY: tooling/MultiTarget
Expand Down Expand Up @@ -65,6 +66,7 @@ jobs:
# faux-ternary expression to select which platforms to build for each platform vs. duplicating step below.
TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all' || 'all-uwp' }}
TEST_PLATFORM: ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }}
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) }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -104,7 +106,7 @@ 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 @@ -122,27 +124,25 @@ jobs:
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
if: ${{ matrix.platform == 'WinUI3' }}

- name: MSBuild (With diagnostics)
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m /bl -v:diag

- name: MSBuild
if: ${{ env.ENABLE_DIAGNOSTICS == 'false' }}
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m
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 }}

# Build All Packages
- name: pack experiments
working-directory: ./tooling/Scripts/
run: ./PackEachExperiment.ps1 all
run: ./PackEachExperiment.ps1 -extraBuildProperties "${{ env.VERSION_PROPERTY }}"

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

- name: Add source (pull requests)
if: ${{ github.ref != 'refs/heads/main' }}
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 }}

- name: Push packages
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source MainLatest --skip-duplicate
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source ${{ github.ref == 'refs/heads/main' && 'MainLatest' || 'PullRequests' }} --skip-duplicate

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

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

Expand Down
10 changes: 5 additions & 5 deletions components/Animations/src/ConnectedAnimations/Connected.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ public static void SetAnchorElement(DependencyObject obj, UIElement value)
/// <summary>
/// Gets the connected animation key associated with the ListViewBase item being animated
/// </summary>
/// <param name="obj">The <see cref="Windows.UI.Xaml.Controls.ListViewBase"/></param>
/// <param name="obj">The <see cref="ListViewBase"/></param>
/// <returns>The connected animation key</returns>
public static string GetListItemKey(DependencyObject obj)
{
return (string)obj.GetValue(ListItemKeyProperty);
}

/// <summary>
/// Sets the connected animation key for the <see cref="Windows.UI.Xaml.Controls.ListViewBase"/> item being animated
/// Sets the connected animation key for the <see cref="ListViewBase"/> item being animated
/// </summary>
/// <param name="obj">The <see cref="Windows.UI.Xaml.Controls.ListViewBase"/></param>
/// <param name="obj">The <see cref="ListViewBase"/></param>
/// <param name="value">The connected animation key</param>
public static void SetListItemKey(DependencyObject obj, string value)
{
Expand All @@ -73,7 +73,7 @@ public static void SetListItemKey(DependencyObject obj, string value)
/// <summary>
/// Gets the name of the element in the <see cref="DataTemplate"/> that is animated
/// </summary>
/// <param name="obj">The <see cref="Windows.UI.Xaml.Controls.ListViewBase"/></param>
/// <param name="obj">The <see cref="ListViewBase"/></param>
/// <returns>The name of the element being animated</returns>
public static string GetListItemElementName(DependencyObject obj)
{
Expand All @@ -83,7 +83,7 @@ public static string GetListItemElementName(DependencyObject obj)
/// <summary>
/// Sets the name of the element in the <see cref="DataTemplate"/> that is animated
/// </summary>
/// <param name="obj">The <see cref="Windows.UI.Xaml.Controls.ListViewBase"/></param>
/// <param name="obj">The <see cref="ListViewBase"/></param>
/// <param name="value">The name of the element to animate</param>
public static void SetListItemElementName(DependencyObject obj, string value)
{
Expand Down
14 changes: 11 additions & 3 deletions components/Animations/src/Enums/FrameworkLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINUI2
using Composition = Windows.UI.Composition;
using Animation = Windows.UI.Xaml.Media.Animation;
#elif WINUI3
using Composition = Microsoft.UI.Composition;
using Animation = Microsoft.UI.Xaml.Media.Animation;
#endif

namespace CommunityToolkit.WinUI.Animations;

/// <summary>
Expand All @@ -10,12 +18,12 @@ namespace CommunityToolkit.WinUI.Animations;
public enum FrameworkLayer
{
/// <summary>
/// Indicates the <see cref="Windows.UI.Composition"/> APIs.
/// Indicates the <see cref="Composition"/> APIs.
/// </summary>
Composition,

/// <summary>
/// Indicates the <see cref="Windows.UI.Xaml.Media.Animation"/> APIs.
/// Indicates the <see cref="Animation"/> APIs.
/// </summary>
Xaml
}
6 changes: 6 additions & 0 deletions components/Animations/src/Enums/VisualProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

namespace CommunityToolkit.WinUI.Animations;

#if WINUI2
using Windows.UI.Composition;
#else
using Microsoft.UI.Composition;
#endif

/// <summary>
/// Indicates a property of a <see cref="Visual"/> object.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace CommunityToolkit.WinUI.Animations.Expressions;
/// <summary>
/// Class AmbientLightReferenceNode. This class cannot be inherited.
/// </summary>
/// <seealso cref="Microsoft.Toolkit.Uwp.UI.Animations.Expressions.ReferenceNode" />
/// <seealso cref="ReferenceNode" />
public sealed class AmbientLightReferenceNode : ReferenceNode
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public abstract class CustomAnimation<TValue, TKeyFrame> : ImplicitAnimation<TVa
/// </summary>
public string? Target { get; set; }


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

/// <inheritdoc/>
Expand Down
8 changes: 7 additions & 1 deletion components/Animations/src/Xaml/AnimationSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;

#if WINUI2
using Windows.UI.Xaml.Media.Animation;
#else
using Microsoft.UI.Xaml.Media.Animation;
#endif

namespace CommunityToolkit.WinUI.Animations;

/// <summary>
/// A collection of animations that can be grouped together. This type represents a composite animation
/// (such as <see cref="Windows.UI.Xaml.Media.Animation.Storyboard"/>) that can be executed on a given element.
/// (such as <see cref="Storyboard"/>) that can be executed on a given element.
/// </summary>
public sealed class AnimationSet : DependencyObjectCollection
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace CommunityToolkit.WinUI.Behaviors;

/// <summary>
/// A behavior to add the stacked notification support to <see cref="InfoBar"/>.
/// A behavior to add the stacked notification support to <see cref="MUXC.InfoBar"/>.
/// </summary>
public class StackedNotificationsBehavior : BehaviorBase<MUXC.InfoBar>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void Add_Click(object sender, RoutedEventArgs e)
}

/// <summary>
/// A sample class used to show how to use the <see cref="Collections.IIncrementalSource{TSource}"/> interface.
/// A sample class used to show how to use the <see cref="IIncrementalSource{TSource}"/> interface.
/// </summary>
public class Person
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ private async void RefreshCollection(object sender, RoutedEventArgs e)
}

/// <summary>
/// A sample implementation of the <see cref="Collections.IIncrementalSource{TSource}"/> interface.
/// A sample implementation of the <see cref="IIncrementalSource{TSource}"/> interface.
/// </summary>
/// <seealso cref="Collections.IIncrementalSource{TSource}"/>
/// <seealso cref="IIncrementalSource{TSource}"/>
public class PeopleSource : IIncrementalSource<Person>
{
private readonly List<Person> _people;
Expand Down Expand Up @@ -92,7 +92,7 @@ public PeopleSource()
}

/// <summary>
/// A sample class used to show how to use the <see cref="Collections.IIncrementalSource{TSource}"/> interface.
/// A sample class used to show how to use the <see cref="IIncrementalSource{TSource}"/> interface.
/// </summary>
public class Person
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace CommunityToolkit.WinUI.Converters;

/// <summary>
/// Converts a file size in bytes to a more human-readable friendly format using <see cref="Toolkit.Converters.ToFileSizeString(long)"/>
/// Converts a file size in bytes to a more human-readable friendly format using <see cref="CommunityToolkit.Common.Converters.ToFileSizeString(long)"/>
/// </summary>
public class FileSizeToFriendlyStringConverter : IValueConverter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace CommunityToolkit.WinUI;

/// <summary>
/// Provides attached dependency properties for the <see cref="Microsoft.UI.Xaml.FrameworkElement"/> type.
/// Provides attached dependency properties for the <see cref="FrameworkElement"/> type.
/// </summary>
public static partial class FrameworkElementExtensions
{
/// <summary>
/// Attached <see cref="DependencyProperty"/> for enabling actual size binding on any <see cref="Microsoft.UI.Xaml.FrameworkElement"/>.
/// Attached <see cref="DependencyProperty"/> for enabling actual size binding on any <see cref="FrameworkElement"/>.
/// </summary>
public static readonly DependencyProperty EnableActualSizeBindingProperty = DependencyProperty.RegisterAttached("EnableActualSizeBinding", typeof(bool), typeof(FrameworkElementExtensions), new PropertyMetadata(false, OnEnableActualSizeBindingPropertyChanged));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public static partial class FrameworkElementExtensions
new() { { CursorShape.Arrow, _defaultCursor } };

/// <summary>
/// Dependency property for specifying the target <see cref="InputSystemCursorShape"/> to be shown
/// Dependency property for specifying the target <see cref="CursorShape"/> to be shown
/// over the target <see cref="FrameworkElement"/>.
/// </summary>
public static readonly DependencyProperty CursorProperty =
DependencyProperty.RegisterAttached("Cursor", typeof(CursorShape), typeof(FrameworkElementExtensions), new PropertyMetadata(CursorShape.Arrow, CursorChanged));

/// <summary>
/// Set the target <see cref="InputSystemCursorShape"/>.
/// Set the target <see cref="CursorShape"/>.
/// </summary>
/// <param name="element">Object where the selector cursor type should be shown.</param>
/// <param name="value">Target cursor type value.</param>
Expand All @@ -49,7 +49,7 @@ public static void SetCursor(FrameworkElement element, CursorShape value)
}

/// <summary>
/// Get the current <see cref="InputSystemCursorShape"/>.
/// Get the current <see cref="CursorShape"/>.
/// </summary>
/// <param name="element">Object where the selector cursor type should be shown.</param>
/// <returns>Cursor type set on target element.</returns>
Expand Down
2 changes: 1 addition & 1 deletion components/Extensions/src/Element/UIElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace CommunityToolkit.WinUI;

/// <summary>
/// Provides attached dependency properties for the <see cref="Microsoft.UI.Xaml.UIElement"/>
/// Provides attached dependency properties for the <see cref="UIElement"/>
/// </summary>
public static class UIElementExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion components/Extensions/src/Markup/SymbolIconExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace CommunityToolkit.WinUI;
public class SymbolIconExtension : TextIconExtension
{
/// <summary>
/// Gets or sets the <see cref="Microsoft.UI.Xaml.Controls.Symbol"/> value representing the icon to display.
/// Gets or sets the <see cref="Symbol"/> value representing the icon to display.
/// </summary>
public Symbol Symbol { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace CommunityToolkit.WinUI;
public class SymbolIconSourceExtension : TextIconExtension
{
/// <summary>
/// Gets or sets the <see cref="Microsoft.UI.Xaml.Controls.Symbol"/> value representing the icon to display.
/// Gets or sets the <see cref="Symbol"/> value representing the icon to display.
/// </summary>
public Symbol Symbol { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion components/Extensions/src/Shadows/AttachedShadowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract partial class AttachedShadowBase : DependencyObject, IAttachedSh
/// <summary>
/// Gets a value indicating whether or not Composition's VisualSurface is supported.
/// </summary>
protected static readonly bool SupportsCompositionVisualSurface = ApiInformation.IsTypePresent(typeof(CompositionVisualSurface).FullName);
protected static readonly bool SupportsCompositionVisualSurface = typeof(CompositionVisualSurface).FullName is string str && ApiInformation.IsTypePresent(str);
#endif

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion components/Extensions/src/Shadows/IAttachedShadow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface IAttachedShadow
double Opacity { get; set; }

/// <summary>
/// Gets or sets the offset of the shadow as a string representation of a <see cref="Vector3"/>.
/// Gets or sets the offset of the shadow as a string representation of a <see cref="System.Numerics.Vector3"/>.
/// </summary>
string Offset { get; set; }

Expand Down
5 changes: 3 additions & 2 deletions components/Helpers/samples/CameraHelperSample.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Windows.Media;
using Windows.Media.Capture.Frames;
using Windows.ApplicationModel;

#if WINAPPSDK
using Microsoft.UI.Xaml.Media.Imaging;
#else
Expand Down Expand Up @@ -62,7 +63,7 @@ private void Setup()
#endif
}

private async void Application_Suspending(object sender, SuspendingEventArgs e)
private async void Application_Suspending(object? sender, SuspendingEventArgs e)
{
if (IsLoaded)
{
Expand All @@ -72,7 +73,7 @@ private async void Application_Suspending(object sender, SuspendingEventArgs e)
}
}

private async void Application_Resuming(object sender, object e)
private async void Application_Resuming(object? sender, object e)
{
await InitializeAsync();
}
Expand Down
2 changes: 1 addition & 1 deletion components/Primitives/src/WrapPanel/StretchChild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace CommunityToolkit.WinUI.Controls;

/// <summary>
/// Options for how to calculate the layout of <see cref="Microsoft.UI.Xaml.Controls.WrapGrid"/> items.
/// Options for how to calculate the layout of <see cref="WrapGrid"/> items.
/// </summary>
public enum StretchChild
{
Expand Down
2 changes: 1 addition & 1 deletion components/Sizers/src/SizerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace CommunityToolkit.WinUI.Controls;

/// <summary>
/// Base class for splitting/resizing type controls like <see cref="GridSplitter"/> and <see cref="ContentSizer"/>. Acts similar to an enlarged <see cref="Windows.UI.Xaml.Controls.Primitives.Thumb"/> type control, but with keyboard support. Subclasses should override the various abstract methods here to implement their behavior.
/// Base class for splitting/resizing type controls like <see cref="GridSplitter"/> and <see cref="ContentSizer"/>. Acts similar to an enlarged <see cref="Thumb"/> type control, but with keyboard support. Subclasses should override the various abstract methods here to implement their behavior.
/// </summary>

[TemplateVisualState(Name = NormalState, GroupName = CommonStates)]
Expand Down
Loading

0 comments on commit 58cdd50

Please sign in to comment.