diff --git a/ManagedWimLib.Tests/GetInfoTests.cs b/ManagedWimLib.Tests/GetInfoTests.cs index a284380..d9dc399 100644 --- a/ManagedWimLib.Tests/GetInfoTests.cs +++ b/ManagedWimLib.Tests/GetInfoTests.cs @@ -142,7 +142,7 @@ public void ResolveImage() ResolveImageTemplate("MultiImage.wim", "*", Wim.AllImages); } - public void ResolveImageTemplate(string fileName, string imageNameOrNum, int expected) + public static void ResolveImageTemplate(string fileName, string imageNameOrNum, int expected) { string wimFile = Path.Combine(TestSetup.SampleDir, fileName); using (Wim wim = Wim.OpenWim(wimFile, OpenFlags.None)) diff --git a/ManagedWimLib.Tests/ManagedWimLib.Tests.csproj b/ManagedWimLib.Tests/ManagedWimLib.Tests.csproj index 53cfc49..a9167b6 100644 --- a/ManagedWimLib.Tests/ManagedWimLib.Tests.csproj +++ b/ManagedWimLib.Tests/ManagedWimLib.Tests.csproj @@ -10,13 +10,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/ManagedWimLib.Tests/TestSetup.cs b/ManagedWimLib.Tests/TestSetup.cs index de8853e..858139d 100644 --- a/ManagedWimLib.Tests/TestSetup.cs +++ b/ManagedWimLib.Tests/TestSetup.cs @@ -70,10 +70,11 @@ public static void Cleanup() #region GetNativeLibPath private static string GetNativeLibPath() { + string libBaseDir = TestHelper.GetProgramAbsolutePath(); string libDir = string.Empty; #if !NETFRAMEWORK - libDir = "runtimes"; + libDir = Path.Combine(libDir, "runtimes"); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) libDir = Path.Combine(libDir, "win-"); else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) @@ -104,11 +105,11 @@ private static string GetNativeLibPath() string libPath = null; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - libPath = Path.Combine(libDir, "libwim-15.dll"); + libPath = Path.Combine(libBaseDir, libDir, "libwim-15.dll"); else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - libPath = Path.Combine(libDir, "libwim.so"); + libPath = Path.Combine(libBaseDir, libDir, "libwim.so"); else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - libPath = Path.Combine(libDir, "libwim.dylib"); + libPath = Path.Combine(libBaseDir, libDir, "libwim.dylib"); if (libPath == null) throw new PlatformNotSupportedException($"Unable to find native library."); diff --git a/ManagedWimLib.sln b/ManagedWimLib.sln index 3207fad..32a3dc5 100644 --- a/ManagedWimLib.sln +++ b/ManagedWimLib.sln @@ -1,11 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2018 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32126.317 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedWimLib", "ManagedWimLib\ManagedWimLib.csproj", "{73BDCA22-081D-489E-95E7-A02A6778BB7C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedWimLib.Tests", "ManagedWimLib.Tests\ManagedWimLib.Tests.csproj", "{83E13236-FE14-47BA-BA3C-9028597FAEDC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedWimLib.Tests", "ManagedWimLib.Tests\ManagedWimLib.Tests.csproj", "{83E13236-FE14-47BA-BA3C-9028597FAEDC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{14D989FD-A32C-444F-8729-B96D46E33691}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/ManagedWimLib/ManagedWimLib.csproj b/ManagedWimLib/ManagedWimLib.csproj index 75cd4e5..13d8195 100644 --- a/ManagedWimLib/ManagedWimLib.csproj +++ b/ManagedWimLib/ManagedWimLib.csproj @@ -1,12 +1,12 @@  - net451;netstandard2.0;netstandard2.1 - netstandard2.0;netstandard2.1 + net451;netstandard2.0;netcoreapp3.1 + netstandard2.0;netcoreapp3.1 ManagedWimLib ManagedWimLib latest true - 2.3.0 + 2.4.0 Eric Biggers, Hajin Jang Joveler Native wimlib wrapper library for .NET. @@ -17,12 +17,13 @@ Supports Windows, Linux and macOS. https://github.com/ied206/ManagedWimLib images\Logo.png https://github.com/ied206/ManagedWimLib - - Update included wimlib to 1.13.5. + - Official support for ARM64 macOS. +- Replace .NET Standard 2.1 target with .NET Core 3.1. wim wimlib dism imagex archive native pinvoke interop - + @@ -36,8 +37,8 @@ Supports Windows, Linux and macOS. PreserveNewest - - + + runtimes\win-x86\native\%(FileName)%(Extension) PreserveNewest @@ -66,6 +67,10 @@ Supports Windows, Linux and macOS. runtimes\osx-x64\native\%(FileName)%(Extension) PreserveNewest + + runtimes\osx-arm64\native\%(FileName)%(Extension) + PreserveNewest + @@ -81,5 +86,10 @@ Supports Windows, Linux and macOS. + + + + + diff --git a/ManagedWimLib/NativeStructs.cs b/ManagedWimLib/NativeStructs.cs index 3ccd36d..998c7ad 100644 --- a/ManagedWimLib/NativeStructs.cs +++ b/ManagedWimLib/NativeStructs.cs @@ -1282,8 +1282,6 @@ public enum CompressorFlags : uint #region Native wimlib structures #region WimInfo [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")] - [SuppressMessage("ReSharper", "PrivateFieldCanBeConvertedToLocalVariable")] public class WimInfo { /// diff --git a/ManagedWimLib/WimLibLoader.cs b/ManagedWimLib/WimLibLoader.cs index ab3f3e7..f2311f5 100644 --- a/ManagedWimLib/WimLibLoader.cs +++ b/ManagedWimLib/WimLibLoader.cs @@ -23,24 +23,11 @@ You should have received a copy of the GNU Lesser General Public License using Joveler.DynLoader; using System; -using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Runtime.InteropServices; -// ReSharper disable FieldCanBeMadeReadOnly.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Global -// ReSharper disable StringLiteralTypo -// ReSharper disable ClassNeverInstantiated.Global -// ReSharper disable InconsistentNaming -// ReSharper disable EnumUnderlyingTypeIsInt -// ReSharper disable FieldCanBeMadeReadOnly.Local -// ReSharper disable PrivateFieldCanBeConvertedToLocalVariable -#pragma warning disable 169 -#pragma warning disable 414 -#pragma warning disable 649 + #pragma warning disable IDE0044 -#pragma warning disable IDE0063 // 간단한 'using' 문 사용 namespace ManagedWimLib { @@ -556,7 +543,6 @@ protected override void ResetFunctions() #region WimLib Function Pointers #region UTF-16 Instances - [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] internal class Utf16d { internal const UnmanagedType StrType = UnmanagedType.LPWStr; @@ -923,7 +909,6 @@ public CaptureSourceBaseL64(string fsSourcePath, string wimTargetPath) #endregion #region UTF-8 Instances - [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] internal class Utf8d { internal const UnmanagedType StrType = UnmanagedType.LPStr; diff --git a/ManagedWimLib/WimStruct.cs b/ManagedWimLib/WimStruct.cs index 5b92865..6e8f832 100644 --- a/ManagedWimLib/WimStruct.cs +++ b/ManagedWimLib/WimStruct.cs @@ -28,11 +28,9 @@ You should have received a copy of the GNU Lesser General Public License using System.IO; using System.Linq; using System.Runtime.InteropServices; -// ReSharper disable UnusedMember.Global namespace ManagedWimLib { - [SuppressMessage("ReSharper", "RedundantExplicitArraySize")] public class Wim : IDisposable { // Wrapper of WIMStruct and wimlib API #region (static) LoadManager diff --git a/ManagedWimLib/runtimes/osx-arm64/native/libwim.dylib b/ManagedWimLib/runtimes/osx-arm64/native/libwim.dylib new file mode 100755 index 0000000..e3e14ee Binary files /dev/null and b/ManagedWimLib/runtimes/osx-arm64/native/libwim.dylib differ diff --git a/README.md b/README.md index c0dd519..4a49561 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ ManagedWimLib can be installed via [nuget](https://www.nuget.org/packages/Manage ### Targeted .NET platforms -- .NET Standard 2.1 (.NET Core 3.0+) -- .NET Standard 2.0 (.NET Framework 4.6.1+, .NET Core 2.0+) +- .NET Core 3.1 +- .NET Standard 2.0 - .NET Framework 4.5.1 If you need .NET Standard 1.3 support, use [1.2.x version](https://www.nuget.org/packages/ManagedWimLib/1.2.4) instead.
@@ -43,8 +43,7 @@ If you need .NET Framework 4.5 support, use [1.1.x version](https://www.nuget.or | | arm | Yes | | | arm64 | Yes | | macOS | x64 | Yes | - -macOS arm64 should be supported on theory, but I do not have access to an Apple Sillicon device to test. Please contribute if you have an ARM64 macOS machine. +| | arm64 | Yes | #### Tested linux distributions diff --git a/USAGE.md b/USAGE.md index 0942bfe..b0b5b5f 100644 --- a/USAGE.md +++ b/USAGE.md @@ -36,11 +36,12 @@ public static void InitNativeLibrary() } ``` -#### For .NET Standard 2.0+: +#### For .NET Standard 2.0+, NET Core 3.1+: ```cs public static void InitNativeLibrary() { + string libBaseDir = AppDomain.CurrentDomain.BaseDirectory; string libDir = "runtimes"; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) libDir = Path.Combine(libDir, "win-"); @@ -66,13 +67,14 @@ public static void InitNativeLibrary() } libDir = Path.Combine(libDir, "native"); + // macOS ARM64 requires native library path to be absolute path. string libPath = null; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - libPath = Path.Combine(libDir, "libwim-15.dll"); + libPath = Path.Combine(libBaseDir, libDir, "libwim-15.dll"); else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - libPath = Path.Combine(libDir, "libwim.so"); + libPath = Path.Combine(libBaseDir, libDir, "libwim.so"); else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - libPath = Path.Combine(libDir, "libwim.dylib"); + libPath = Path.Combine(libBaseDir, libDir, "libwim.dylib"); if (libPath == null) throw new PlatformNotSupportedException($"Unable to find native library."); @@ -100,17 +102,18 @@ ManagedWimLib comes with sets of binaries of `wimlib 1.13.4`. They will be copie - Create an empty file named `ManagedWimLib.Precompiled.Exclude` in the project directory to prevent a copy of the package-embedded binary. -#### For .NET Standard 2.0+ +#### For .NET Standard 2.0, NET Core 3.1+ -| Platform | Binary | License | -|-------------------|-----------------------------------------------------|----------------------| -| Windows x86 | `$(OutDir)\runtimes\win-x86\native\libwim-15.dll` | LGPLv3 | -| Windows x64 | `$(OutDir)\runtimes\win-x64\native\libwim-15.dll` | LGPLv3 | -| Windows arm64 | `$(OutDir)\runtimes\win-arm64\native\libwim-15.dll` | LGPLv3 | -| Ubuntu 20.04 x64 | `$(OutDir)\runtimes\linux-x64\native\libwim.so` | LGPLv3 (w/o NTFS-3G) | -| Debian 11 armhf | `$(OutDir)\runtimes\linux-arm\native\libwim.so` | LGPLv3 (w/o NTFS-3G) | -| Debian 11 arm64 | `$(OutDir)\runtimes\linux-arm64\native\libwim.so` | LGPLv3 (w/o NTFS-3G) | -| macOS Big Sur x64 | `$(OutDir)\runtimes\osx-x64\native\libwim.dylib` | LGPLv3 (w/o NTFS-3G) | +| Platform | Binary | License | +|----------------------|-----------------------------------------------------|----------------------| +| Windows x86 | `$(OutDir)\runtimes\win-x86\native\libwim-15.dll` | LGPLv3 | +| Windows x64 | `$(OutDir)\runtimes\win-x64\native\libwim-15.dll` | LGPLv3 | +| Windows arm64 | `$(OutDir)\runtimes\win-arm64\native\libwim-15.dll` | LGPLv3 | +| Ubuntu 20.04 x64 | `$(OutDir)\runtimes\linux-x64\native\libwim.so` | LGPLv3 (w/o NTFS-3G) | +| Debian 11 armhf | `$(OutDir)\runtimes\linux-arm\native\libwim.so` | LGPLv3 (w/o NTFS-3G) | +| Debian 11 arm64 | `$(OutDir)\runtimes\linux-arm64\native\libwim.so` | LGPLv3 (w/o NTFS-3G) | +| macOS Big Sur x64 | `$(OutDir)\runtimes\osx-x64\native\libwim.dylib` | LGPLv3 (w/o NTFS-3G) | +| macOS Monterey arm64 | `$(OutDir)\runtimes\osx-arm64\native\libwim.dylib` | LGPLv3 (w/o NTFS-3G) | - Linux binaries are not portable. Included binaires may not work on your distribution. - On Linux, wimlib depends on system-installed `libfuse`. @@ -120,15 +123,16 @@ ManagedWimLib comes with sets of binaries of `wimlib 1.13.4`. They will be copie #### Build Command -| Platform | Binary Source | Dependency | -|-------------------|---------------------------------------------------------------------------------------|-----------------| -| Windows x86 | [Official Release](https://wimlib.net/downloads/wimlib-1.13.3-windows-i686-bin.zip) | - | -| Windows x64 | [Official Release](https://wimlib.net/downloads/wimlib-1.13.3-windows-x86_64-bin.zip) | - | -| Windows arm64 | Compile with MSYS2 and llvm-mingw | - | -| Ubuntu 20.04 x64 | Compile with libxml2 dependency | libfuse | -| Debian 11 armhf | Compile with libxml2 dependency | libfuse | -| Debian 11 arm64 | Compile with libxml2 dependency | libfuse | -| macOS Big Sur x64 | Compile with libxml2 dependency | - | +| Platform | Binary Source | Dependency | +|----------------------|---------------------------------------------------------------------------------------|-----------------| +| Windows x86 | [Official Release](https://wimlib.net/downloads/wimlib-1.13.5-windows-i686-bin.zip) | - | +| Windows x64 | [Official Release](https://wimlib.net/downloads/wimlib-1.13.5-windows-x86_64-bin.zip) | - | +| Windows arm64 | Compile with MSYS2 and llvm-mingw | - | +| Ubuntu 20.04 x64 | Compile with libxml2 dependency | libfuse | +| Debian 11 armhf | Compile with libxml2 dependency | libfuse | +| Debian 11 arm64 | Compile with libxml2 dependency | libfuse | +| macOS Big Sur x64 | Compile with libxml2 dependency | - | +| macOS Monterey arm64 | Compile with libxml2 dependency | - | ### Custom binary diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e355db0..c2881b3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -40,4 +40,18 @@ steps: inputs: command: 'test' projects: '**/*.Tests/*.csproj' - arguments: '--configuration $(buildConfiguration) --logger="console;verbosity=detailed"' + arguments: '--configuration $(buildConfiguration) --logger="console;verbosity=detailed" --collect:"XPlat Code Coverage" --settings:"$(Build.SourcesDirectory)/coverlet.runsettings"' +# https://stackoverflow.com/questions/64592534/publish-a-pipeline-azure-devops-code-coverage-report +- task: DotNetCoreCLI@2 + displayName: 'Install ReportGenerator Tool' + inputs: + command: 'custom' + custom: 'tool' + arguments: 'install --global dotnet-reportgenerator-globaltool' +- script: 'reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:"$(Build.ArtifactStagingDirectory)/coverlet" -reporttypes:"Cobertura" -verbosity:"Verbose"' + displayName: 'Merge Code Coverage Reports' +- task: PublishCodeCoverageResults@1 + displayName: 'Publish Code Coverage Report' + inputs: + codeCoverageTool: 'Cobertura' + summaryFileLocation: '$(Build.ArtifactStagingDirectory)/coverlet/Cobertura.xml' diff --git a/coverlet.runsettings b/coverlet.runsettings new file mode 100644 index 0000000..2e26590 --- /dev/null +++ b/coverlet.runsettings @@ -0,0 +1,12 @@ + + + + + + + cobertura + + + + + \ No newline at end of file