diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index f2f801ea36..275bb76aaf 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -259,71 +259,62 @@ blocks: commands: - C:\msys64\usr\bin\bash -lc './packaging/mingw-w64/semaphoreci-build.sh --static ./artifacts/librdkafka.tgz' - # Disabled because of CoApp discontinuation, need to find an alternative - # before next release. - # - # - name: 'Windows x64: Windows SDK 10.0 / MSVC v142 / VS 2019' - # dependencies: [] - # task: - # agent: - # machine: - # type: s1-prod-windows - # env_vars: - # # Disable vcpkg telemetry - # - name: VCPKG_DISABLE_METRICS - # value: 'yes' - # prologue: - # commands: - # # install vcpkg in the parent directory. - # - pwd - # - cd .. - # # Restore vcpkg caches, if any. - # - cache restore vcpkg-archives-$Env:ARTIFACT_KEY - # # Setup vcpkg - # - "& .\\librdkafka\\win32\\setup-vcpkg.ps1" - # - cd librdkafka - # - ..\vcpkg\vcpkg integrate install - # # Install required packages. - # - ..\vcpkg\vcpkg --feature-flags=versions install --triplet $Env:triplet - # - cd .. - # - pwd - # # Store vcpkg caches - # - ls vcpkg/ - # - echo $Env:VCPKG_ROOT - # - cache delete vcpkg-archives-$Env:ARTIFACT_KEY - # - cache store vcpkg-archives-$Env:ARTIFACT_KEY C:/Users/semaphore/AppData/Local/vcpkg/archives - # - pwd - # - cd librdkafka - # # coapp is needed for creating the intermediary nuget packages. - # #- "& .\\win32\\install-coapp.ps1" - # epilogue: - # commands: - # - Get-ChildItem . -include *.dll -recurse - # - Get-ChildItem . -include *.lib -recurse - # - if ($env:SEMAPHORE_GIT_TAG_NAME -ne "") { artifact push workflow artifacts/ --destination artifacts/$Env:ARTIFACT_KEY/ } - # jobs: - # - name: 'Build: MSVC x64' - # env_vars: - # - name: triplet - # value: x64-windows - # - name: ARTIFACT_KEY - # value: p-librdkafka__plat-windows__dist-msvc__arch-x64__lnk-std - # commands: - # - "& .\\win32\\msbuild.ps1 -config Release -platform x64" - # # Disabled because of CoApp discontinuation, need to find an alternative - # # before next release. - # #- "& .\\win32\\package-nuget.ps1 -destdir .\\artifacts\\" - # - name: 'Build: MSVC x86' - # env_vars: - # - name: triplet - # value: x86-windows - # - name: ARTIFACT_KEY - # value: p-librdkafka__plat-windows__dist-msvc__arch-x86__lnk-std - # commands: - # - "& .\\win32\\msbuild.ps1 -config Release -platform Win32" - # # Disabled because of CoApp discontinuation, need to find an alternative - # # before next release. - # #- "& .\\win32\\package-nuget.ps1 -destdir .\\artifacts\\" + - name: 'Windows x64: Windows SDK 10.0 / MSVC v142 / VS 2019' + dependencies: [] + task: + agent: + machine: + type: s1-prod-windows + env_vars: + # Disable vcpkg telemetry + - name: VCPKG_DISABLE_METRICS + value: 'yes' + prologue: + commands: + # install vcpkg in the parent directory. + - pwd + - cd .. + # Restore vcpkg caches, if any. + - cache restore vcpkg-archives-$Env:ARTIFACT_KEY + # Setup vcpkg + - "& .\\librdkafka\\win32\\setup-vcpkg.ps1" + - cd librdkafka + - ..\vcpkg\vcpkg integrate install + # Install required packages. + - ..\vcpkg\vcpkg --feature-flags=versions install --triplet $Env:triplet + - cd .. + - pwd + # Store vcpkg caches + - ls vcpkg/ + - echo $Env:VCPKG_ROOT + - cache delete vcpkg-archives-$Env:ARTIFACT_KEY + - cache store vcpkg-archives-$Env:ARTIFACT_KEY C:/Users/semaphore/AppData/Local/vcpkg/archives + - pwd + - cd librdkafka + epilogue: + commands: + - Get-ChildItem . -include *.dll -recurse + - Get-ChildItem . -include *.lib -recurse + - if ($env:SEMAPHORE_GIT_TAG_NAME -ne "") { artifact push workflow artifacts/ --destination artifacts/$Env:ARTIFACT_KEY/ } + jobs: + - name: 'Build: MSVC x64' + env_vars: + - name: triplet + value: x64-windows + - name: ARTIFACT_KEY + value: p-librdkafka__plat-windows__dist-msvc__arch-x64__lnk-std + commands: + - "& .\\win32\\msbuild.ps1 -platform x64" + - "& .\\win32\\package-zip.ps1 -platform x64" + - name: 'Build: MSVC x86' + env_vars: + - name: triplet + value: x86-windows + - name: ARTIFACT_KEY + value: p-librdkafka__plat-windows__dist-msvc__arch-x86__lnk-std + commands: + - "& .\\win32\\msbuild.ps1 -platform Win32" + - "& .\\win32\\package-zip.ps1 -platform Win32" - name: 'Packaging' dependencies: @@ -333,10 +324,7 @@ blocks: - 'Linux x64: release artifact docker builds' - 'Linux arm64: release artifact docker builds' - 'Windows x64: MinGW-w64' - # Disabled because of CoApp discontinuation, need to find an alternative - # before next release. - # - #- 'Windows x64: Windows SDK 10.0 / MSVC v142 / VS 2019' + - 'Windows x64: Windows SDK 10.0 / MSVC v142 / VS 2019' run: when: "tag =~ '^v[0-9]\\.'" task: diff --git a/packaging/nuget/nugetpackage.py b/packaging/nuget/nugetpackage.py index 01716b4568..aea05ade02 100644 --- a/packaging/nuget/nugetpackage.py +++ b/packaging/nuget/nugetpackage.py @@ -109,128 +109,128 @@ class NugetPackage (Package): './usr/local/lib/librdkafka.so.1', 'runtimes/linux-x64/native/alpine-librdkafka.so'), - # Disabled before Coapp replacement - # # Common Win runtime - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'msvcr140.zip', - # 'vcruntime140.dll', - # 'runtimes/win-x64/native/vcruntime140.dll'), - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'msvcr140.zip', - # 'msvcp140.dll', 'runtimes/win-x64/native/msvcp140.dll'), - # # matches librdkafka.redist.{VER}.nupkg - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/x64/Release/librdkafka.dll', - # 'runtimes/win-x64/native/librdkafka.dll'), - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/x64/Release/librdkafkacpp.dll', - # 'runtimes/win-x64/native/librdkafkacpp.dll'), - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/x64/Release/libcrypto-3-x64.dll', - # 'runtimes/win-x64/native/libcrypto-3-x64.dll'), - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/x64/Release/libssl-3-x64.dll', - # 'runtimes/win-x64/native/libssl-3-x64.dll'), - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/x64/Release/zlib1.dll', - # 'runtimes/win-x64/native/zlib1.dll'), - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/x64/Release/zstd.dll', - # 'runtimes/win-x64/native/zstd.dll'), - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/x64/Release/libcurl.dll', - # 'runtimes/win-x64/native/libcurl.dll'), - # # matches librdkafka.{VER}.nupkg - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka*.nupkg', - # 'build/native/lib/v142/x64/Release/librdkafka.lib', - # 'build/native/lib/win/x64/win-x64-Release/v142/librdkafka.lib', # noqa: E501 - # artifact_fname_excludes=['redist', 'symbols']), - # Mapping({'arch': 'x64', - # 'plat': 'win'}, - # 'librdkafka*.nupkg', - # 'build/native/lib/v142/x64/Release/librdkafkacpp.lib', - # 'build/native/lib/win/x64/win-x64-Release/v142/librdkafkacpp.lib', # noqa: E501 - # artifact_fname_excludes=['redist', 'symbols']), + # Common Win runtime + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'msvcr140.zip', + 'vcruntime140.dll', + 'runtimes/win-x64/native/vcruntime140.dll'), + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'msvcr140.zip', + 'msvcp140.dll', 'runtimes/win-x64/native/msvcp140.dll'), + + # matches x64 librdkafka.redist.zip + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/x64/Release/librdkafka.dll', + 'runtimes/win-x64/native/librdkafka.dll'), + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/x64/Release/librdkafkacpp.dll', + 'runtimes/win-x64/native/librdkafkacpp.dll'), + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/x64/Release/libcrypto-3-x64.dll', + 'runtimes/win-x64/native/libcrypto-3-x64.dll'), + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/x64/Release/libssl-3-x64.dll', + 'runtimes/win-x64/native/libssl-3-x64.dll'), + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/x64/Release/zlib1.dll', + 'runtimes/win-x64/native/zlib1.dll'), + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/x64/Release/zstd.dll', + 'runtimes/win-x64/native/zstd.dll'), + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/x64/Release/libcurl.dll', + 'runtimes/win-x64/native/libcurl.dll'), + # matches x64 librdkafka.redist.zip, lib files + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/lib/v142/x64/Release/librdkafka.lib', + 'build/native/lib/win/x64/win-x64-Release/v142/librdkafka.lib' # noqa: E501 + ), + Mapping({'arch': 'x64', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/lib/v142/x64/Release/librdkafkacpp.lib', + 'build/native/lib/win/x64/win-x64-Release/v142/librdkafkacpp.lib' # noqa: E501 + ), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'msvcr140.zip', - # 'vcruntime140.dll', - # 'runtimes/win-x86/native/vcruntime140.dll'), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'msvcr140.zip', - # 'msvcp140.dll', 'runtimes/win-x86/native/msvcp140.dll'), - # # matches librdkafka.redist.{VER}.nupkg - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/Win32/Release/librdkafka.dll', - # 'runtimes/win-x86/native/librdkafka.dll'), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/Win32/Release/librdkafkacpp.dll', - # 'runtimes/win-x86/native/librdkafkacpp.dll'), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/Win32/Release/libcrypto-3.dll', - # 'runtimes/win-x86/native/libcrypto-3.dll'), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/Win32/Release/libssl-3.dll', - # 'runtimes/win-x86/native/libssl-3.dll'), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'msvcr140.zip', + 'vcruntime140.dll', + 'runtimes/win-x86/native/vcruntime140.dll'), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'msvcr140.zip', + 'msvcp140.dll', 'runtimes/win-x86/native/msvcp140.dll'), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/Win32/Release/zlib1.dll', - # 'runtimes/win-x86/native/zlib1.dll'), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/Win32/Release/zstd.dll', - # 'runtimes/win-x86/native/zstd.dll'), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka.redist*', - # 'build/native/bin/v142/Win32/Release/libcurl.dll', - # 'runtimes/win-x86/native/libcurl.dll'), + # matches Win32 librdkafka.redist.zip + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/Win32/Release/librdkafka.dll', + 'runtimes/win-x86/native/librdkafka.dll'), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/Win32/Release/librdkafkacpp.dll', + 'runtimes/win-x86/native/librdkafkacpp.dll'), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/Win32/Release/libcrypto-3.dll', + 'runtimes/win-x86/native/libcrypto-3.dll'), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/Win32/Release/libssl-3.dll', + 'runtimes/win-x86/native/libssl-3.dll'), - # # matches librdkafka.{VER}.nupkg - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka*.nupkg', - # 'build/native/lib/v142/Win32/Release/librdkafka.lib', - # 'build/native/lib/win/x86/win-x86-Release/v142/librdkafka.lib', # noqa: E501 - # artifact_fname_excludes=['redist', 'symbols']), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/Win32/Release/zlib1.dll', + 'runtimes/win-x86/native/zlib1.dll'), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/Win32/Release/zstd.dll', + 'runtimes/win-x86/native/zstd.dll'), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/bin/v142/Win32/Release/libcurl.dll', + 'runtimes/win-x86/native/libcurl.dll'), - # Mapping({'arch': 'x86', - # 'plat': 'win'}, - # 'librdkafka*.nupkg', - # 'build/native/lib/v142/Win32/Release/librdkafkacpp.lib', - # 'build/native/lib/win/x86/win-x86-Release/v142/librdkafkacpp.lib', # noqa: E501 - # artifact_fname_excludes=['redist', 'symbols']) + # matches Win32 librdkafka.redist.zip, lib files + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/lib/v142/Win32/Release/librdkafka.lib', + 'build/native/lib/win/x86/win-x86-Release/v142/librdkafka.lib' # noqa: E501 + ), + Mapping({'arch': 'x86', + 'plat': 'win'}, + 'librdkafka.redist*', + 'build/native/lib/v142/Win32/Release/librdkafkacpp.lib', + 'build/native/lib/win/x86/win-x86-Release/v142/librdkafkacpp.lib' # noqa: E501 + ) ] def __init__(self, version, arts): diff --git a/win32/README.md b/win32/README.md index b3f0eded30..4c52a9ec71 100644 --- a/win32/README.md +++ b/win32/README.md @@ -1,6 +1,5 @@ # Build guide for Windows * build.bat - Build for all combos of: Win32,x64,Release,Debug using the current msbuild toolset -* build-package.bat - Build NuGet packages (wrapper for package-nuget.ps1) -* package-nuget.ps1 - Build NuGet packages (using build.bat artifacts) -* push-package.bat - Push NuGet packages to NuGet (edit script for version) +* package-zip.ps1 - Build zip package (using build.bat artifacts) + diff --git a/win32/install-coapp.ps1 b/win32/install-coapp.ps1 deleted file mode 100644 index d96f36ee57..0000000000 --- a/win32/install-coapp.ps1 +++ /dev/null @@ -1,11 +0,0 @@ -# Download the CoApp tools. -$msiPath = "$($env:USERPROFILE)\\CoApp.Tools.Powershell.msi" - -(New-Object Net.WebClient).DownloadFile('https://github.com/coapp/coapp.github.io/blob/master/files/Latest.CoApp.Tools.Powershell.msi', $msiPath) - -# Install the CoApp tools from the downloaded .msi. -Start-Process -FilePath msiexec -ArgumentList /i, $msiPath, /quiet -Wait - -# Make the tools available for later PS scripts to use. -$env:PSModulePath = $env:PSModulePath + ';C:\\Program Files (x86)\\Outercurve Foundation\\Modules' -Import-Module CoApp diff --git a/win32/package-nuget.ps1 b/win32/package-nuget.ps1 deleted file mode 100644 index 25d89b1503..0000000000 --- a/win32/package-nuget.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -<# -.SYNOPSIS - - Create NuGet package using CoApp - - -.DESCRIPTION - - A full build must be completed, to populate output directories, before - - running this script. - - Use build.bat to build - - - Requires CoApp -#> - -param( - [string]$version='0.0.0', - [string]$destdir='.\artifacts' -) - -$autopkgFile = "win32/librdkafka.autopkg" -cat ($autopkgFile + ".template") | % { $_ -replace "@version", $version } > $autopkgFile - -Write-NuGetPackage $autopkgFile - -Move-Item -Path .\*.nupkg -Destination $destdir - diff --git a/win32/package-zip.ps1 b/win32/package-zip.ps1 new file mode 100644 index 0000000000..34dd0ab1aa --- /dev/null +++ b/win32/package-zip.ps1 @@ -0,0 +1,46 @@ +<# +.SYNOPSIS + + Create zip package + + +.DESCRIPTION + + A full build must be completed, to populate output directories, before + + running this script. + + Use build.bat to build + +#> + +param( + [string]$config='Release', + [string]$platform='x64', + [string]$toolset='v142', + [string]$version='0.0.0' +) + +$msbuild = (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe) + +echo "Packaging $config $platform $toolset" + +$bindir = "build\native\bin\${toolset}\${platform}\$config" +$libdir = "build\native\lib\${toolset}\${platform}\$config" +$srcdir = "win32\outdir\${toolset}\${platform}\$config" + +New-Item -Path $bindir -ItemType Directory +New-Item -Path $libdir -ItemType Directory + +$platformpart = "" +if ("x64" -eq $platform) { + $platformpart = "-${platform}" +} + +Copy-Item "${srcdir}\librdkafka.dll","${srcdir}\librdkafkacpp.dll", +"${srcdir}\libcrypto-3${platformpart}.dll","${srcdir}\libssl-3${platformpart}.dll", +"${srcdir}\zlib1.dll","${srcdir}\zstd.dll","${srcdir}\libcurl.dll" -Destination $bindir + +Copy-Item "${srcdir}\librdkafka.lib","${srcdir}\librdkafkacpp.lib" -Destination $libdir + +7z.exe a "artifacts\librdkafka.redist.zip" "build" diff --git a/win32/setup-vcpkg.ps1 b/win32/setup-vcpkg.ps1 index 4d23611410..c2bd78b84e 100644 --- a/win32/setup-vcpkg.ps1 +++ b/win32/setup-vcpkg.ps1 @@ -2,12 +2,12 @@ if (!(Test-Path -Path vcpkg/.git)) { git clone https://github.com/Microsoft/vcpkg.git -} else { - echo "Updating vcpkg git repo" - cd vcpkg - git pull - cd .. } +cd vcpkg +# latest version is having an issue while doing vcpkg integrate install +git checkout 328bd79eb8340b8958f567aaf5f8ffb81056cd36 +cd .. + .\vcpkg\bootstrap-vcpkg.bat