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

Use the new Maui P7 #1749

Merged
merged 17 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions VERSIONS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ System.IO.UnmanagedMemoryStream release 4.3.0
System.Drawing.Common release 4.5.1
SharpVk release 0.4.2
Uno.UI release 3.7.6
Microsoft.ProjectReunion release 0.8.0
Microsoft.ProjectReunion.Foundation release 0.8.0
Microsoft.ProjectReunion.WinUI release 0.8.0
Microsoft.ProjectReunion release 0.8.1
Microsoft.ProjectReunion.Foundation release 0.8.1
Microsoft.ProjectReunion.WinUI release 0.8.1
Microsoft.Maui.Graphics release 6.0.100-preview.5.246
Microsoft.Windows.SDK.NET.Ref release 10.0.18362.15

Expand Down
7 changes: 6 additions & 1 deletion cake/UtilsManaged.cake
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ IEnumerable<(DirectoryPath path, string platform)> GetPlatformDirectories(Direct
// try find any cross-platform frameworks
foreach (var dir in platformDirs) {
var d = dir.GetDirectoryName().ToLower();
if (d.StartsWith("netstandard") || d.StartsWith("portable")) {
if (d.StartsWith("netstandard") || d.StartsWith("portable") || d.Equals("net6.0")) {
// we just want this single platform
yield return (dir, null);
yield break;
Expand Down Expand Up @@ -306,6 +306,11 @@ async Task DownloadPackageAsync(string id, DirectoryPath outputDirectory)

Information($"Downloading '{currentId}' version '{currentVersion}'...");

if (currentId == "_nativeassets.maccatalyst") {
Warning($"Skipping '{currentId}' because we do not yet have this package working...");
return;
}

var root = await comparer.ExtractCachedPackageAsync(currentId, currentVersion);
var toolsDir = $"{root}/tools/";
if (DirectoryExists(toolsDir)) {
Expand Down
4 changes: 4 additions & 0 deletions nuget/SkiaSharp.Views.Maui.Controls.Compatibility.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<copyright>© Microsoft Corporation. All rights reserved.</copyright>

<dependencies>
<group targetFramework="net6.0">
<dependency id="SkiaSharp.Views.Maui.Controls" version="1.0.0" />
</group>
<group targetFramework="net6.0-ios13.6">
<dependency id="SkiaSharp.Views.Maui.Controls" version="1.0.0" />
</group>
Expand All @@ -45,6 +48,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<files>

<!-- SkiaSharp.Views.Maui.Controls.Compatibility.dll -->
<file platform="windows" src="lib/net6.0/SkiaSharp.Views.Maui.Controls.Compatibility.dll" />
<file platform="windows" src="lib/net6.0-android/SkiaSharp.Views.Maui.Controls.Compatibility.dll" target="lib/net6.0-android30.0/SkiaSharp.Views.Maui.Controls.Compatibility.dll" />
<file platform="windows" src="lib/net6.0-ios/SkiaSharp.Views.Maui.Controls.Compatibility.dll" target="lib/net6.0-ios13.6/SkiaSharp.Views.Maui.Controls.Compatibility.dll" />
<file platform="windows" src="lib/net6.0-maccatalyst/SkiaSharp.Views.Maui.Controls.Compatibility.dll" target="lib/net6.0-maccatalyst13.5/SkiaSharp.Views.Maui.Controls.Compatibility.dll" />
Expand Down
8 changes: 2 additions & 6 deletions nuget/SkiaSharp.Views.Maui.Controls.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<copyright>© Microsoft Corporation. All rights reserved.</copyright>

<dependencies>
<!-- <group targetFramework="netstandard2.0">
<group targetFramework="net6.0">
<dependency id="SkiaSharp.Views.Maui.Core" version="1.0.0" />
</group>
<group targetFramework="netstandard2.1">
<dependency id="SkiaSharp.Views.Maui.Core" version="1.0.0" />
</group> -->
<group targetFramework="net6.0-ios13.6">
<dependency id="SkiaSharp.Views.Maui.Core" version="1.0.0" />
</group>
Expand All @@ -51,8 +48,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<files>

<!-- SkiaSharp.Views.Maui.Controls.dll -->
<!-- <file platform="windows" src="lib/netstandard2.0/SkiaSharp.Views.Maui.Controls.dll" /> -->
<!-- <file platform="windows" src="lib/netstandard2.1/SkiaSharp.Views.Maui.Controls.dll" /> -->
<file platform="windows" src="lib/net6.0/SkiaSharp.Views.Maui.Controls.dll" />
<file platform="windows" src="lib/net6.0-android/SkiaSharp.Views.Maui.Controls.dll" target="lib/net6.0-android30.0/SkiaSharp.Views.Maui.Controls.dll" />
<file platform="windows" src="lib/net6.0-ios/SkiaSharp.Views.Maui.Controls.dll" target="lib/net6.0-ios13.6/SkiaSharp.Views.Maui.Controls.dll" />
<file platform="windows" src="lib/net6.0-maccatalyst/SkiaSharp.Views.Maui.Controls.dll" target="lib/net6.0-maccatalyst13.5/SkiaSharp.Views.Maui.Controls.dll" />
Expand Down
8 changes: 2 additions & 6 deletions nuget/SkiaSharp.Views.Maui.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<copyright>© Microsoft Corporation. All rights reserved.</copyright>

<dependencies>
<!-- <group targetFramework="netstandard2.0">
<group targetFramework="net6.0">
<dependency id="SkiaSharp" version="1.0.0" />
</group>
<group targetFramework="netstandard2.1">
<dependency id="SkiaSharp" version="1.0.0" />
</group> -->
<group targetFramework="net6.0-ios13.6">
<dependency id="SkiaSharp" version="1.0.0" />
<dependency id="SkiaSharp.Views" version="1.0.0" />
Expand All @@ -55,8 +52,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<files>

<!-- SkiaSharp.Views.Maui.Core.dll -->
<!-- <file platform="windows" src="lib/netstandard2.0/SkiaSharp.Views.Maui.Core.dll" /> -->
<!-- <file platform="windows" src="lib/netstandard2.1/SkiaSharp.Views.Maui.Core.dll" /> -->
<file platform="windows" src="lib/net6.0/SkiaSharp.Views.Maui.Core.dll" />
<file platform="windows" src="lib/net6.0-android/SkiaSharp.Views.Maui.Core.dll" target="lib/net6.0-android30.0/SkiaSharp.Views.Maui.Core.dll" />
<file platform="windows" src="lib/net6.0-ios/SkiaSharp.Views.Maui.Core.dll" target="lib/net6.0-ios13.6/SkiaSharp.Views.Maui.Core.dll" />
<file platform="windows" src="lib/net6.0-maccatalyst/SkiaSharp.Views.Maui.Core.dll" target="lib/net6.0-maccatalyst13.5/SkiaSharp.Views.Maui.Core.dll" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<RootNamespace>SkiaSharpSample</RootNamespace>
<UseMaui>true</UseMaui>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<LangVersion>9.0</LangVersion>

<!-- Required - Enable Single Project for WinUI -->
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
Expand All @@ -31,9 +32,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.1" />
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.1" />
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.1" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions samples/Basic/Maui/SkiaSharpSample/SkiaSharpSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ApplicationVersion>1.0</ApplicationVersion>
<AndroidVersionCode>1</AndroidVersionCode>
<UseMaui>true</UseMaui>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="[0.8.0]">
<PackageReference Include="Microsoft.ProjectReunion" Version="[0.8.1]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="[0.8.0]">
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="[0.8.1]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.1" />
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.1" />
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.1" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

Expand Down
10 changes: 10 additions & 0 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

<!-- Workaround: https://github.com/dotnet/sdk/issues/19050 -->
<PropertyGroup>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
</PropertyGroup>

<!-- Workaround: Use a slightly newer compiler for C# 9 support for the workaround above -->
<ItemGroup Condition=" '$(MSBuildVersion)' != '' AND '$(MSBuildVersion)' &lt; '16.7.0' AND '$(LangVersion)' != '' AND '$(LangVersion)' &gt; '8.0' ">
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.9.0" PrivateAssets="all" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion scripts/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ variables:
XCODE_VERSION: 12.4
DOTNET_VERSION_PREVIOUS: 3.1.410
DOTNET_VERSION: 5.0.301
DOTNET_VERSION_PREVIEW: 6.0.100-preview.7.21369.5
DOTNET_VERSION_PREVIEW: 6.0.100-preview.7.21377.3
VS_VERSION_PREVIEW: 16/pre
CONFIGURATION: 'Release'
VM_IMAGE_WINDOWS: windows-2019
Expand Down
5 changes: 2 additions & 3 deletions scripts/install-maui.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Param(
[string] $InstallDir,
[string] $Manifest
[string] $InstallDir
)

$ErrorActionPreference = 'Stop'
Expand All @@ -12,7 +11,7 @@ Write-Host "Installing maui-check..."

Write-Host "Installing Maui..."
& maui-check `
--preview `
--main `
--verbose --ci --fix --non-interactive `
--skip androidsdk `
--skip xcode `
Expand Down
14 changes: 14 additions & 0 deletions source/SkiaSharp.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,24 @@
<DefineConstants>$(DefineConstants);THROW_OBJECT_EXCEPTIONS</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
<DependsOnNETStandard>true</DependsOnNETStandard>
</PropertyGroup>

<!-- Workaround: https://github.com/dotnet/sdk/issues/19050 -->
<PropertyGroup>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
</PropertyGroup>

<!-- Workaround: Use a slightly newer compiler for C# 9 support for the workaround above -->
<ItemGroup Condition="'$(MSBuildVersion)' != '' AND '$(MSBuildVersion)' &lt; '16.7.0' ">
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.9.0" PrivateAssets="all" />
</ItemGroup>

<!-- workaround for conflict between WinUI and net6 https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1307712 -->
<PropertyGroup Condition="$(MSBuildProjectFile.EndsWith('.wapproj'))">
<SkipImportNetSdk>true</SkipImportNetSdk>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if !NETSTANDARD
using System;
using System.ComponentModel;

#if __MAUI__
Expand Down Expand Up @@ -298,3 +299,4 @@ private void OnGetCanvasSize(object sender, GetPropertyValueEventArgs<SKSize> e)
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !__GTK__ && !WINDOWS
#if !__GTK__ && !WINDOWS && !NETSTANDARD
using System;
using System.ComponentModel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static IAppHostBuilder UseSkiaSharpCompatibilityRenderers(this IAppHostBu
builder
.ConfigureMauiHandlers(handlers =>
{
#if !NETSTANDARD
handlers.AddCompatibilityRenderer(typeof(SKCanvasView), typeof(SKCanvasViewRenderer));
#if !WINDOWS
handlers.AddCompatibilityRenderer(typeof(SKGLView), typeof(SKGLViewRenderer));
Expand All @@ -19,6 +20,7 @@ public static IAppHostBuilder UseSkiaSharpCompatibilityRenderers(this IAppHostBu
CompatRegistrar.Registered.Register(typeof(SKBitmapImageSource), typeof(SKImageSourceHandler));
CompatRegistrar.Registered.Register(typeof(SKPixmapImageSource), typeof(SKImageSourceHandler));
CompatRegistrar.Registered.Register(typeof(SKPictureImageSource), typeof(SKImageSourceHandler));
#endif
});
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-ios;net6.0-maccatalyst;net6.0-android</TargetFrameworks>
<TargetFrameworks>net6.0;net6.0-ios;net6.0-maccatalyst;net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="$(IsWindows)">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
<PackagingGroup>SkiaSharp.Views.Maui.Controls.Compatibility</PackagingGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-ios;net6.0-maccatalyst;net6.0-android</TargetFrameworks>
<TargetFrameworks>net6.0;net6.0-ios;net6.0-maccatalyst;net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="$(IsWindows)">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
<PackagingGroup>SkiaSharp.Views.Maui.Controls</PackagingGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override void DisconnectHandler(SKCanvasView nativeView)

// Mapper actions / properties

public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView)
public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView, object? args)
{
handler.NativeView?.Invalidate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public static void MapIgnorePixelScaling(SKCanvasViewHandler handler, ISKCanvasV

public static void MapEnableTouchEvents(SKCanvasViewHandler handler, ISKCanvasView canvasView) { }

public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView) { }
public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView, object? args) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void DisconnectHandler(SKXamlCanvas nativeView)

// Mapper actions / properties

public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView)
public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView, object? args)
{
handler.NativeView?.Invalidate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ public partial class SKCanvasViewHandler
{
[nameof(ISKCanvasView.EnableTouchEvents)] = MapEnableTouchEvents,
[nameof(ISKCanvasView.IgnorePixelScaling)] = MapIgnorePixelScaling,
};

Actions =
{
[nameof(ISKCanvasView.InvalidateSurface)] = OnInvalidateSurface,
}
public static CommandMapper<ISKCanvasView, SKCanvasViewHandler> SKCanvasViewCommandMapper =
new CommandMapper<ISKCanvasView, SKCanvasViewHandler>()
{
[nameof(ISKCanvasView.InvalidateSurface)] = OnInvalidateSurface,
};

public SKCanvasViewHandler()
: base(SKCanvasViewMapper)
: base(SKCanvasViewMapper, SKCanvasViewCommandMapper)
{
}

public SKCanvasViewHandler(PropertyMapper? mapper)
: base(mapper ?? SKCanvasViewMapper)
public SKCanvasViewHandler(PropertyMapper? mapper, CommandMapper? commands)
: base(mapper ?? SKCanvasViewMapper, commands ?? SKCanvasViewCommandMapper)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override void DisconnectHandler(SKCanvasView nativeView)

// Mapper actions / properties

public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView)
public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView, object? args)
{
handler.NativeView?.SetNeedsDisplay();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-ios;net6.0-maccatalyst;net6.0-android</TargetFrameworks>
<TargetFrameworks>net6.0;net6.0-ios;net6.0-maccatalyst;net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="$(IsWindows)">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
<PackagingGroup>SkiaSharp.Views.Maui.Core</PackagingGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackagingGroup>SkiaSharp.Views.WinUI</PackagingGroup>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
Expand Down