diff --git a/.gitmodules b/.gitmodules index f3d230c4..0b515221 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "external/libzip"] path = external/libzip url = https://github.com/nih-at/libzip.git +[submodule "external/vcpkg"] + path = external/vcpkg + url = https://github.com/Microsoft/vcpkg diff --git a/LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj b/LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj index b280deb2..ea2cb2a2 100644 --- a/LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj +++ b/LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj @@ -1,7 +1,8 @@  - net471 + net471 + $(TargetFrameworks);netcoreapp3.1 false true @@ -9,11 +10,11 @@ - - + + - + @@ -32,8 +33,8 @@ mono - \ No newline at end of file diff --git a/LibZipSharp.props b/LibZipSharp.props index 2fc0f023..9eeb7b53 100644 --- a/LibZipSharp.props +++ b/LibZipSharp.props @@ -1,5 +1,5 @@ - <_LibZipSharpNugetVersion>1.0.10 + <_LibZipSharpNugetVersion>1.0.11 \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0102fe0d..ab9201a5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,6 +14,51 @@ variables: stages: - stage: Build jobs: + - job: buildWindows + pool: + vmImage: vs2017-win2016 + steps: + - script: | + echo "Hello" + git submodule update --init --recursive + cd external/vcpkg + bootstrap-vcpkg.bat + displayName: "Build vcpkg" + - script: | + external\vcpkg\vcpkg.exe integrate install + external\vcpkg\vcpkg.exe install zlib:x64-windows-static bzip2:x64-windows-static + mkdir .\build\Windows\64 + cd .\build\Windows\64 + cmake -DCMAKE_TOOLCHAIN_FILE=..\..\..\external\vcpkg\scripts\buildsystems\vcpkg.cmake ..\..\..\external\libzip -G "Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=on -DVCPKG_TARGET_TRIPLET=x64-windows-static + cmake --build . --config Release + displayName: "x64 Build" + - script: | + external\vcpkg\vcpkg.exe integrate install + external\vcpkg\vcpkg.exe install zlib:x86-windows-static bzip2:x86-windows-static + mkdir .\build\Windows\32 + cd .\build\Windows\32 + cmake -DCMAKE_TOOLCHAIN_FILE=..\..\..\external\vcpkg\scripts\buildsystems\vcpkg.cmake ..\..\..\external\libzip -G "Visual Studio 15 2017" -DBUILD_SHARED_LIBS=on -DVCPKG_TARGET_TRIPLET=x86-windows-static + cmake --build . --config Release + displayName: "x86 Build" + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: build\Windows\64\lib\Release\zip.dll + includeRootFolder: false + archiveType: 7z + replaceExistingArchive: true + archiveFile: $(Build.ArtifactStagingDirectory)\libzip-windows-x86.7z + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: build\Windows\64\lib\Release\zip.dll + includeRootFolder: false + archiveType: 7z + replaceExistingArchive: true + archiveFile: $(Build.ArtifactStagingDirectory)\libzip-windows-x64.7z + - task: PublishBuildArtifacts@1 + displayName: upload artifacts + inputs: + artifactName: 'native' + pathtoPublish: $(Build.ArtifactStagingDirectory) - job: buildlinux pool: vmImage: ubuntu-16.04 @@ -36,14 +81,14 @@ stages: displayName: 'Build Linux x86' - task: ArchiveFiles@2 inputs: - rootFolderOrFile: build/Linux/32/lib/libzip.so.5.0 + rootFolderOrFile: build/Linux/32/lib/libzip.so.5.1 includeRootFolder: false archiveType: 7z replaceExistingArchive: true archiveFile: $(Build.ArtifactStagingDirectory)/libzip-linux-x86.7z - task: ArchiveFiles@2 inputs: - rootFolderOrFile: build/Linux/64/lib/libzip.so.5.0 + rootFolderOrFile: build/Linux/64/lib/libzip.so.5.1 includeRootFolder: false archiveType: 7z replaceExistingArchive: true @@ -54,21 +99,23 @@ stages: artifactName: 'native' pathtoPublish: $(Build.ArtifactStagingDirectory) - job: build - dependsOn: buildlinux + dependsOn: + - buildlinux + - buildWindows pool: - vmImage: xcode9-macos10.13 + vmImage: macOS-10.14 steps: - bash: | - brew tap xamarin/xamarin-android-windeps - brew upgrade https://raw.githubusercontent.com/Homebrew/homebrew-core/a6542037a48a55061a4c319e6bb174b3715f7cbe/Formula/mingw-w64.rb - brew install mingw-w64 p7zip - brew install ninja xamarin/xamarin-android-windeps/mingw-zlib + brew install p7zip ninja git submodule update --init --recursive - bash: | HOSTOS=Darwin ./build_native - ./build_windows + displayName: 'Build Darwin' + - bash: | mkdir -p build/Linux/64 mkdir -p build/Linux/32 + mkdir -p build/Windows/64 + mkdir -p build/Windows/32 find build/* | grep libzip - task: DownloadBuildArtifacts@0 displayName: download artifacts @@ -85,10 +132,23 @@ stages: inputs: archiveFilePatterns: $(Build.ArtifactStagingDirectory)/native/libzip-linux-x86.7z destinationFolder: build/Linux/32 + - task: ExtractFiles@1 + displayName: Extract 64 bit Windows native + inputs: + archiveFilePatterns: $(Build.ArtifactStagingDirectory)/native/libzip-windows-x64.7z + destinationFolder: build/Windows/64 + - task: ExtractFiles@1 + displayName: Extract 32 bit Windows native + inputs: + archiveFilePatterns: $(Build.ArtifactStagingDirectory)/native/libzip-windows-x86.7z + destinationFolder: build/Windows/32 - bash: | - mv build/Linux/32/libzip.so.5.0 build/Linux/32/libzip.so - mv build/Linux/64/libzip.so.5.0 build/Linux/64/libzip.so + mv build/Linux/32/libzip.so.5.1 build/Linux/32/libzip.so + mv build/Linux/64/libzip.so.5.1 build/Linux/64/libzip.so + mv build/Windows/32/zip.dll build/Windows/32/libzip.dll + mv build/Windows/64/zip.dll build/Windows/64/libzip.dll rm $(Build.ArtifactStagingDirectory)/native/libzip-linux-*.7z + rm $(Build.ArtifactStagingDirectory)/native/libzip-windows-*.7z displayName: 'Find libzip' - task: MSBuild@1 displayName: 'Build solution libZipSharp.csproj' @@ -136,22 +196,37 @@ stages: solution: LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj configuration: Release msbuildArguments: /restore /t:RunNunitTests /p:ReferenceNuget=True /v:diag + - task: DotNetCoreCLI@2 + displayName: "Run Tests under .net Core" + inputs: + command: test + projects: 'LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj' + arguments: '--configuration Release --framework netcoreapp3.1 --no-build' - job: testmacos displayName: 'Test MacOS' pool: - vmImage: xcode9-macos10.13 + vmImage: macOS-10.14 steps: - task: DownloadBuildArtifacts@0 displayName: download artifacts inputs: artifactName: NuGet downloadPath: $(Build.SourcesDirectory) + - task: UseDotNet@2 + inputs: + version: '3.1.x' - task: MSBuild@1 displayName: 'Build solution LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj' inputs: solution: LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj configuration: Release msbuildArguments: /restore /t:RunNunitTests /p:ReferenceNuget=True /v:diag + # - task: DotNetCoreCLI@2 + # displayName: "Run Tests under .net Core" + # inputs: + # command: test + # projects: 'LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj' + # arguments: '--configuration Release --framework netcoreapp3.1 --no-build' - job: testwindows displayName: 'Test Windows' pool: @@ -163,11 +238,17 @@ stages: artifactName: NuGet downloadPath: $(Build.SourcesDirectory) - task: MSBuild@1 - displayName: 'Build solution LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj' + displayName: 'Build solution LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj and Run tests' inputs: solution: LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj configuration: Release msbuildArguments: /restore /t:RunNunitTests /p:ReferenceNuget=True /v:diag + - task: DotNetCoreCLI@2 + displayName: "Run Tests under .net Core" + inputs: + command: test + projects: 'LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj' + arguments: '--configuration Release --framework netcoreapp3.1 --no-build' - stage: Publish dependsOn: Test condition: eq(variables['System.TeamProject'], 'devdiv') # only sign the packages when running on Windows, and using the private server which has the certificates diff --git a/external/libzip b/external/libzip index b95cf3fd..4e3e0351 160000 --- a/external/libzip +++ b/external/libzip @@ -1 +1 @@ -Subproject commit b95cf3fdd4c1271f922017f092d02a878873425c +Subproject commit 4e3e0351a2f99735f98578f4e68d28ac80f8a94d diff --git a/external/vcpkg b/external/vcpkg new file mode 160000 index 00000000..7365cd74 --- /dev/null +++ b/external/vcpkg @@ -0,0 +1 @@ +Subproject commit 7365cd74ef79a1f5f7a7bd6ff064a3e573ca4baa diff --git a/libZipSharp.csproj b/libZipSharp.csproj index eace8d2b..2ffb7b23 100644 --- a/libZipSharp.csproj +++ b/libZipSharp.csproj @@ -43,9 +43,9 @@ libZipSharp.dll.config PreserveNewest - - - + + + diff --git a/libzip-static.patch b/libzip-static.patch index 3a6513e5..eac59d6e 100644 --- a/libzip-static.patch +++ b/libzip-static.patch @@ -2,12 +2,11 @@ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 92c4becc..e58b7db3 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt -@@ -211,7 +211,7 @@ ENDIF() - - ADD_LIBRARY(zip ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPTIONAL_FILES} ${LIBZIP_OPSYS_FILES}) - SET_TARGET_PROPERTIES(zip PROPERTIES VERSION 5.0 SOVERSION 5) --TARGET_LINK_LIBRARIES(zip ${ZLIB_LIBRARY} ${OPTIONAL_LIBRARY}) -+TARGET_LINK_LIBRARIES(zip ${ZLIB_LIBRARY} ${OPTIONAL_LIBRARY} OpenSSL::Crypto -ldl -pthread) +@@ -228,7 +228,7 @@ ENDIF() + + +-TARGET_LINK_LIBRARIES(zip PRIVATE ${ZLIB_LIBRARIES} ${OPTIONAL_LIBRARY}) ++TARGET_LINK_LIBRARIES(zip PRIVATE ${ZLIB_LIBRARY} ${OPTIONAL_LIBRARY} OpenSSL::Crypto -ldl -pthread) INSTALL(TARGETS zip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}