diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32b857d4f..2f277f7e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,7 +67,7 @@ jobs: fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion. matrix: winui: [2, 3] - multitarget: ['uwp', 'wasdk', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android'] + multitarget: ['uwp', 'wasdk', 'wasm', 'unosdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android'] exclude: # WinUI 2 not supported on wasdk - winui: 2 @@ -75,6 +75,12 @@ jobs: # WinUI 3 not supported on uwp - winui: 3 multitarget: uwp + # WinUI 3 wasm is covered by the Uno.Sdk head (unosdk) + - winui: 3 + multitarget: wasm + # Uno.Sdk head is WinUI 3 only + - winui: 2 + multitarget: unosdk # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -112,9 +118,9 @@ jobs: run: dotnet tool restore - name: Run Uno Check to Install Dependencies - if: ${{ matrix.multitarget != 'wasdk' && matrix.multitarget != 'linuxgtk' && matrix.multitarget != 'wpf' }} + if: ${{ matrix.multitarget != 'wasdk' && matrix.multitarget != 'linuxgtk' && matrix.multitarget != 'wpf' && matrix.multitarget != 'unosdk' }} run: > - dotnet tool run uno-check + dotnet tool run uno-check --ci --target ${{ matrix.multitarget }} --fix @@ -125,6 +131,12 @@ jobs: --skip vswin --verbose + # The Uno.Sdk head builds desktop/browserwasm/android (iOS is filtered on + # Windows). Install the matching workloads directly instead of uno-check. + - name: Install .NET workloads (Uno.Sdk head) + if: ${{ matrix.multitarget == 'unosdk' }} + run: dotnet workload install wasm-tools android ios maui + - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 with: @@ -132,11 +144,19 @@ jobs: # Generate full solution with all projects (sample gallery heads, components, tests) - name: Generate solution with ${{ matrix.multitarget }} gallery, components and tests + if: ${{ matrix.multitarget != 'unosdk' }} working-directory: ./ run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -WinUIMajorVersion ${{ matrix.winui }}" -ErrorAction Stop + # The Uno.Sdk head covers wasm (browserwasm) for WinUI 3; generate with it included + - name: Generate solution with Uno.Sdk gallery, components and tests + if: ${{ matrix.multitarget == 'unosdk' }} + working-directory: ./ + run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets wasm -IncludeUnoSdkHead -WinUIMajorVersion 3${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" -ErrorAction Stop + # Build solution - name: MSBuild + if: ${{ matrix.multitarget != 'unosdk' }} run: > msbuild.exe /restore /nowarn:MSB4011 /p:Configuration=Release @@ -145,6 +165,12 @@ jobs: /v:${{ env.MSBUILD_VERBOSITY }} CommunityToolkit.AllComponents.sln + # The Uno.Sdk head is a single project covering desktop/browserwasm/android + # (iOS is filtered on Windows); build it directly with dotnet. + - name: Build Uno.Sdk head + if: ${{ matrix.multitarget == 'unosdk' }} + run: dotnet build tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj -p:Configuration=Release ${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }} + # Run tests - name: Setup VSTest Path uses: darenm/setup-vstest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 @@ -424,7 +450,7 @@ jobs: --api-key ${{ secrets.NUGET_PACKAGE_PUSH_TOKEN }} --skip-duplicate - wasm-linux: + uno-linux: runs-on: ubuntu-latest steps: @@ -439,6 +465,12 @@ jobs: with: global-json-file: global.json + # iOS/maccatalyst aren't installable on Linux (Uno.Sdk filters those TFMs + # there). android + wasm-tools are both required: even a single-TFM build + # restores all of the head's TargetFrameworks, validating net9.0-android. + - name: Install .NET workloads + run: dotnet workload install android wasm-tools + - name: .NET Info (if diagnostics) if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} run: dotnet --info @@ -447,31 +479,26 @@ jobs: - name: Restore dotnet tools run: dotnet tool restore - - name: Enable WASM TargetFrameworks - shell: pwsh - working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }} - run: ./UseTargetFrameworks.ps1 wasm - + # Generate the full solution with the Uno.Sdk gallery head, components and tests - name: Generate solution shell: pwsh working-directory: ./ - run: ./tooling/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} + run: ./tooling/GenerateAllSolution.ps1 -MultiTargets wasm -IncludeUnoSdkHead -WinUIMajorVersion 3${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} - - name: Install ninja for WASM native dependencies - run: sudo apt-get install ninja-build + - name: Build Uno head (browserwasm) + shell: pwsh + working-directory: ./ + run: dotnet build tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj -f net9.0-browserwasm -p:Configuration=Release - # Issue with Comment Links currently, see: https://github.com/mrlacey/CommentLinks/issues/38 - # 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 -v:${{ env.MSBUILD_VERBOSITY }} - - # TODO: Do we want to run tests here? Can we do that on linux easily? + - name: Build Uno head (desktop) + shell: pwsh + working-directory: ./ + run: dotnet build tooling/ProjectHeads/AllComponents/Uno/CommunityToolkit.App.Uno.csproj -f net9.0-desktop -p:Configuration=Release - name: Artifact - Diagnostic Logs uses: actions/upload-artifact@v4 if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} with: - name: linux-logs + name: uno-linux-logs path: ./**/*.*log diff --git a/components/Animations/src/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs b/components/Animations/src/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs index cc98af6e0..12e845e8d 100644 --- a/components/Animations/src/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs +++ b/components/Animations/src/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs @@ -30,11 +30,14 @@ public TValue? To /// /// Identifies the dependency property. /// + // typeof(TValue?) is only used as dependency property metadata, not for reflective construction. +#pragma warning disable IL2087 public static readonly DependencyProperty ToProperty = DependencyProperty.Register( nameof(To), typeof(TValue?), typeof(Animation), new PropertyMetadata(null)); +#pragma warning restore IL2087 /// /// Gets or sets the optional starting value for the animation. @@ -48,11 +51,14 @@ public TValue? From /// /// Identifies the dependency property. /// + // typeof(TValue?) is only used as dependency property metadata, not for reflective construction. +#pragma warning disable IL2087 public static readonly DependencyProperty FromProperty = DependencyProperty.Register( nameof(From), typeof(TValue?), typeof(Animation), new PropertyMetadata(null)); +#pragma warning restore IL2087 /// /// Gets or sets the optional keyframe collection for the current animation. diff --git a/components/Animations/src/Xaml/Abstract/KeyFrame{TValue,TKeyFrame}.cs b/components/Animations/src/Xaml/Abstract/KeyFrame{TValue,TKeyFrame}.cs index ea5627cec..fbe2fadaa 100644 --- a/components/Animations/src/Xaml/Abstract/KeyFrame{TValue,TKeyFrame}.cs +++ b/components/Animations/src/Xaml/Abstract/KeyFrame{TValue,TKeyFrame}.cs @@ -60,11 +60,14 @@ public TValue? Value /// /// Identifies the dependency property. /// + // typeof(TValue?) is only used as dependency property metadata, not for reflective construction. +#pragma warning disable IL2087 public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( nameof(Value), typeof(TValue?), typeof(KeyFrame), new PropertyMetadata(null)); +#pragma warning restore IL2087 /// /// Gets or sets the optional expression for the current keyframe. diff --git a/components/Behaviors/src/Headers/HeaderBehaviorBase.cs b/components/Behaviors/src/Headers/HeaderBehaviorBase.cs index 57b1c3756..e1eccdf06 100644 --- a/components/Behaviors/src/Headers/HeaderBehaviorBase.cs +++ b/components/Behaviors/src/Headers/HeaderBehaviorBase.cs @@ -184,7 +184,10 @@ private void ScrollViewer_GotFocus(object sender, RoutedEventArgs e) } else { + // Obsolete on WinUI 3/Uno, but required as a fallback where XamlRoot is unavailable (e.g. UWP). +#pragma warning disable CS0618 focusedElement = FocusManager.GetFocusedElement()!; +#pragma warning restore CS0618 } // To prevent Popups (Flyouts...) from triggering the autoscroll, we check if the focused element has a valid parent. diff --git a/components/DeveloperTools/src/FocusTracker/FocusTracker.cs b/components/DeveloperTools/src/FocusTracker/FocusTracker.cs index 39feacb29..c41c3496a 100644 --- a/components/DeveloperTools/src/FocusTracker/FocusTracker.cs +++ b/components/DeveloperTools/src/FocusTracker/FocusTracker.cs @@ -83,7 +83,10 @@ private void Start() } else { + // Obsolete on WinUI 3/Uno, but required as a fallback where XamlRoot is unavailable (e.g. UWP). +#pragma warning disable CS0618 if (FocusManager.GetFocusedElement() is FrameworkElement element) +#pragma warning restore CS0618 { FocusOnControl(element); } diff --git a/components/Segmented/src/Segmented/Segmented.cs b/components/Segmented/src/Segmented/Segmented.cs index 6fbc6c301..ff85cb42e 100644 --- a/components/Segmented/src/Segmented/Segmented.cs +++ b/components/Segmented/src/Segmented/Segmented.cs @@ -116,7 +116,10 @@ private bool MoveFocus(int adjustment) } else { + // Obsolete on WinUI 3/Uno, but required as a fallback where XamlRoot is unavailable (e.g. UWP). +#pragma warning disable CS0618 return FocusManager.GetFocusedElement() as SegmentedItem; +#pragma warning restore CS0618 } } diff --git a/components/SettingsControls/src/SettingsCard/SettingsCard.cs b/components/SettingsControls/src/SettingsCard/SettingsCard.cs index ef1d4a09e..02ecd2358 100644 --- a/components/SettingsControls/src/SettingsCard/SettingsCard.cs +++ b/components/SettingsControls/src/SettingsCard/SettingsCard.cs @@ -322,7 +322,10 @@ private void CheckVerticalSpacingState(VisualState s) } else { + // Obsolete on WinUI 3/Uno, but required as a fallback where XamlRoot is unavailable (e.g. UWP). +#pragma warning disable CS0618 return FocusManager.GetFocusedElement() as FrameworkElement; +#pragma warning restore CS0618 } } diff --git a/components/TokenizingTextBox/src/TokenizingTextBox.Selection.cs b/components/TokenizingTextBox/src/TokenizingTextBox.Selection.cs index 0b20a6fee..b13a21c28 100644 --- a/components/TokenizingTextBox/src/TokenizingTextBox.Selection.cs +++ b/components/TokenizingTextBox/src/TokenizingTextBox.Selection.cs @@ -141,7 +141,10 @@ private bool MoveFocusAndSelection(MoveDirection direction) } else { + // Obsolete on WinUI 3/Uno, but required as a fallback where XamlRoot is unavailable (e.g. UWP). +#pragma warning disable CS0618 return FocusManager.GetFocusedElement() as TokenizingTextBoxItem; +#pragma warning restore CS0618 } } diff --git a/components/TokenizingTextBox/src/TokenizingTextBox.cs b/components/TokenizingTextBox/src/TokenizingTextBox.cs index db1dd0122..ea48b3eb1 100644 --- a/components/TokenizingTextBox/src/TokenizingTextBox.cs +++ b/components/TokenizingTextBox/src/TokenizingTextBox.cs @@ -361,7 +361,10 @@ private object GetFocusedElement() } else { + // Obsolete on WinUI 3/Uno, but required as a fallback where XamlRoot is unavailable (e.g. UWP). +#pragma warning disable CS0618 return FocusManager.GetFocusedElement()!; +#pragma warning restore CS0618 } } diff --git a/tooling b/tooling index 394263e10..ded6698f1 160000 --- a/tooling +++ b/tooling @@ -1 +1 @@ -Subproject commit 394263e1054cac12c5feb49ae2458f5e13681a68 +Subproject commit ded6698f1c9aedc8d0228c52c3ed520b4b3b4134