From ca2a95915ccef1f5bd8884ca0c99daef61690511 Mon Sep 17 00:00:00 2001 From: oyindamola oladapo Date: Tue, 16 Sep 2025 16:42:55 +0100 Subject: [PATCH 1/2] Add latest feature to avoid hardcoded versions in build scripts --- contrib/update-lock-files.sh | 22 ++++++++++++++++++++-- integration_test/Cargo.toml | 2 ++ justfile | 24 ++++++++++++++++++++++++ node/Cargo.toml | 3 ++- 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/contrib/update-lock-files.sh b/contrib/update-lock-files.sh index 4c8b861e..777e4c95 100755 --- a/contrib/update-lock-files.sh +++ b/contrib/update-lock-files.sh @@ -5,7 +5,25 @@ set -euo pipefail for file in Cargo-minimal.lock Cargo-recent.lock; do - cp --force "$file" Cargo.lock - cargo check --all-features + cp "$file" Cargo.lock + + # Workspace crates with all features + workspace_crates=("client" "types" "jsonrpc") + for crate in "${workspace_crates[@]}"; do + (cd "$crate" && cargo check --all-features) + done + + # Crates with version features (use latest) + version_crates=("node" "integration_test") + for crate in "${version_crates[@]}"; do + (cd "$crate" && cargo check --features=latest) + done + + # Other crates + other_crates=("verify") + for crate in "${other_crates[@]}"; do + (cd "$crate" && cargo check) + done + cp --force Cargo.lock "$file" done diff --git a/integration_test/Cargo.toml b/integration_test/Cargo.toml index 1b6ecb89..ce929f04 100644 --- a/integration_test/Cargo.toml +++ b/integration_test/Cargo.toml @@ -13,6 +13,8 @@ edition = "2021" [features] download = ["node/download"] +latest = ["29_0"] + # Enable the same feature in `node` and the version feature here. # All minor releases of the latest three versions. 29_0 = ["v29_and_below", "node/29_0"] diff --git a/justfile b/justfile index 4849b552..258f5c30 100644 --- a/justfile +++ b/justfile @@ -12,6 +12,7 @@ default: # Cargo build everything. build: +<<<<<<< HEAD cargo build --workspace --all-targets --all-features # Cargo check everything. @@ -21,6 +22,29 @@ check: # Lint everything. lint: lint-verify lint-integration-tests cargo +$(cat ./nightly-version) clippy --workspace --all-targets --all-features -- --deny warnings +======= + cargo build -p corepc-client --all-targets --all-features + cargo build -p corepc-types --all-targets --all-features + cargo build -p jsonrpc --all-targets --all-features + cargo build -p corepc-node --all-targets --features=latest + cargo build --manifest-path verify/Cargo.toml --all-targets + +# Cargo check everything. +check: + cargo check -p corepc-client --all-targets --all-features + cargo check -p corepc-types --all-targets --all-features + cargo check -p jsonrpc --all-targets --all-features + cargo check -p corepc-node --all-targets --features=latest + cargo check --manifest-path verify/Cargo.toml --all-targets + +# Lint everything. +lint: lint-verify lint-integration-tests + cargo +$(cat ./nightly-version) clippy -p corepc-client --all-targets --all-features -- --deny warnings + cargo +$(cat ./nightly-version) clippy -p corepc-types --all-targets --all-features -- --deny warnings + cargo +$(cat ./nightly-version) clippy -p jsonrpc --all-targets --all-features -- --deny warnings + cargo +$(cat ./nightly-version) clippy -p corepc-node --all-targets --features=latest -- --deny warnings + cargo +$(cat ./nightly-version) clippy --manifest-path verify/Cargo.toml --all-targets -- --deny warnings +>>>>>>> 2d0ee43 (Add latest feature to avoid hardcoded versions in build scripts) lint-verify: $REPO_DIR/contrib/lint-verify.sh diff --git a/node/Cargo.toml b/node/Cargo.toml index 67f46c9e..8eb99220 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -37,13 +37,14 @@ zip = { version = "0.6.6", default-features = false, features = ["bzip2", "defla # - `cargo test --features=27_2,download` to download Bitcoin Core binary `v27.2`. # - `cargo test --features=28_0` to use `bitcoind` from the host environment. # - `cargo test` is equivalent to `cargo test --features=0_17_2`. -# - `cargo test --all-features`: Same as using latest version. # - `cargo test --no-default-features` does not work, you MUST enable a version feature. [features] default = ["0_17_2"] download = ["anyhow", "bitcoin_hashes", "flate2", "tar", "minreq", "zip"] +latest = ["29_0"] + # We support all minor releases of the latest three versions. 29_0 = ["28_2"] 28_2 = ["28_1"] From d267de8b54967a59c5e3a011a0c74dc5dfdf232c Mon Sep 17 00:00:00 2001 From: oyindamola oladapo Date: Thu, 11 Sep 2025 13:23:49 +0100 Subject: [PATCH 2/2] Fix build to avoid conflicting version features The previous build configuration used `--all-features` at the workspace level, which caused conflicts with mutually exclusive version features in the node and integration_test crates (e.g., v29_0, v28_2, etc.). --- justfile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/justfile b/justfile index 258f5c30..7c0e2cd7 100644 --- a/justfile +++ b/justfile @@ -12,17 +12,23 @@ default: # Cargo build everything. build: -<<<<<<< HEAD cargo build --workspace --all-targets --all-features + cargo build -p corepc-client --all-targets --all-features + cargo build -p corepc-types --all-targets --all-features + cargo build -p jsonrpc --all-targets --all-features + cargo build -p corepc-node --all-targets --features=latest + cargo build --manifest-path verify/Cargo.toml --all-targets # Cargo check everything. check: - cargo check --workspace --all-targets --all-features + cargo check -p corepc-client --all-targets --all-features + cargo check -p corepc-types --all-targets --all-features + cargo check -p jsonrpc --all-targets --all-features + cargo check -p corepc-node --all-targets --features=latest + cargo check --manifest-path verify/Cargo.toml --all-targets # Lint everything. lint: lint-verify lint-integration-tests - cargo +$(cat ./nightly-version) clippy --workspace --all-targets --all-features -- --deny warnings -======= cargo build -p corepc-client --all-targets --all-features cargo build -p corepc-types --all-targets --all-features cargo build -p jsonrpc --all-targets --all-features @@ -44,7 +50,6 @@ lint: lint-verify lint-integration-tests cargo +$(cat ./nightly-version) clippy -p jsonrpc --all-targets --all-features -- --deny warnings cargo +$(cat ./nightly-version) clippy -p corepc-node --all-targets --features=latest -- --deny warnings cargo +$(cat ./nightly-version) clippy --manifest-path verify/Cargo.toml --all-targets -- --deny warnings ->>>>>>> 2d0ee43 (Add latest feature to avoid hardcoded versions in build scripts) lint-verify: $REPO_DIR/contrib/lint-verify.sh @@ -64,7 +69,11 @@ format: # Generate documentation. docsrs *flags: - RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +$(cat ./nightly-version) doc --all-features {{flags}} + RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +$(cat ./nightly-version) doc -p corepc-client --all-features {{flags}} + RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +$(cat ./nightly-version) doc -p corepc-types --all-features {{flags}} + RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +$(cat ./nightly-version) doc -p jsonrpc --all-features {{flags}} + RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +$(cat ./nightly-version) doc -p corepc-node --features=29_0 {{flags}} + (cd verify && RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +$(cat ../nightly-version) doc {{flags}}) # Update the recent and minimal lock files. update-lock-files: