Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Skia 3 Support #1340

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion build/workflow/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ variables:

IsCanaryBranch: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/canaries/')]
IsReleaseBranch: $[or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/feature/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'))]
XCODE_ROOT: '/Applications/Xcode_15.4.app'
XCODE_ROOT: '/Applications/Xcode_16.1.app'
XCODE_ROOT_UITESTS: '/Applications/Xcode_15.4.app'

stages:
- stage: Determine_Changes
Expand Down
9 changes: 8 additions & 1 deletion build/workflow/stage-build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ jobs:
- template: templates/canary-updater.yml
- template: templates/gitversion.yml
- template: templates/set-app-versions.yml
- template: templates/xcode-select.yml
parameters:
xCodeRoot: $(XCODE_ROOT)

- bash: |
cd $(build.sourcesdirectory)/samples/$(ProjectName)/$(ProjectName).Mobile
echo "BUILD_SOURCEBRANCH: $BUILD_SOURCEBRANCH"
dotnet publish -f net8.0-ios -c Release /p:ArchiveOnBuild=true "/p:InformationalVersion=%NBGV_InformationalVersion%" "/bl:$(build.artifactstagingdirectory)/toolkit-build-$(ArtifactName).binlog"
dotnet publish -f net8.0-ios -c Release /p:ArchiveOnBuild=true "/p:InformationalVersion=%NBGV_InformationalVersion%" /v:diag "/bl:$(build.artifactstagingdirectory)/toolkit-build-$(ArtifactName).binlog"
displayName: Build project for Release - (net8.0-ios)
condition: eq(variables['System.PullRequest.IsFork'],'False')

Expand Down Expand Up @@ -125,6 +128,10 @@ jobs:
- template: templates/dotnet-workload-install-mac.yml
- template: templates/canary-updater.yml

- template: templates/xcode-select.yml
parameters:
xCodeRoot: $(XCODE_ROOT)

- bash: |
chmod +x $(build.sourcesdirectory)/build/workflow/scripts/ios-uitest-build.sh
$(build.sourcesdirectory)/build/workflow/scripts/ios-uitest-build.sh
Expand Down
2 changes: 1 addition & 1 deletion build/workflow/stage-uitests-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

- template: templates/xcode-select.yml
parameters:
xCodeRoot: $(XCODE_ROOT)
xCodeRoot: $(XCODE_ROOT_UITESTS)

- bash: |
chmod +x $(build.sourcesdirectory)/build/workflow/scripts/ios-uitest-run.sh
Expand Down
4 changes: 2 additions & 2 deletions build/workflow/templates/dotnet-workload-install-mac.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parameters:
DotNetVersion: '8.0.301'
UnoCheck_Version: '1.23.0'
DotNetVersion: '9.0.101'
UnoCheck_Version: '1.28.3'
Dotnet_Root: '/usr/local/share/dotnet/'
Dotnet_Tools: '~/.dotnet/tools'

Expand Down
4 changes: 2 additions & 2 deletions build/workflow/templates/dotnet-workload-install-windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parameters:
DotNetVersion: '8.0.301'
UnoCheck_Version: '1.23.0'
DotNetVersion: '9.0.101'
UnoCheck_Version: '1.28.3'

steps:

Expand Down
4 changes: 1 addition & 3 deletions samples/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="5.0.1" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.2.221109.1" />
<PackageVersion Include="SkiaSharp.Skottie" Version="2.88.6" />
<PackageVersion Include="SkiaSharp.Views" Version="2.88.6" />
<PackageVersion Include="SkiaSharp.Views.Uno" Version="2.88.6" />
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.6" />
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="3.116.1" />
<PackageVersion Include="Uno.Core.Extensions.Compatibility" Version="4.0.1" />
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
<PackageVersion Include="Uno.Cupertino" Version="5.3.0-dev.4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<RuntimeIdentifier Condition="'$(TargetFramework)' == 'net8.0-maccatalyst'">maccatalyst-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetFramework)' == 'net8.0-macos'">osx-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="SkiaSharp.Skottie" Version="2.88.6" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<Content Include="Assets\Fonts\Material\Roboto-Medium.ttf" />
<Content Include="Assets\Fonts\Material\Roboto-Regular.ttf" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="SkiaSharp.Skottie" Version="2.88.6" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
<!-- Required for C# Hot Reload -->
<UseInterpreter Condition="'$(Configuration)' == 'Debug' and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'maccatalyst'">True</UseInterpreter>
<IsUnoHead>true</IsUnoHead>

<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net8.0-ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net8.0-maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net8.0-android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)'=='net8.0-macos'">10.14</SupportedOSPlatformVersion>
<DefineConstants>$(DefineConstants);IS_WINUI</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug' or '$(IsUiAutomationMappingEnabled)'=='True'">
Expand All @@ -32,7 +35,9 @@
<RuntimeIdentifier Condition="'$(TargetFramework)' == 'net8.0-maccatalyst'">maccatalyst-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetFramework)' == 'net8.0-macos'">osx-x64</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="SkiaSharp.Skottie" Version="3.116.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<OutputType Condition="'$(Configuration)'=='Release'">WinExe</OutputType>
<OutputType Condition="'$(Configuration)'=='Debug'">Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>

</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);IS_WINUI</DefineConstants>
Expand All @@ -15,6 +14,9 @@
<ItemGroup>
<UpToDateCheckInput Include="..\Uno.Toolkit.WinUI.Samples.Shared\**\*.xaml" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="SkiaSharp.Skottie" Version="3.116.1" />
</ItemGroup>
<ItemGroup>
<None Remove="Assets\Fonts\Cupertino\SF-Pro.ttf" />
<None Remove="Assets\Fonts\Material\Roboto-Light.ttf" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Uno.Extensions;
using Uno.Logging;
using Windows.UI;
using Uno.Toolkit.Skia.WinUI;

namespace Uno.Toolkit.UI;

Expand Down Expand Up @@ -207,7 +208,7 @@ public override void DrawDropShadow(ShadowPaintState state, SKCanvas canvas, SKP

paint.Style = SKPaintStyle.Fill;
paint.Color = shadow.GetSKColor();
paint.ImageFilter = SKImageFilter.CreateBlur(blurSigma, blurSigma);
paint.ImageFilter = SkiaCompat.SKImageFilter_CreateBlur(blurSigma, blurSigma);
paint.MaskFilter = null;
paint.StrokeWidth = 0;

Expand Down
28 changes: 28 additions & 0 deletions src/Uno.Toolkit.Skia.WinUI/SkiaCompact.skia.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#nullable enable

using System;
using System.Runtime.CompilerServices;
using SkiaSharp;
using static SkiaSharp.SKImageFilter;

namespace Uno.Toolkit.Skia.WinUI;

internal static class SkiaCompat
{
private static readonly bool _isSkiaSharp3OrLater = typeof(SKPaint).Assembly.GetName().Version?.Major >= 3;

internal static SKImageFilter SKImageFilter_CreateBlur(float sigmaX, float sigmaY)
{
if (!_isSkiaSharp3OrLater)
{
[MethodImpl(MethodImplOptions.NoInlining)]
SKImageFilter Legacy() => SKImageFilter.CreateBlur(sigmaX, sigmaY);
return Legacy();
}

return SKImageFilter_CreateBlur(null, sigmaX, sigmaY);
}

[UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "CreateBlur")]
private static extern SKImageFilter SKImageFilter_CreateBlur(SKImageFilter? _, float sigmaX, float sigmaY);
}
Loading