Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linux-musl-x64 runtime support #497

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Before raising any issues, please make as much effort as you can to rule out iss
For example, if you are using a self-hosted Pact Broker instance and PactNet is failing to connect, please ensure things like the
authentication token and SSL certificate are valid.

If you are sure that the issye is with PactNet then please raise an issue, including as many of the following details as you can:
If you are sure that the issue is with PactNet then please raise an issue, including as many of the following details as you can:

- PactNet version
- Your operating system and version
Expand Down Expand Up @@ -59,22 +59,23 @@ version by executing the script in Bash (or Git Bash on Windows):
build/download-native-libs.sh
```

Alternatively you can download a particular FFI version from the [pact-referece] releases or build your own version
Alternatively you can download a particular FFI version from the [pact-reference] releases or build your own version
locally, and then copy the artifacts into the folders:

```
build/
linux/
x86_64/
libpact_ffi.so
osx/
aarch64-apple-darwin/
libpact_ffi.dylib
x86_64/
libpact_ffi.dylib
windows/
x86_64/
pact_ffi.dll
├── linux
│ ├── x86_64
│ │ └── libpact_ffi.so
│ └── x86_64-musl
│ └── libpact_ffi.so
├── osx
│ ├── aarch64-apple-darwin
│ │ └── libpact_ffi.dylib
│ └── x86_64
│ └── libpact_ffi.dylib
└── windows
└── x86_64
└── pact_ffi.dll
```

After the native libraries are in the expected places then the solution can be built in your IDE or on the command
Expand Down
7 changes: 4 additions & 3 deletions build/download-native-libs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

FFI_VERSION="0.4.16"
FFI_VERSION="0.4.19"
FFI_BASE_URL="https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v$FFI_VERSION"

GREEN="\e[32m"
Expand Down Expand Up @@ -42,10 +42,10 @@ download_native() {

if [[ "$OSTYPE" == "darwin"* ]]; then
# OSX requires an empty arg passed to -i, but this doesn't work on Lin/Win
sed -Ei '' "s|../release_artifacts/.+$|$path/$dest_file|" "$path/$dest_file.sha256"
sed -Ei '' "s|\s+.+$|\ *$path/$dest_file|" "$path/$dest_file.sha256"
shasum -a 256 --check --quiet "$path/$dest_file.sha256"
else
sed -Ei "s|../release_artifacts/.+$|$path/$dest_file|" "$path/$dest_file.sha256"
sed -Ei "s|\s+.+$|\ *$path/$dest_file|" "$path/$dest_file.sha256"
sha256sum --check --quiet "$path/$dest_file.sha256"
fi

Expand All @@ -60,5 +60,6 @@ download_native() {

download_native "pact_ffi" "windows" "x86_64" "dll"
download_native "libpact_ffi" "linux" "x86_64" "so"
download_native "libpact_ffi" "linux" "x86_64-musl" "so"
download_native "libpact_ffi" "osx" "x86_64" "dylib"
download_native "libpact_ffi" "osx" "aarch64-apple-darwin" "dylib"
13 changes: 3 additions & 10 deletions src/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@
<DebugSymbols>true</DebugSymbols>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<VersionPrefix>5.0.0</VersionPrefix>
<VersionPrefix>5.1.0</VersionPrefix>
<PackageReleaseNotes>
v5.0.0
- BREAKING CHANGE: Remove obsolete WithNativeBackend calls
- BREAKING CHANGE: Remove obsolete IMessagePact and MessagePact
- BREAKING CHANGE: Refactor verifier to support verifying combined HTTP and message pacts
- BREAKING CHANGE: Replace Newtonsoft with System.Text.Json
- BREAKING CHANGE: Minimum supported .Net Framework version is now 4.6.2 instead of 4.6.1
- feat: Add Pact Specification v4 support
- feat: MacOS ARM64 target is now fully supported
- feat: More efficient and robust messaging interaction verification
v5.1.0
- feat: Add linux-musl-x64 runtime support
</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
7 changes: 7 additions & 0 deletions src/PactNet/PactNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
<CopyToOutputDirectory Condition="'$(IsLinux)'">PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildProjectDirectory)\..\..\build\linux\x86_64-musl\libpact_ffi.so">
<Link>libpact_ffi.so</Link>
<PackagePath>runtimes/linux-musl-x64/native</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory Condition="'$(IsLinux)'">PreserveNewest</CopyToOutputDirectory>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs an additional condition to only unpack on musl targets, which last time I tried to do this wasn't possible.

The libc and musl versions are both just called libpact_ffi.so and so their names conflict and it's unclear which one you actually get.

If you get the musl version where previously you get the libc version then this is a breaking change.

It's the same reason why the Mac version has two conditions below, so you don't end up with the ARM version on x86 and vice versa.

<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildProjectDirectory)\..\..\build\osx\x86_64\libpact_ffi.dylib">
<Link>libpact_ffi.dylib</Link>
<PackagePath>runtimes/osx-x64/native</PackagePath>
Expand Down