Update MAUI to RC 1 and use a macOS Monterey pool (#1986)

This commit is contained in:
Matthew Leibowitz 2022-04-13 10:28:03 +02:00 коммит произвёл GitHub
Родитель b7728fae36
Коммит 486317a7d5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
21 изменённых файлов: 99 добавлений и 54 удалений

Просмотреть файл

@ -31,6 +31,10 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<dependency id="SkiaSharp" version="1.0.0" />
<dependency id="Microsoft.WindowsAppSDK" version="1.0.0" />
</group>
<group targetFramework="net6.0-windows10.0.18362">
<dependency id="SkiaSharp" version="1.0.0" />
<dependency id="Microsoft.WindowsAppSDK" version="1.0.0" />
</group>
</dependencies>
</metadata>
@ -40,6 +44,9 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<file platform="windows" src="lib/net5.0-windows10.0.18362/SkiaSharp.Views.Windows.dll" />
<file platform="windows" src="lib/net5.0-windows10.0.18362/SkiaSharp.Views.Windows.pdb" />
<file platform="windows" src="lib/net5.0-windows10.0.18362/SkiaSharp.Views.Windows.xml" />
<file platform="windows" src="lib/net6.0-windows10.0.18362/SkiaSharp.Views.Windows.dll" />
<file platform="windows" src="lib/net6.0-windows10.0.18362/SkiaSharp.Views.Windows.pdb" />
<file platform="windows" src="lib/net6.0-windows10.0.18362/SkiaSharp.Views.Windows.xml" />
<!-- legal -->
<file src="LICENSE.txt" />

Просмотреть файл

@ -2,6 +2,7 @@
using Microsoft.Maui.Hosting;
using Microsoft.Maui.Controls.Hosting;
using SkiaSharp.Views.Maui.Controls.Hosting;
using Microsoft.Maui.Controls.Compatibility.Hosting;
namespace SkiaSharpSample
{

Просмотреть файл

@ -12,12 +12,5 @@ namespace SkiaSharpSample.WinUI
}
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
base.OnLaunched(args);
Microsoft.Maui.Essentials.Platform.OnLaunched(args);
}
}
}

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net6.0-ios;net6.0-maccatalyst;net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
@ -18,7 +18,7 @@
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.18362.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
@ -37,11 +37,6 @@
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls\SkiaSharp.Views.Maui.Controls.csproj" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<None Include="..\..\..\..\output\native\windows\x64\libSkiaSharp.dll" Condition="Exists('..\..\..\..\output\native\windows\x64\libSkiaSharp.dll')">
<Link>libSkiaSharp.dll</Link>
@ -49,11 +44,6 @@
</None>
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>
<Import Project="..\..\..\..\output\SkiaSharp\nuget\build\$(TargetFramework)\SkiaSharp.Local.targets" Condition="Exists('..\..\..\..\output\SkiaSharp\nuget\build\$(TargetFramework)\SkiaSharp.Local.targets')" />
</Project>

Просмотреть файл

@ -13,9 +13,9 @@ variables:
MONO_VERSION_MACOS: '6_12_13'
MONO_VERSION_LINUX: ''
XCODE_VERSION: 13.2.1
VISUAL_STUDIO_VERSION: ''
DOTNET_VERSION_PREVIEW: '6.0.200-rtm.22107.3'
DOTNET_WORKLOAD_SOURCE: 'https://aka.ms/dotnet/maui/6.0.200/preview.14.json'
VISUAL_STUDIO_VERSION: '17/pre'
DOTNET_VERSION_PREVIEW: '6.0.300-preview.22179.2'
DOTNET_WORKLOAD_SOURCE: 'https://aka.ms/dotnet/maui/6.0.300/rc.1.json'
CONFIGURATION: 'Release'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
THROW_ON_TEST_FAILURE: true

Просмотреть файл

