diff --git a/contrib/lockfile.sh b/contrib/lockfile.sh index 39f68d53f..eae3fa10f 100644 --- a/contrib/lockfile.sh +++ b/contrib/lockfile.sh @@ -16,6 +16,10 @@ _cleanup_lockfile() { use_lockfile() { local src="$1" + # Already in place, from an enclosing script or an earlier run. + if cmp -s "$src" "$LOCKFILE"; then + return 0 + fi if ! mkdir "$LOCKDIR" 2>/dev/null; then echo "Another instance is running. If you're sure it's not, remove $LOCKDIR and try again." >&2 exit 1 diff --git a/payjoin-ffi/csharp/scripts/build_nuget_native.sh b/payjoin-ffi/csharp/scripts/build_nuget_native.sh index 979c9aef9..6a9c94fe4 100755 --- a/payjoin-ffi/csharp/scripts/build_nuget_native.sh +++ b/payjoin-ffi/csharp/scripts/build_nuget_native.sh @@ -101,6 +101,12 @@ rid_to_cross_tool() { SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CSHARP_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" + +REPO_ROOT="$(cd "$CSHARP_DIR/../.." && pwd)" +cd "$REPO_ROOT" +source contrib/lockfile.sh +use_lockfile Cargo-recent.lock + cd "$CSHARP_DIR" RID=${PAYJOIN_FFI_RID:-$(detect_rid)} diff --git a/payjoin-ffi/csharp/scripts/generate_bindings.sh b/payjoin-ffi/csharp/scripts/generate_bindings.sh index 7826fe30d..a4016c037 100755 --- a/payjoin-ffi/csharp/scripts/generate_bindings.sh +++ b/payjoin-ffi/csharp/scripts/generate_bindings.sh @@ -25,6 +25,12 @@ fi # Get the directory where this script is located SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +cd "$REPO_ROOT" +source contrib/lockfile.sh +use_lockfile Cargo-recent.lock + # Navigate to payjoin-ffi directory (parent of csharp, which is parent of scripts) cd "$SCRIPT_DIR/../.." diff --git a/payjoin-ffi/dart/contrib/test.sh b/payjoin-ffi/dart/contrib/test.sh index 227491e50..d248fa642 100755 --- a/payjoin-ffi/dart/contrib/test.sh +++ b/payjoin-ffi/dart/contrib/test.sh @@ -11,8 +11,8 @@ use_lockfile Cargo-recent.lock cd "$REPO_ROOT/payjoin-ffi/dart" -echo "==> Cleaning nested Cargo.lock..." -rm -f native/Cargo.lock +echo "==> Seeding the nested workspace's Cargo.lock from the maintained lockfile..." +cp "$REPO_ROOT/Cargo-recent.lock" native/Cargo.lock echo "==> Generating FFI bindings..." bash ./scripts/generate_bindings.sh diff --git a/payjoin-ffi/dart/native/Cargo.toml b/payjoin-ffi/dart/native/Cargo.toml index bf209bc2c..4a18acbe9 100644 --- a/payjoin-ffi/dart/native/Cargo.toml +++ b/payjoin-ffi/dart/native/Cargo.toml @@ -21,3 +21,9 @@ crate-type = ["staticlib", "cdylib"] payjoin-ffi = { git = "https://github.com/payjoin/rust-payjoin.git", rev = "60d0adbf4ee8e60090209d55e9864893a4acc30e", features = [ "dart", ] } +# Not used directly. yoke-derive 0.8.3 needs Rust 1.87 but declares no rust-version, +# so consumers' fresh resolution on the toolchain above picks it. Drop once upstream fixes it. +yoke-derive = "=0.8.2" + +[package.metadata.cargo-machete] +ignored = ["yoke-derive"] diff --git a/payjoin-ffi/javascript/scripts/generate_bindings.sh b/payjoin-ffi/javascript/scripts/generate_bindings.sh index 31f601fab..6ff7b1b1c 100755 --- a/payjoin-ffi/javascript/scripts/generate_bindings.sh +++ b/payjoin-ffi/javascript/scripts/generate_bindings.sh @@ -31,6 +31,13 @@ if command -v rustup >/dev/null 2>&1 && rustup target add wasm32-unknown-unknown fi +# ubrn's generated wasm crate and the test-utils napi addon are workspaces of +# their own; seed both from the maintained lockfile. +JS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +mkdir -p "$JS_DIR/rust_modules/wasm" +cp "$JS_DIR/../../Cargo-recent.lock" "$JS_DIR/rust_modules/wasm/Cargo.lock" +cp "$JS_DIR/../../Cargo-recent.lock" "$JS_DIR/test-utils/Cargo.lock" + npm run build # The test-utils addon is a dev-only native helper for the integration tests.