Skip to content

Commit cd56b57

Browse files
committed
Gate payjoin-ffi bitcoind types behind feature
Split _test-utils into _test-utils (constants + TestServices only) and _test-utils-bitcoind (adds BitcoindEnv, RpcClient, etc.). This lets FFI consumers like Dart unit tests import test constants without triggering the corepc-node/bitcoind download. Update all binding-generation and test scripts to use _test-utils-bitcoind where integration-test types are needed.
1 parent 5c59429 commit cd56b57

File tree

12 files changed

+107
-98
lines changed

12 files changed

+107
-98
lines changed

payjoin-ffi/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ exclude = ["tests"]
99
default = []
1010
csharp = ["dep:uniffi-bindgen-cs"]
1111
dart = ["dep:uniffi-dart"]
12-
_test-utils = ["payjoin-test-utils", "payjoin-test-utils/bitcoind", "tokio"]
12+
_test-utils = ["payjoin-test-utils", "tokio"]
13+
_test-utils-bitcoind = ["_test-utils", "payjoin-test-utils/bitcoind"]
1314
_manual-tls = ["payjoin/_manual-tls"]
1415
wasm_js = ["getrandom/js"]
1516

payjoin-ffi/contrib/lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33

44
# Individual features with no defaults.
5-
features=("_manual-tls" "_test-utils")
5+
features=("_manual-tls" "_test-utils" "_test-utils-bitcoind")
66

77
for feature in "${features[@]}"; do
88
# Don't duplicate --all-targets clippy. Clippy end-user code, not tests.

payjoin-ffi/contrib/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
RUST_VERSION=$(rustc --version | awk '{print $2}')
55

66
if [[ ! $RUST_VERSION =~ ^1\.85\. ]]; then
7-
cargo test --package payjoin-ffi --verbose --features=_manual-tls,_test-utils
7+
cargo test --package payjoin-ffi --verbose --features=_manual-tls,_test-utils-bitcoind
88
else
99
echo "Skipping payjoin-ffi tests for Rust version $RUST_VERSION (MSRV)"
1010
fi

payjoin-ffi/csharp/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ dotnet test
5656

5757
Generation uses the Cargo-managed C# generator from `payjoin-ffi/Cargo.toml`.
5858

59-
By default, generation builds `payjoin-ffi` with `_test-utils` enabled to keep parity with other language test scripts. Override via `PAYJOIN_FFI_FEATURES`.
59+
By default, generation builds `payjoin-ffi` with `_test-utils-bitcoind` enabled to keep parity with other language test scripts. Override via `PAYJOIN_FFI_FEATURES`.
6060

6161
### Unix shells
6262

6363
```shell
64-
export PAYJOIN_FFI_FEATURES=_test-utils # default behavior
64+
export PAYJOIN_FFI_FEATURES=_test-utils-bitcoind # default behavior
6565
# export PAYJOIN_FFI_FEATURES="" # build without extra features
6666
bash ./scripts/generate_bindings.sh
6767
```
6868

6969
### PowerShell
7070