@ -19,12 +19,33 @@ parameters:
pool:
name: Azure Pipelines
vmImage: windows-2022
- name: VM_IMAGE_MAC
- name: VM_IMAGE_MAC_NATIVE
type: object
default:
pool:
name: Azure Pipelines
vmImage: macos-11
- name: VM_IMAGE_MAC
type: object
default:
pool:
name: VSEng-VSMac-Xamarin-Shared
vmImage: VSEng-VSMac-Xamarin-Shared
demands:
- macOS.Name -equals Monterey
- macOS.Architecture -equals x64
- Agent.HasDevices -equals False
- Agent.IsPaired -equals False
variables:
XCODE_VERSION: 13.3.0
provisioningSteps:
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provision Xamarin'
inputs:
provisioning_script: ./scripts/provisionator.csx
provisioning_extra_args: --force
env:
AUTH_TOKEN_GITHUB_COM: $(github--pat--vs-mobiletools-engineering-service2)
- name: VM_IMAGE_LINUX
type: object
default:
@ -51,6 +72,6 @@ stages:
VM_IMAGE_WINDOWS: ${{ parameters.VM_IMAGE_WINDOWS }}
VM_IMAGE_WINDOWS_NATIVE: ${{ parameters.VM_IMAGE_WINDOWS }}
VM_IMAGE_MAC: ${{ parameters.VM_IMAGE_MAC }}
VM_IMAGE_MAC_NATIVE: ${{ parameters.VM_IMAGE_MAC }}
VM_IMAGE_MAC_NATIVE: ${{ parameters.VM_IMAGE_MAC_NATIVE }}
VM_IMAGE_LINUX: ${{ parameters.VM_IMAGE_LINUX }}
VM_IMAGE_LINUX_NATIVE: ${{ parameters.VM_IMAGE_LINUX }}

Просмотреть файл

@ -145,9 +145,10 @@ jobs:
displayName: Display all the .NET information
# install VS
- ${{ if endsWith(parameters.name, '_windows') }}:
- ${{ if and(eq(parameters.installPreviewVs, 'true'), ne(variables.VISUAL_STUDIO_VERSION, '')) }}:
- ${{ if eq(parameters.installPreviewVs, 'true') }}:
- pwsh: .\scripts\install-vs.ps1 -Version $(VISUAL_STUDIO_VERSION)
displayName: Install Visual Studio
condition: ne(variables.VISUAL_STUDIO_VERSION, '')
# install workloads
- ${{ if not(endsWith(parameters.name, '_linux')) }}:
- pwsh: .\scripts\install-dotnet-workloads.ps1 -InstallDir "$env:AGENT_TOOLSDIRECTORY/dotnet" -SourceUrl "$env:DOTNET_WORKLOAD_SOURCE" -IsPreview $true

Просмотреть файл

@ -51,13 +51,17 @@ steps:
- pwsh: |
Write-Host "Working with $env:RESOURCES_PIPELINE_SKIASHARP_RUNNAME"
$match = [regex]::Match("$env:RESOURCES_PIPELINE_SKIASHARP_RUNNAME", '.*\-(.+)\.(\d+)')
$label = $match.Groups[1].Value
Write-Host "Preview label: $label"
Write-Host "##vso[task.setvariable variable=PREVIEW_LABEL]$label"
$buildnumber = $match.Groups[2].Value
Write-Host "Build number: $buildnumber"
Write-Host "##vso[task.setvariable variable=BUILD_NUMBER]$buildnumber"
if ($env:RESOURCES_PIPELINE_SKIASHARP_RUNNAME) {
$match = [regex]::Match("$env:RESOURCES_PIPELINE_SKIASHARP_RUNNAME", '.*\-(.+)\.(\d+)')
$label = $match.Groups[1].Value
Write-Host "Preview label: $label"
Write-Host "##vso[task.setvariable variable=PREVIEW_LABEL]$label"
$buildnumber = $match.Groups[2].Value
Write-Host "Build number: $buildnumber"
Write-Host "##vso[task.setvariable variable=BUILD_NUMBER]$buildnumber"
} else {
Write-Host "Not a secondary build."
}
condition: or(eq(variables['Build.Reason'], 'ResourceTrigger'), eq(variables['Build.Reason'], 'Manual'))
displayName: Override the preview label and build number if this is a secondary build

Просмотреть файл

