diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46671940..9d7456b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,13 @@ jobs: matrix: include: - os: ubuntu-22.04 - container: mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim + container: mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim script: ./build.sh - os: ubuntu-22.04 container: rockylinux:8 script: ./build.sh - os: ubuntu-22.04 - container: mcr.microsoft.com/dotnet/sdk:7.0-alpine3.18 + container: mcr.microsoft.com/dotnet/sdk:8.0-alpine3.18 script: ./build.sh # TODO(kleisauke): Re-enable Mono CI when C# 9 features are supported. # - os: ubuntu-22.04 @@ -26,8 +26,8 @@ jobs: - os: windows-2022 script: .\build.ps1 steps: - - name: Dependencies (Debian 11) - if: contains(matrix.container, 'bullseye') + - name: Dependencies (Debian 12) + if: contains(matrix.container, 'bookworm') run: | apt-get update apt-get install -y fontconfig-config @@ -41,7 +41,7 @@ jobs: if: runner.os != 'Linux' uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.x + dotnet-version: 8.x - name: Checkout uses: actions/checkout@v4 - name: Test diff --git a/.travis.yml b/.travis.yml index 316f2785..59c2a326 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,21 +3,21 @@ jobs: - arch: arm64 fast_finish: true include: - - name: "Linux ARM64v8 (Debian 11, glibc 2.31) - .NET 7.0" + - name: "Linux ARM64v8 (Debian 12, glibc 2.36) - .NET 8.0" arch: arm64 os: linux dist: focal language: shell install: - - sudo docker run -dit --name netvips -e TRAVIS -v $(pwd):/mnt/netvips -w /mnt/netvips mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim-arm64v8 + - sudo docker run -dit --name netvips -e TRAVIS -v $(pwd):/mnt/netvips -w /mnt/netvips mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim-arm64v8 - sudo docker exec netvips sh -c "apt-get update && apt-get install -y fontconfig-config" script: sudo docker exec netvips bash -c "./build.sh" - - name: "Linux ARM64v8 (Alpine 3.16, musl 1.2.3) - .NET 7.0" + - name: "Linux ARM64v8 (Alpine 3.18, musl 1.2.4) - .NET 8.0" arch: arm64 os: linux dist: focal language: shell install: - - sudo docker run -dit --name netvips -e TRAVIS -v $(pwd):/mnt/netvips -w /mnt/netvips mcr.microsoft.com/dotnet/sdk:7.0-alpine3.16-arm64v8 + - sudo docker run -dit --name netvips -e TRAVIS -v $(pwd):/mnt/netvips -w /mnt/netvips mcr.microsoft.com/dotnet/sdk:8.0-alpine3.18-arm64v8 - sudo docker exec netvips sh -c "apk add bash font-noto --update-cache" script: sudo docker exec netvips bash -c "./build.sh" diff --git a/CHANGELOG.md b/CHANGELOG.md index aa41dde1..a9c625df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Changed - Update methods/enums for libvips 8.14. -- The [NetVips.Extensions](https://www.nuget.org/packages/NetVips.Extensions/) package is now only supported on Windows when targeting .NET 7.0. See https://aka.ms/systemdrawingnonwindows for more information. +- The [NetVips.Extensions](https://www.nuget.org/packages/NetVips.Extensions/) package is now only supported on Windows when targeting .NET 6.0 or higher. See https://aka.ms/systemdrawingnonwindows for more information. ### Fixed - Ensure compatibility with FreeBSD and variants. diff --git a/Dockerfile b/Dockerfile index 455083fc..ab4ec6cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build LABEL maintainer="Kleis Auke Wolthuizen " RUN apk add bash font-noto --update-cache diff --git a/NetVips.sln b/NetVips.sln index c1617a57..ec189564 100644 --- a/NetVips.sln +++ b/NetVips.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.4.33110.190 +VisualStudioVersion = 17.8.34309.116 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetVips", "src\NetVips\NetVips.csproj", "{5BCB7929-52B1-459B-89E5-7C2059850C60}" EndProject diff --git a/README.md b/README.md index d45a4d05..a0661ba9 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ which gives some more background. ## Supported platforms -- .NET Framework (4.5.2 and higher) -- .NET Core (.NETStandard 2.0 and higher on Windows, Linux and macOS) +- .NET Framework 4.5.2 and higher +- .NET Standard 2.0 and higher - Mono ## Install diff --git a/build.ps1 b/build.ps1 index f561725f..ec978393 100644 --- a/build.ps1 +++ b/build.ps1 @@ -34,7 +34,7 @@ if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -eq $null) { exit 1 } -Write-Output "Microsoft (R) .NET Core SDK version $(& dotnet --version)" +Write-Output "Microsoft (R) .NET SDK version $(& dotnet --version)" ExecSafe { & dotnet build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false /nologo /clp:NoSummary --verbosity quiet } ExecSafe { & dotnet run --project $BuildProjectFile --no-build -- $BuildArguments } diff --git a/build.sh b/build.sh index 6afa515d..406277bf 100755 --- a/build.sh +++ b/build.sh @@ -18,16 +18,12 @@ export NUKE_TELEMETRY_OPTOUT=1 # EXECUTION ########################################################################### -# Do not use -x to check for the presence of dotnet, -# because that might fail on bash under Alpine 3.14, see: -# https://github.com/alpinelinux/docker-alpine/issues/156 -# https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2 -if ! [ -e "$(command -v dotnet)" ]; then +if ! [ -x "$(command -v dotnet)" ]; then echo 'Error: dotnet is not installed.' >&2 exit 1 fi -echo "Microsoft (R) .NET Core SDK version $(dotnet --version)" +echo "Microsoft (R) .NET SDK version $(dotnet --version)" dotnet build "$BUILD_PROJECT_FILE" -nodeReuse:false -p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet dotnet run --project "$BUILD_PROJECT_FILE" --no-build -- "$@" diff --git a/build/NetVips.Build.csproj b/build/NetVips.Build.csproj index 0d2bb61f..6f91d068 100644 --- a/build/NetVips.Build.csproj +++ b/build/NetVips.Build.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 false False @@ -10,6 +10,8 @@ .. .. x64;x86;ARM64;ARM32 + + true diff --git a/docker.sh b/docker.sh index c31de595..90628701 100755 --- a/docker.sh +++ b/docker.sh @@ -5,8 +5,8 @@ if ! [ -x "$(command -v docker)" ]; then exit 1 fi -# Ensure latest .NET Core SDK -docker pull mcr.microsoft.com/dotnet/sdk:7.0-alpine +# Ensure latest .NET SDK +docker pull mcr.microsoft.com/dotnet/sdk:8.0-alpine # Create a machine image with all the required build tools pre-installed docker build . -t netvips diff --git a/docs/NetVips.Docs.csproj b/docs/NetVips.Docs.csproj index 444e179c..6cdb6397 100644 --- a/docs/NetVips.Docs.csproj +++ b/docs/NetVips.Docs.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 x64;x86;ARM64;ARM32 Exe false diff --git a/samples/NetVips.Samples/NetVips.Samples.csproj b/samples/NetVips.Samples/NetVips.Samples.csproj index 32a56692..8ba4a070 100644 --- a/samples/NetVips.Samples/NetVips.Samples.csproj +++ b/samples/NetVips.Samples/NetVips.Samples.csproj @@ -3,7 +3,7 @@ - net7.0 + net8.0 Exe NetVips true @@ -15,7 +15,7 @@ - + diff --git a/src/NetVips.Extensions/NetVips.Extensions.csproj b/src/NetVips.Extensions/NetVips.Extensions.csproj index 09ce78aa..278d7901 100644 --- a/src/NetVips.Extensions/NetVips.Extensions.csproj +++ b/src/NetVips.Extensions/NetVips.Extensions.csproj @@ -3,9 +3,7 @@ - net70;net60;netstandard2.0;net461 - - net70 + net6.0;netstandard2.0;net461 netstandard2.0 true NetVips.Extensions @@ -22,25 +20,18 @@ - - - - - - - - + + - + + - + diff --git a/src/NetVips/ExtensionMethods.cs b/src/NetVips/ExtensionMethods.cs index b340e092..ea43ef0a 100644 --- a/src/NetVips/ExtensionMethods.cs +++ b/src/NetVips/ExtensionMethods.cs @@ -38,19 +38,6 @@ internal static void Merge(this VOption self, VOption merge) } } - /// - /// Dereferences data from an unmanaged block of memory - /// to a newly allocated managed object of the specified type. - /// - /// The type of object to be created. This object - /// must represent a formatted class or a structure. - /// A pointer to an unmanaged block of memory. - /// A newly allocated managed object of the specified type. - internal static T Dereference(this IntPtr ptr) - { - return Marshal.PtrToStructure(ptr); - } - /// /// Call a libvips operation. /// diff --git a/src/NetVips/GObject.cs b/src/NetVips/GObject.cs index 105e0dd8..749b6bf2 100644 --- a/src/NetVips/GObject.cs +++ b/src/NetVips/GObject.cs @@ -196,7 +196,7 @@ internal IntPtr ObjectRef() /// /// Get the reference count of object. Handy for debugging. /// - internal uint RefCount => handle.Dereference().RefCount; + internal uint RefCount => Marshal.PtrToStructure(handle).RefCount; // Do not provide a finalizer - SafeHandle's critical finalizer will // call ReleaseHandle for us. diff --git a/src/NetVips/NetVips.cs b/src/NetVips/NetVips.cs index 0e6bc891..383a13b6 100644 --- a/src/NetVips/NetVips.cs +++ b/src/NetVips/NetVips.cs @@ -502,7 +502,7 @@ IntPtr TypeMap(IntPtr type, IntPtr a, IntPtr b) public static Dictionary ValuesForEnum(IntPtr type) { var typeClass = GType.ClassRef(type); - var enumClass = typeClass.Dereference(); + var enumClass = Marshal.PtrToStructure(typeClass); var values = new Dictionary((int)(enumClass.NValues - 1)); @@ -511,7 +511,7 @@ public static Dictionary ValuesForEnum(IntPtr type) // -1 since we always have a "last" member for (var i = 0; i < enumClass.NValues - 1; i++) { - var enumValue = ptr.Dereference(); + var enumValue = Marshal.PtrToStructure(ptr); values[enumValue.ValueNick] = enumValue.Value; ptr += Marshal.SizeOf(typeof(GEnumValue)); diff --git a/src/NetVips/NetVips.csproj b/src/NetVips/NetVips.csproj index f45dba7d..0410589b 100644 --- a/src/NetVips/NetVips.csproj +++ b/src/NetVips/NetVips.csproj @@ -14,8 +14,8 @@ $(DefaultItemExcludes);Interop\Libraries.*.cs false false - true - true + true + true diff --git a/src/NetVips/SourceCustom.cs b/src/NetVips/SourceCustom.cs index 09186160..59ede810 100644 --- a/src/NetVips/SourceCustom.cs +++ b/src/NetVips/SourceCustom.cs @@ -16,10 +16,10 @@ public class SourceCustom : Source /// A read delegate. /// /// - /// The interface is exactly as . The handler is given a number - /// of bytes to fetch, and should return a bytes-like object containing up - /// to that number of bytes. If there is no more data available, it should - /// return . + /// The interface is exactly as . + /// The handler is given a number of bytes to fetch, and should return a + /// bytes-like object containing up to that number of bytes. If there is + /// no more data available, it should return . /// /// An array of bytes. /// The maximum number of bytes to be read. diff --git a/src/NetVips/TargetCustom.cs b/src/NetVips/TargetCustom.cs index ce27775c..335fb0b9 100644 --- a/src/NetVips/TargetCustom.cs +++ b/src/NetVips/TargetCustom.cs @@ -16,9 +16,9 @@ public class TargetCustom : Target /// A write delegate. /// /// - /// The interface is the same as , so the handler is - /// given a bytes-like object to write. However, the handler MUST return the number - /// of bytes written. + /// The interface is the same as . + /// The handler is given a bytes-like object to write. However, the handler MUST + /// return the number of bytes written. /// /// An array of bytes. /// The number of bytes to be written to the current target. diff --git a/src/NetVips/VipsBlob.cs b/src/NetVips/VipsBlob.cs index 9d05046a..8404721c 100644 --- a/src/NetVips/VipsBlob.cs +++ b/src/NetVips/VipsBlob.cs @@ -61,11 +61,11 @@ protected override bool ReleaseHandle() /// /// Get the number of bytes of data. /// - internal ulong Length => (ulong)handle.Dereference().Length; + internal ulong Length => (ulong)Marshal.PtrToStructure(handle).Length; /// /// Get the reference count of the blob. Handy for debugging. /// - internal int RefCount => handle.Dereference().Count; + internal int RefCount => Marshal.PtrToStructure(handle).Count; } } \ No newline at end of file diff --git a/src/NetVips/VipsObject.cs b/src/NetVips/VipsObject.cs index df31bd7e..38c9d120 100644 --- a/src/NetVips/VipsObject.cs +++ b/src/NetVips/VipsObject.cs @@ -51,7 +51,7 @@ internal static void PrintAll() return argument != 0 ? default(GParamSpec.Struct?) - : pspec.Dereference(); + : Marshal.PtrToStructure(pspec); } /// diff --git a/tests/NetVips.Benchmarks/Config.cs b/tests/NetVips.Benchmarks/Config.cs index 27045f0e..e7a3e9c1 100644 --- a/tests/NetVips.Benchmarks/Config.cs +++ b/tests/NetVips.Benchmarks/Config.cs @@ -21,6 +21,10 @@ public Config() .WithToolchain(CsProjCoreToolchain.NetCoreApp70) .WithRuntime(NativeAotRuntime.Net70) .WithId(".NET 7.0 CLI (NativeAOT)") +#elif NET8_0 + .WithToolchain(CsProjCoreToolchain.NetCoreApp80) + .WithRuntime(NativeAotRuntime.Net80) + .WithId(".NET 8.0 CLI (NativeAOT)") #endif #if GLOBAL_VIPS .WithArguments(new Argument[] diff --git a/tests/NetVips.Benchmarks/NetVips.Benchmarks.csproj b/tests/NetVips.Benchmarks/NetVips.Benchmarks.csproj index 9af5acfc..f8bbb68e 100644 --- a/tests/NetVips.Benchmarks/NetVips.Benchmarks.csproj +++ b/tests/NetVips.Benchmarks/NetVips.Benchmarks.csproj @@ -3,7 +3,7 @@ - net7.0 + net8.0 Exe true x64;x86;ARM64;ARM32 @@ -23,7 +23,7 @@ - + diff --git a/tests/NetVips.Tests/NetVips.Tests.csproj b/tests/NetVips.Tests/NetVips.Tests.csproj index 7cea42ff..15170970 100644 --- a/tests/NetVips.Tests/NetVips.Tests.csproj +++ b/tests/NetVips.Tests/NetVips.Tests.csproj @@ -3,7 +3,7 @@ - net7.0 + net8.0 false Library x64;x86;ARM64;ARM32 @@ -45,7 +45,7 @@ - +