7171
```powershell
72-
$env:PAYJOIN_FFI_FEATURES = "_test-utils" # default behavior
72+
$env:PAYJOIN_FFI_FEATURES = "_test-utils-bitcoind" # default behavior
7373
# $env:PAYJOIN_FFI_FEATURES = "" # build without extra features
7474
powershell -ExecutionPolicy Bypass -File .\scripts\generate_bindings.ps1
7575
dotnet build

payjoin-ffi/csharp/scripts/generate_bindings.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Write-Host "Generating payjoin C#..."
4040
if ($null -ne $env:PAYJOIN_FFI_FEATURES) {
4141
$payjoinFfiFeatures = $env:PAYJOIN_FFI_FEATURES
4242
} else {
43-
# Keep parity with other language test scripts: include _test-utils by default.
44-
$payjoinFfiFeatures = "_test-utils"
43+
# Keep parity with other language test scripts: include _test-utils-bitcoind by default.
44+
$payjoinFfiFeatures = "_test-utils-bitcoind"
4545
}
4646

4747
if ($payjoinFfiFeatures) {

payjoin-ffi/csharp/scripts/generate_bindings.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2222
cd "$SCRIPT_DIR/../.."
2323

2424
echo "Generating payjoin C#..."
25-
# Keep parity with other language test scripts: include _test-utils by default.
26-
PAYJOIN_FFI_FEATURES=${PAYJOIN_FFI_FEATURES:-_test-utils}
25+
# Keep parity with other language test scripts: include _test-utils-bitcoind by default.
26+
PAYJOIN_FFI_FEATURES=${PAYJOIN_FFI_FEATURES:-_test-utils-bitcoind}
2727
GENERATOR_FEATURES="csharp"
2828
if [[ -n $PAYJOIN_FFI_FEATURES ]]; then
2929
GENERATOR_FEATURES="$GENERATOR_FEATURES,$PAYJOIN_FFI_FEATURES"

payjoin-ffi/dart/hook/build.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ void main(List<String> args) async {
55
await build(args, (input, output) async {
66
await RustBuilder(
77
assetName: 'uniffi:payjoin_ffi',
8-
features: ['_test-utils'],
8+
features: ['_test-utils-bitcoind'],
99
).run(input: input, output: output);
1010
});
1111
}

payjoin-ffi/dart/native/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ publish = false
1010

1111
[features]
1212
_test-utils = ["payjoin-ffi/_test-utils"]
13+
_test-utils-bitcoind = ["payjoin-ffi/_test-utils-bitcoind"]
1314

1415
[lib]
1516
name = "payjoin_ffi_wrapper"

payjoin-ffi/dart/scripts/generate_bindings.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fi
1919

2020
cd ../
2121
echo "Generating payjoin dart..."
22-
cargo build --features dart,_test-utils --profile dev
23-
cargo run --features dart,_test-utils --profile dev --bin uniffi-bindgen -- --library ../target/debug/$LIBNAME --language dart --out-dir dart/lib/
22+
cargo build --features dart,_test-utils-bitcoind --profile dev
23+
cargo run --features dart,_test-utils-bitcoind --profile dev --bin uniffi-bindgen -- --library ../target/debug/$LIBNAME --language dart --out-dir dart/lib/
2424

2525
echo "All done!"

payjoin-ffi/python/scripts/generate_bindings.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ uv run python --version
1919

2020
cd ../
2121
# This is a test script the actual release should not include the test utils feature
22-
cargo build --features _test-utils --profile dev
23-
cargo run --features _test-utils --profile dev --bin uniffi-bindgen generate --library ../target/debug/$LIBNAME --language python --out-dir python/src/payjoin/
22+
cargo build --features _test-utils-bitcoind --profile dev
23+
cargo run --features _test-utils-bitcoind --profile dev --bin uniffi-bindgen generate --library ../target/debug/$LIBNAME --language python --out-dir python/src/payjoin/
2424

2525
if [[ $OS == "Darwin" ]]; then
2626
echo "Generating native binaries..."
2727
rustup target add aarch64-apple-darwin x86_64-apple-darwin
2828
# This is a test script the actual release should not include the test utils feature
29-
cargo build --profile dev --target aarch64-apple-darwin --features _test-utils &
30-
cargo build --profile dev --target x86_64-apple-darwin --features _test-utils &
29+
cargo build --profile dev --target aarch64-apple-darwin --features _test-utils-bitcoind &
30+
cargo build --profile dev --target x86_64-apple-darwin --features _test-utils-bitcoind &
3131
wait
3232

3333
echo "Building macos fat library"
@@ -39,7 +39,7 @@ else
3939
echo "Generating native binaries..."
4040
rustup target add x86_64-unknown-linux-gnu
4141
# This is a test script the actual release should not include the test utils feature
42-
cargo build --profile dev --target x86_64-unknown-linux-gnu --features _test-utils
42+
cargo build --profile dev --target x86_64-unknown-linux-gnu --features _test-utils-bitcoind
4343

4444
echo "Copying payjoin_ffi binary"
4545
cp ../target/x86_64-unknown-linux-gnu/debug/$LIBNAME python/src/payjoin/$LIBNAME

0 commit comments

Comments
 (0)