@ -11,25 +11,30 @@ if (Test-Path $fullPath) {
exit 0
}
$temp = "$env:TEMP"
if ("$env:AGENT_TEMPDIRECTORY") {
$temp = "$env:AGENT_TEMPDIRECTORY"
}
$startTime = Get-Date
Write-Host "Downloading Visual Studio Installer..."
Invoke-WebRequest -UseBasicParsing `
-Uri "https://aka.ms/vs/install/latest/vs_setup.exe" `
-OutFile "$env:TEMP\dd_vs_setup.exe"
-OutFile "$temp\dd_vs_setup.exe"
Write-Host "Updating the Visual Studio Installer..."
$exitCode = & "$env:TEMP\dd_vs_setup.exe" --update --quiet --wait | Out-Null
$exitCode = & "$temp\dd_vs_setup.exe" --update --quiet --wait | Out-Null
Write-Host "Exit code: $exitCode"
Write-Host "Downloading Visual Studio ($Version)..."
Invoke-WebRequest -UseBasicParsing `
-Uri "https://aka.ms/vs/$Version/vs_community.exe" `
-OutFile "$env:TEMP\dd_vs_community.exe"
-OutFile "$temp\dd_vs_community.exe"
Write-Host "Installing Visual Studio..."
$exitCode = & "$env:TEMP\dd_vs_community.exe" --quiet --norestart --wait `
$exitCode = & "$temp\dd_vs_community.exe" --quiet --norestart --wait `
--includeRecommended `
--add Microsoft.VisualStudio.Workload.NetCrossPlat `
--add Microsoft.VisualStudio.Workload.NetCoreTools `
@ -41,7 +46,7 @@ Write-Host "Exit code: $exitCode"
$vsLogs = 'output\logs\vs-logs'
New-Item -ItemType Directory -Force -Path "$vsLogs" | Out-Null
Get-ChildItem "$env:TEMP\dd_*" |
Get-ChildItem "$temp\dd_*" |
Where-Object { $_.CreationTime -gt $startTime } |
Copy-Item -Destination "$vsLogs"

Просмотреть файл

@ -0,0 +1 @@
XamarinChannel("Stable");

Просмотреть файл

@ -23,7 +23,7 @@
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-macos'))">10.14</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-maccatalyst'))">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-android'))">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.18362.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</SupportedOSPlatformVersion>
<!--
Suppress version attribute generation in Microsoft.NET.Sdk projects to avoid build failures

Просмотреть файл

@ -13,16 +13,16 @@ using SKFormsView = SkiaSharp.Views.Maui.Controls.SKCanvasView;
#if __ANDROID__
using Android.Content;
using Microsoft.Maui.Controls.Compatibility.Platform.Android;
using Microsoft.Maui.Controls.Handlers.Compatibility;
using SKNativeView = SkiaSharp.Views.Android.SKCanvasView;
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.Android.SKPaintSurfaceEventArgs;
#elif __IOS__
using Microsoft.Maui.Controls.Compatibility.Platform.iOS;
using Microsoft.Maui.Controls.Handlers.Compatibility;
using SKNativeView = SkiaSharp.Views.iOS.SKCanvasView;
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.iOS.SKPaintSurfaceEventArgs;
#elif WINDOWS
using Windows.Graphics.Display;
using Microsoft.Maui.Controls.Compatibility.Platform.UWP;
using Microsoft.Maui.Controls.Handlers.Compatibility;
using SKNativeView = SkiaSharp.Views.Windows.SKXamlCanvas;
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.Windows.SKPaintSurfaceEventArgs;
using WVisibility = Microsoft.UI.Xaml.Visibility;

Просмотреть файл

@ -11,11 +11,11 @@ using SKFormsView = SkiaSharp.Views.Maui.Controls.SKGLView;
#if __ANDROID__
using Android.Content;
using Microsoft.Maui.Controls.Compatibility.Platform.Android;
using Microsoft.Maui.Controls.Handlers.Compatibility;
using SKNativeView = SkiaSharp.Views.Android.SKGLTextureView;
using SKNativePaintGLSurfaceEventArgs = SkiaSharp.Views.Android.SKPaintGLSurfaceEventArgs;
#elif __IOS__
using Microsoft.Maui.Controls.Compatibility.Platform.iOS;
using Microsoft.Maui.Controls.Handlers.Compatibility;
using SKNativeView = SkiaSharp.Views.iOS.SKGLView;
using SKNativePaintGLSurfaceEventArgs = SkiaSharp.Views.iOS.SKPaintGLSurfaceEventArgs;
#endif

Просмотреть файл

@ -153,6 +153,8 @@ namespace SkiaSharp.Views.Forms
{
if (propertyName == PictureProperty.PropertyName)
OnSourceChanged();
else if (propertyName == DimensionsProperty.PropertyName)
OnSourceChanged();
base.OnPropertyChanged(propertyName);
}
}

Просмотреть файл

@ -1,6 +1,4 @@
using System;
using Microsoft.Maui;
using Microsoft.Maui.Controls.Compatibility;
using Microsoft.Maui.Hosting;
using SkiaSharp.Views.Maui.Controls.Compatibility;
using SkiaSharp.Views.Maui.Controls.Hosting;
@ -27,12 +25,12 @@ namespace SkiaSharp.Views.Maui.Controls.Hosting
{
#if !NETSTANDARD
if (replaceHandlers)
handlers.AddCompatibilityRenderer(typeof(SKCanvasView), typeof(SKCanvasViewRenderer));
handlers.AddHandler<SKCanvasView, SKCanvasViewRenderer>();
else
handlers.TryAddCompatibilityRenderer(typeof(SKCanvasView), typeof(SKCanvasViewRenderer));
handlers.TryAddHandler<SKCanvasView, SKCanvasViewRenderer>();
#if !WINDOWS && !__MACCATALYST__
handlers.AddCompatibilityRenderer(typeof(SKGLView), typeof(SKGLViewRenderer));
handlers.AddHandler<SKGLView, SKGLViewRenderer>();
#endif
CompatRegistrar.Registered.Register(typeof(SKImageImageSource), typeof(SKImageSourceHandler));

Просмотреть файл

@ -65,7 +65,7 @@ namespace SkiaSharp.Views.Maui.Handlers
VirtualView?.OnCanvasSizeChanged(newCanvasSize);
}
VirtualView?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info));
VirtualView?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info, e.RawInfo));
}
private SKPoint OnGetScaledCoord(double x, double y)

Просмотреть файл

@ -63,7 +63,7 @@ namespace SkiaSharp.Views.Maui.Handlers
VirtualView?.OnCanvasSizeChanged(newCanvasSize);
}
VirtualView?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info));
VirtualView?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info, e.RawInfo));
}
private SKPoint OnGetScaledCoord(double x, double y)

Просмотреть файл

@ -64,7 +64,7 @@ namespace SkiaSharp.Views.Maui.Handlers
VirtualView?.OnCanvasSizeChanged(newCanvasSize);
}
VirtualView?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info));
VirtualView?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info, e.RawInfo));
}
private SKPoint OnGetScaledCoord(double x, double y)

Просмотреть файл

@ -9,7 +9,29 @@ namespace SkiaSharp.Views.Maui.Handlers
{
public partial class SKImageSourceService
{
public override Task<IImageSourceServiceResult<Drawable>?> GetDrawableAsync(IImageSource imageSource, Context context, CancellationToken cancellationToken = default)
public override async Task<IImageSourceServiceResult?> LoadDrawableAsync(
IImageSource imageSource,
global::Android.Widget.ImageView imageView,
CancellationToken cancellationToken = default)
{
var realResult = await GetDrawableAsync(imageView.Context!, imageSource, cancellationToken);
if (realResult is null)
{
imageView.SetImageDrawable(null);
return null;
}
imageView.SetImageDrawable(realResult.Value);
var result = new ImageSourceServiceLoadResult(
realResult.IsResolutionDependent,
() => realResult.Dispose());
return result;
}
public override Task<IImageSourceServiceResult<Drawable>?> GetDrawableAsync(Context context, IImageSource imageSource, CancellationToken cancellationToken = default)
{
var bitmap = imageSource switch
{

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows10.0.18362</TargetFramework>
<TargetFrameworks>net5.0-windows10.0.18362;net6.0-windows10.0.18362</TargetFrameworks>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>SkiaSharp.Views.Windows</RootNamespace>
<AssemblyName>SkiaSharp.Views.Windows</AssemblyName>

Просмотреть файл

@ -75,7 +75,7 @@ namespace SkiaSharp.Views.UWP
{
using (var image = SKImage.FromPicture(picture, dimensions))
{
return image.ToWriteableBitmap();
return image?.ToWriteableBitmap();
}
}