Skip to content

Commit

Permalink
chore(ffi): Update to FFI 0.4.23
Browse files Browse the repository at this point in the history
This involves a breaking change in the FFI packaging for MacOS which was
introduced in version 0.4.21:

https://github.com/pact-foundation/pact-reference/releases/tag/libpact_ffi-v0.4.21
  • Loading branch information
adamrodger committed Sep 8, 2024
1 parent 4318a4a commit 27df006
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ PactNet/Files/pact/
tools/
build/tools/
build/linux/
build/osx/
build/macos/
build/windows/
dist/

Expand Down
40 changes: 23 additions & 17 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.23"
FFI_BASE_URL="https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v$FFI_VERSION"

GREEN="\e[32m"
Expand All @@ -20,45 +20,51 @@ download_native() {
# e.g.
# pact_ffi-windows-x86_64.dll.gz
# libpact_ffi-linux-x86_64.so.gz
# libpact_ffi-osx-x86_64.dylib.gz
src_file="$file-$os-$platform.$extension.gz"
url="$FFI_BASE_URL/$src_file"
# libpact_ffi-macos-x86_64.dylib.gz
src_file="$file-$os-$platform.$extension"
src_archive="$src_file.gz"
src_sha="$src_archive.sha256"
dest_file="$file.$extension"
url="$FFI_BASE_URL/$src_archive"
sha="$url.sha256"

path="$base_path/$os/$platform"
dest_file="$file.$extension.gz"
mkdir -p "$path"
pushd $path > /dev/null

echo -e "Downloading FFI library for ${YELLOW}$os/$platform${CLEAR}"
echo -e " Destination: ${BLUE}$path/$dest_file${CLEAR}"
echo -e " Destination: ${BLUE}$path/$src_archive${CLEAR}"
echo -e " URL: ${BLUE}$url${CLEAR}"

echo -n " Downloading... "
curl --silent -L "$url" -o "$path/$dest_file"
curl --silent -L "$sha" -o "$path/$dest_file.sha256"
curl --silent -L "$url" -o "$src_archive"
curl --silent -L "$sha" -o "$src_archive.sha256"
echo -e "${GREEN}OK${CLEAR}"

echo -n " Verifying... "

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"
shasum -a 256 --check --quiet "$path/$dest_file.sha256"
shasum -a 256 --check --quiet "$src_sha"
else
sed -Ei "s|../release_artifacts/.+$|$path/$dest_file|" "$path/$dest_file.sha256"
sha256sum --check --quiet "$path/$dest_file.sha256"
sha256sum --check --quiet "$src_sha"
fi

rm "$path/$dest_file.sha256"
echo -e "${GREEN}OK${CLEAR}"

echo -n " Extracting... "
gunzip -f "$path/$dest_file"
gunzip -f "$src_archive"
echo -e "${GREEN}OK${CLEAR}"
echo ""

mv "$src_file" "$dest_file"
rm "$src_sha"

popd > /dev/null
}

download_native "pact_ffi" "windows" "x86_64" "dll"
download_native "libpact_ffi" "linux" "x86_64" "so"
download_native "libpact_ffi" "osx" "x86_64" "dylib"
download_native "libpact_ffi" "osx" "aarch64-apple-darwin" "dylib"
download_native "libpact_ffi" "macos" "x86_64" "dylib"
download_native "libpact_ffi" "macos" "aarch64" "dylib"

echo "Successfully downloaded FFI libraries"
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@
],
"metadata": {
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "4.0"
Expand Down
4 changes: 2 additions & 2 deletions src/PactNet/PactNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
<CopyToOutputDirectory Condition="'$(IsLinux)'">PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildProjectDirectory)\..\..\build\osx\x86_64\libpact_ffi.dylib">
<Content Include="$(MSBuildProjectDirectory)\..\..\build\macos\x86_64\libpact_ffi.dylib">
<Link>libpact_ffi.dylib</Link>
<PackagePath>runtimes/osx-x64/native</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory Condition="'$(IsOSX)' == 'True' And '$(IsArm64)' == 'False'">PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildProjectDirectory)\..\..\build\osx\aarch64-apple-darwin\libpact_ffi.dylib">
<Content Include="$(MSBuildProjectDirectory)\..\..\build\macos\aarch64\libpact_ffi.dylib">
<Link>libpact_ffi.dylib</Link>
<PackagePath>runtimes/osx-arm64/native</PackagePath>
<Pack>true</Pack>
Expand Down
4 changes: 2 additions & 2 deletions tests/PactNet.Tests/data/v2-consumer-integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
],
"metadata": {
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "2.0.0"
Expand Down
8 changes: 3 additions & 5 deletions tests/PactNet.Tests/data/v3-consumer-integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@
}
]
}
},
"header": {},
"query": {}
}
},
"method": "POST",
"path": "/things",
Expand Down Expand Up @@ -132,8 +130,8 @@
],
"metadata": {
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "3.0.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/PactNet.Tests/data/v3-message-consumer-integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"language": "C#"
},
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "3.0.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/PactNet.Tests/data/v3-message-integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
],
"metadata": {
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "3.0.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/PactNet.Tests/data/v3-server-integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
],
"metadata": {
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "3.0.0"
Expand Down
8 changes: 3 additions & 5 deletions tests/PactNet.Tests/data/v4-combined-integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@
}
]
}
},
"header": {},
"query": {}
}
},
"method": "POST",
"path": "/things",
Expand Down Expand Up @@ -187,8 +185,8 @@
"language": "C#"
},
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "4.0"
Expand Down
8 changes: 3 additions & 5 deletions tests/PactNet.Tests/data/v4-consumer-integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@
}
]
}
},
"header": {},
"query": {}
}
},
"method": "POST",
"path": "/things",
Expand Down Expand Up @@ -152,8 +150,8 @@
],
"metadata": {
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "4.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/PactNet.Tests/data/v4-message-consumer-integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"language": "C#"
},
"pactRust": {
"ffi": "0.4.16",
"models": "1.1.19"
"ffi": "0.4.23",
"models": "1.2.5"
},
"pactSpecification": {
"version": "4.0"
Expand Down

0 comments on commit 27df006

Please sign in to comment.