From 144b339e13b560c6cce946036ae96bdc2be6271b Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 5 Oct 2022 06:42:04 +0800 Subject: [PATCH] Removing all .NET 5 SDK requirements (#2266) --- binding/HarfBuzzSharp.Shared/NativeObject.cs | 11 +------- nuget/HarfBuzzSharp.NativeAssets.Win32.nuspec | 4 +-- nuget/HarfBuzzSharp.NativeAssets.macOS.nuspec | 4 +-- nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec | 4 +-- nuget/HarfbuzzSharp.nuspec | 7 ------ nuget/SkiaSharp.HarfBuzz.nuspec | 7 ------ ...p.NativeAssets.Linux.NoDependencies.nuspec | 4 +-- nuget/SkiaSharp.NativeAssets.Linux.nuspec | 4 +-- nuget/SkiaSharp.NativeAssets.Win32.nuspec | 4 +-- nuget/SkiaSharp.NativeAssets.macOS.nuspec | 4 +-- nuget/SkiaSharp.Skottie.nuspec | 9 ------- nuget/SkiaSharp.Views.Uno.WinUI.nuspec | 4 +-- nuget/SkiaSharp.Views.WinUI.nuspec | 7 ------ nuget/SkiaSharp.Vulkan.SharpVk.nuspec | 7 ------ nuget/SkiaSharp.nuspec | 7 ------ .../SkiaSharpSample/SkiaSharpSample.csproj | 2 +- .../SkiaSharpSample/SkiaSharpSample.csproj | 2 +- .../SkiaSharpSample.Package.wapproj | 2 +- .../SkiaSharpSample/SkiaSharpSample.csproj | 2 +- .../SkiaSharpSample.Skia.Gtk.csproj | 2 +- .../SkiaSharpSample.Gtk.csproj | 2 +- scripts/azure-templates-bootstrapper.yml | 11 +++----- scripts/patch-dotnet.ps1 | 25 +++++++++++++++++++ source/SkiaSharp.Build.props | 2 +- .../SkiaSharp.Views.WinUI.csproj | 2 +- 25 files changed, 54 insertions(+), 85 deletions(-) create mode 100644 scripts/patch-dotnet.ps1 diff --git a/binding/HarfBuzzSharp.Shared/NativeObject.cs b/binding/HarfBuzzSharp.Shared/NativeObject.cs index a881a31c45..70088e35c1 100644 --- a/binding/HarfBuzzSharp.Shared/NativeObject.cs +++ b/binding/HarfBuzzSharp.Shared/NativeObject.cs @@ -60,18 +60,9 @@ public void Dispose () GC.SuppressFinalize (this); } - internal static int SizeOf () - { -#if WINDOWS_UWP || NETSTANDARD || NET5_0_OR_GREATER - return Marshal.SizeOf (); -#else - return Marshal.SizeOf (typeof (T)); -#endif - } - internal static IntPtr StructureArrayToPtr (IReadOnlyList items) { - var size = SizeOf (); + var size = Marshal.SizeOf (); var memory = Marshal.AllocCoTaskMem (size * items.Count); for (var i = 0; i < items.Count; i++) { var ptr = new IntPtr (memory.ToInt64 () + (i * size)); diff --git a/nuget/HarfBuzzSharp.NativeAssets.Win32.nuspec b/nuget/HarfBuzzSharp.NativeAssets.Win32.nuspec index 727d97b1ba..dd91888e1a 100644 --- a/nuget/HarfBuzzSharp.NativeAssets.Win32.nuspec +++ b/nuget/HarfBuzzSharp.NativeAssets.Win32.nuspec @@ -33,7 +33,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + @@ -56,7 +56,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + diff --git a/nuget/HarfBuzzSharp.NativeAssets.macOS.nuspec b/nuget/HarfBuzzSharp.NativeAssets.macOS.nuspec index f09ddde305..bd6597b36d 100644 --- a/nuget/HarfBuzzSharp.NativeAssets.macOS.nuspec +++ b/nuget/HarfBuzzSharp.NativeAssets.macOS.nuspec @@ -37,7 +37,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + @@ -61,7 +61,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + diff --git a/nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec b/nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec index dc3fed871d..f371d7696e 100644 --- a/nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec +++ b/nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec @@ -36,7 +36,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + @@ -58,7 +58,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + diff --git a/nuget/HarfbuzzSharp.nuspec b/nuget/HarfbuzzSharp.nuspec index c2edd68b4a..fe19545b7a 100644 --- a/nuget/HarfbuzzSharp.nuspec +++ b/nuget/HarfbuzzSharp.nuspec @@ -78,10 +78,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - - @@ -146,9 +142,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - diff --git a/nuget/SkiaSharp.HarfBuzz.nuspec b/nuget/SkiaSharp.HarfBuzz.nuspec index 2bb0201b83..ee095add75 100644 --- a/nuget/SkiaSharp.HarfBuzz.nuspec +++ b/nuget/SkiaSharp.HarfBuzz.nuspec @@ -47,10 +47,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - - @@ -76,9 +72,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - diff --git a/nuget/SkiaSharp.NativeAssets.Linux.NoDependencies.nuspec b/nuget/SkiaSharp.NativeAssets.Linux.NoDependencies.nuspec index 7f6e27c794..e2dd49ee05 100644 --- a/nuget/SkiaSharp.NativeAssets.Linux.NoDependencies.nuspec +++ b/nuget/SkiaSharp.NativeAssets.Linux.NoDependencies.nuspec @@ -49,7 +49,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + @@ -71,7 +71,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + diff --git a/nuget/SkiaSharp.NativeAssets.Linux.nuspec b/nuget/SkiaSharp.NativeAssets.Linux.nuspec index 9492359fb6..f874caadbf 100644 --- a/nuget/SkiaSharp.NativeAssets.Linux.nuspec +++ b/nuget/SkiaSharp.NativeAssets.Linux.nuspec @@ -37,7 +37,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + @@ -59,7 +59,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + diff --git a/nuget/SkiaSharp.NativeAssets.Win32.nuspec b/nuget/SkiaSharp.NativeAssets.Win32.nuspec index f2c26e7dd1..54910c544d 100644 --- a/nuget/SkiaSharp.NativeAssets.Win32.nuspec +++ b/nuget/SkiaSharp.NativeAssets.Win32.nuspec @@ -34,7 +34,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + @@ -57,7 +57,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + diff --git a/nuget/SkiaSharp.NativeAssets.macOS.nuspec b/nuget/SkiaSharp.NativeAssets.macOS.nuspec index 32352b0918..3dda764c5f 100644 --- a/nuget/SkiaSharp.NativeAssets.macOS.nuspec +++ b/nuget/SkiaSharp.NativeAssets.macOS.nuspec @@ -38,7 +38,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + @@ -62,7 +62,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + diff --git a/nuget/SkiaSharp.Skottie.nuspec b/nuget/SkiaSharp.Skottie.nuspec index 17c50bb511..d9c628cb01 100644 --- a/nuget/SkiaSharp.Skottie.nuspec +++ b/nuget/SkiaSharp.Skottie.nuspec @@ -57,9 +57,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - @@ -117,9 +114,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - @@ -174,9 +168,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - diff --git a/nuget/SkiaSharp.Views.Uno.WinUI.nuspec b/nuget/SkiaSharp.Views.Uno.WinUI.nuspec index 24796b430b..a90314e8a2 100644 --- a/nuget/SkiaSharp.Views.Uno.WinUI.nuspec +++ b/nuget/SkiaSharp.Views.Uno.WinUI.nuspec @@ -48,7 +48,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + @@ -82,7 +82,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - + diff --git a/nuget/SkiaSharp.Views.WinUI.nuspec b/nuget/SkiaSharp.Views.WinUI.nuspec index 4ae67d5e33..16bbd12034 100644 --- a/nuget/SkiaSharp.Views.WinUI.nuspec +++ b/nuget/SkiaSharp.Views.WinUI.nuspec @@ -27,10 +27,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release © Microsoft Corporation. All rights reserved. - - - - @@ -45,9 +41,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - diff --git a/nuget/SkiaSharp.Vulkan.SharpVk.nuspec b/nuget/SkiaSharp.Vulkan.SharpVk.nuspec index 7166673387..ab181080c2 100644 --- a/nuget/SkiaSharp.Vulkan.SharpVk.nuspec +++ b/nuget/SkiaSharp.Vulkan.SharpVk.nuspec @@ -39,10 +39,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - - @@ -62,9 +58,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - diff --git a/nuget/SkiaSharp.nuspec b/nuget/SkiaSharp.nuspec index 2fa214ff1b..c23ce830ca 100644 --- a/nuget/SkiaSharp.nuspec +++ b/nuget/SkiaSharp.nuspec @@ -79,10 +79,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - - @@ -150,9 +146,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release - - - diff --git a/samples/Basic/Maui/SkiaSharpSample/SkiaSharpSample.csproj b/samples/Basic/Maui/SkiaSharpSample/SkiaSharpSample.csproj index b68a523c98..0ea79b0b30 100644 --- a/samples/Basic/Maui/SkiaSharpSample/SkiaSharpSample.csproj +++ b/samples/Basic/Maui/SkiaSharpSample/SkiaSharpSample.csproj @@ -33,7 +33,7 @@ - --> + --> diff --git a/samples/Basic/WinUI/Msix/SkiaSharpSample/SkiaSharpSample.csproj b/samples/Basic/WinUI/Msix/SkiaSharpSample/SkiaSharpSample.csproj index e46d2a0179..33447e1497 100644 --- a/samples/Basic/WinUI/Msix/SkiaSharpSample/SkiaSharpSample.csproj +++ b/samples/Basic/WinUI/Msix/SkiaSharpSample/SkiaSharpSample.csproj @@ -2,7 +2,7 @@ WinExe - net5.0-windows10.0.19041.0 + net6.0-windows10.0.19041.0 10.0.17763.0 SkiaSharpSample app.manifest diff --git a/samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/SkiaSharpSample.Package.wapproj b/samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/SkiaSharpSample.Package.wapproj index 71b6fbc3d8..c8593ff796 100644 --- a/samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/SkiaSharpSample.Package.wapproj +++ b/samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/SkiaSharpSample.Package.wapproj @@ -41,7 +41,7 @@ en-US false ..\SkiaSharpSample\SkiaSharpSample.csproj - net5.0-windows$(TargetPlatformVersion);$(AssetTargetFallback) + net6.0-windows$(TargetPlatformVersion);$(AssetTargetFallback) diff --git a/samples/Basic/WinUI/WapProj/SkiaSharpSample/SkiaSharpSample.csproj b/samples/Basic/WinUI/WapProj/SkiaSharpSample/SkiaSharpSample.csproj index 156b7d9bae..d0d6095ce9 100644 --- a/samples/Basic/WinUI/WapProj/SkiaSharpSample/SkiaSharpSample.csproj +++ b/samples/Basic/WinUI/WapProj/SkiaSharpSample/SkiaSharpSample.csproj @@ -2,7 +2,7 @@ WinExe - net5.0-windows10.0.19041.0 + net6.0-windows10.0.19041.0 10.0.17763.0 SkiaSharpSample app.manifest diff --git a/samples/Gallery/Uno.WinUI/SkiaSharpSample.Skia.Gtk/SkiaSharpSample.Skia.Gtk.csproj b/samples/Gallery/Uno.WinUI/SkiaSharpSample.Skia.Gtk/SkiaSharpSample.Skia.Gtk.csproj index 227d06bbe6..dfbb0ddbf3 100644 --- a/samples/Gallery/Uno.WinUI/SkiaSharpSample.Skia.Gtk/SkiaSharpSample.Skia.Gtk.csproj +++ b/samples/Gallery/Uno.WinUI/SkiaSharpSample.Skia.Gtk/SkiaSharpSample.Skia.Gtk.csproj @@ -2,7 +2,7 @@ WinExe Exe - net5.0 + net6.0 $(DefineConstants);WINUI diff --git a/samples/Gallery/Uno/SkiaSharpSample.Gtk/SkiaSharpSample.Gtk.csproj b/samples/Gallery/Uno/SkiaSharpSample.Gtk/SkiaSharpSample.Gtk.csproj index 112e0cee73..be5ce9104c 100644 --- a/samples/Gallery/Uno/SkiaSharpSample.Gtk/SkiaSharpSample.Gtk.csproj +++ b/samples/Gallery/Uno/SkiaSharpSample.Gtk/SkiaSharpSample.Gtk.csproj @@ -2,7 +2,7 @@ WinExe Exe - net5.0 + net6.0 diff --git a/scripts/azure-templates-bootstrapper.yml b/scripts/azure-templates-bootstrapper.yml index 29a14eed51..786ecb49be 100644 --- a/scripts/azure-templates-bootstrapper.yml +++ b/scripts/azure-templates-bootstrapper.yml @@ -174,13 +174,6 @@ jobs: version: 3.1.x retryCountOnTaskFailure: 3 displayName: Install .NET Core 3.1.x - - task: UseDotNet@2 - condition: and(succeeded(), eq(variables['DOWNLOAD_EXTERNALS'], '')) - inputs: - packageType: 'sdk' - version: 5.0.x - retryCountOnTaskFailure: 3 - displayName: Install .NET Core 5.0.x - task: UseDotNet@2 condition: and(succeeded(), eq(variables['DOWNLOAD_EXTERNALS'], '')) inputs: @@ -192,6 +185,10 @@ jobs: displayName: Install the preview version of .NET Core retryCountOnTaskFailure: 3 condition: and(succeeded(), eq(variables['DOWNLOAD_EXTERNALS'], ''), ne(variables.DOTNET_VERSION_PREVIEW, '')) + - ${{ if endsWith(parameters.name, '_linux') }}: + - pwsh: .\scripts\patch-dotnet.ps1 -InstallDir "$env:AGENT_TOOLSDIRECTORY/dotnet" + displayName: Fix the Microsoft.WinFX.* file + condition: and(succeeded(), eq(variables['DOWNLOAD_EXTERNALS'], '')) # display dotnet info - pwsh: dotnet --info displayName: Display all the .NET information diff --git a/scripts/patch-dotnet.ps1 b/scripts/patch-dotnet.ps1 new file mode 100644 index 0000000000..3912f7c3d0 --- /dev/null +++ b/scripts/patch-dotnet.ps1 @@ -0,0 +1,25 @@ +Param( + [string] $InstallDir +) + +$ErrorActionPreference = 'Stop' + +$dotnetSdk = Join-Path "$InstallDir" "sdk" +if (Test-Path $dotnetSdk) { + $versions = Get-ChildItem $dotnetSdk + foreach ($version in $versions) { + $root = Join-Path $version "Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets" + if (Test-Path $root) { + if (Test-Path (Join-Path $root Microsoft.WinFx.props)) { + Move-Item (Join-Path $root Microsoft.WinFx.props) (Join-Path $root Microsoft.WinFX.props) + } + if (Test-Path (Join-Path $root Microsoft.WinFx.targets)) { + Move-Item (Join-Path $root Microsoft.WinFx.targets) (Join-Path $root Microsoft.WinFX.targets) + } + } + } +} else { + Write-Host "No .NET installed." +} + +exit $LASTEXITCODE diff --git a/source/SkiaSharp.Build.props b/source/SkiaSharp.Build.props index ee9f31374f..7d7518fe88 100644 --- a/source/SkiaSharp.Build.props +++ b/source/SkiaSharp.Build.props @@ -55,7 +55,7 @@ netstandard1.3 - netstandard2.0;netstandard2.1;net462;netcoreapp3.1;net5.0 + netstandard2.0;netstandard2.1;net462;netcoreapp3.1 $(BasicTargetFrameworksWithoutAncient);net$(DotNetBaseVersion) $(BasicTargetFrameworksWithoutAncient);net$(DotNetNextVersion) $(AncientTargetFrameworks);$(BasicTargetFrameworksWithoutAncient) diff --git a/source/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI.csproj b/source/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI.csproj index f20745b9af..cfd5f2f424 100644 --- a/source/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI.csproj +++ b/source/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI.csproj @@ -1,6 +1,6 @@  - net5.0-windows10.0.18362.0;net6.0-windows10.0.18362.0;net6.0-windows10.0.19041.0 + net6.0-windows10.0.18362.0;net6.0-windows10.0.19041.0 10.0.17763.0 SkiaSharp.Views.Windows SkiaSharp.Views.Windows