Skip to content

Commit 8d79a95

Browse files
authored
Resolve every binding build against the lockfile (#1885)
2 parents 7f9b19d + adb897d commit 8d79a95

6 files changed

Lines changed: 31 additions & 2 deletions

File tree

contrib/lockfile.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ _cleanup_lockfile() {
1616

1717
use_lockfile() {
1818
local src="$1"
19+
# Already in place, from an enclosing script or an earlier run.
20+
if cmp -s "$src" "$LOCKFILE"; then
21+
return 0
22+
fi
1923
if ! mkdir "$LOCKDIR" 2>/dev/null; then
2024
echo "Another instance is running. If you're sure it's not, remove $LOCKDIR and try again." >&2
2125
exit 1

payjoin-ffi/csharp/scripts/build_nuget_native.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ rid_to_cross_tool() {
101101

102102
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
103103
CSHARP_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
104+
105+
REPO_ROOT="$(cd "$CSHARP_DIR/../.." && pwd)"
106+
cd "$REPO_ROOT"
107+
source contrib/lockfile.sh
108+
use_lockfile Cargo-recent.lock
109+
104110
cd "$CSHARP_DIR"
105111

106112
RID=${PAYJOIN_FFI_RID:-$(detect_rid)}

payjoin-ffi/csharp/scripts/generate_bindings.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ fi
2525

2626
# Get the directory where this script is located
2727
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28+
29+
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
30+
cd "$REPO_ROOT"
31+
source contrib/lockfile.sh
32+
use_lockfile Cargo-recent.lock
33+
2834
# Navigate to payjoin-ffi directory (parent of csharp, which is parent of scripts)
2935
cd "$SCRIPT_DIR/../.."
3036

payjoin-ffi/dart/contrib/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use_lockfile Cargo-recent.lock
1111

1212
cd "$REPO_ROOT/payjoin-ffi/dart"
1313

14-
echo "==> Cleaning nested Cargo.lock..."
15-
rm -f native/Cargo.lock
14+
echo "==> Seeding the nested workspace's Cargo.lock from the maintained lockfile..."
15+
cp "$REPO_ROOT/Cargo-recent.lock" native/Cargo.lock
1616

1717
echo "==> Generating FFI bindings..."
1818
bash ./scripts/generate_bindings.sh

payjoin-ffi/dart/native/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ crate-type = ["staticlib", "cdylib"]
2121
payjoin-ffi = { git = "https://github.com/payjoin/rust-payjoin.git", rev = "60d0adbf4ee8e60090209d55e9864893a4acc30e", features = [
2222
"dart",
2323
] }
24+
# Not used directly. yoke-derive 0.8.3 needs Rust 1.87 but declares no rust-version,
25+
# so consumers' fresh resolution on the toolchain above picks it. Drop once upstream fixes it.
26+
yoke-derive = "=0.8.2"
27+
28+
[package.metadata.cargo-machete]
29+
ignored = ["yoke-derive"]

payjoin-ffi/javascript/scripts/generate_bindings.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ if command -v rustup >/dev/null 2>&1 &&
3131
rustup target add wasm32-unknown-unknown
3232
fi
3333

34+
# ubrn's generated wasm crate and the test-utils napi addon are workspaces of
35+
# their own; seed both from the maintained lockfile.
36+
JS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
37+
mkdir -p "$JS_DIR/rust_modules/wasm"
38+
cp "$JS_DIR/../../Cargo-recent.lock" "$JS_DIR/rust_modules/wasm/Cargo.lock"
39+
cp "$JS_DIR/../../Cargo-recent.lock" "$JS_DIR/test-utils/Cargo.lock"
40+
3441
npm run build
3542

3643
# The test-utils addon is a dev-only native helper for the integration tests.

0 commit comments

Comments
 (0)