From 9bfb6529d1c01d46617a8ac2ab1a6699107004a5 Mon Sep 17 00:00:00 2001
From: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com>
Date: Sat, 9 Sep 2023 11:35:26 +0200
Subject: [PATCH] Introduce `default-members` to the workspace root (#1420)

---
 .gitlab/pipeline/build.yml | 10 +++++-----
 .gitlab/pipeline/check.yml |  2 +-
 .gitlab/pipeline/test.yml  |  6 +++---
 Cargo.toml                 |  1 +
 polkadot/Cargo.toml        |  1 +
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml
index e34dd40e081..c4dfc0dd093 100644
--- a/.gitlab/pipeline/build.yml
+++ b/.gitlab/pipeline/build.yml
@@ -163,7 +163,7 @@ build-short-benchmark:
     - .run-immediately
     - .collect-artifacts
   script:
-    - cargo build --profile release --locked --features=runtime-benchmarks --bin polkadot
+    - cargo build --profile release --locked --features=runtime-benchmarks --bin polkadot --workspace
     - mkdir -p artifacts
     - target/release/polkadot --version
     - cp ./target/release/polkadot ./artifacts/
@@ -183,7 +183,7 @@ build-linux-stable-cumulus:
     RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
   script:
     - echo "___Building a binary, please refrain from using it in production since it goes with the debug assertions.___"
-    - time cargo build --release --locked --bin polkadot-parachain
+    - time cargo build --release --locked -p polkadot-parachain-bin --bin polkadot-parachain
     - echo "___Packing the artifacts___"
     - mkdir -p ./artifacts
     - mv ./target/release/polkadot-parachain ./artifacts/.
@@ -203,7 +203,7 @@ build-test-parachain:
     RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
   script:
     - echo "___Building a binary, please refrain from using it in production since it goes with the debug assertions.___"
-    - time cargo build --release --locked --bin test-parachain
+    - time cargo build --release --locked -p cumulus-test-service --bin test-parachain
     - echo "___Packing the artifacts___"
     - mkdir -p ./artifacts
     - mv ./target/release/test-parachain ./artifacts/.
@@ -290,7 +290,7 @@ build-short-benchmark-cumulus:
     - .run-immediately
     - .collect-artifacts
   script:
-    - cargo build --profile release --locked --features=runtime-benchmarks --bin polkadot-parachain
+    - cargo build --profile release --locked --features=runtime-benchmarks -p polkadot-parachain-bin --bin polkadot-parachain
     - mkdir -p artifacts
     - target/release/polkadot-parachain --version
     - cp ./target/release/polkadot-parachain ./artifacts/
@@ -316,7 +316,7 @@ build-linux-substrate:
     # see https://github.com/paritytech/ci_cd/issues/682#issuecomment-1340953589
     - git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
   script:
-    - WASM_BUILD_NO_COLOR=1 time cargo build --locked --release
+    - WASM_BUILD_NO_COLOR=1 time cargo build --locked --release -p node-cli
     - mv $CARGO_TARGET_DIR/release/substrate-node ./artifacts/substrate/substrate
     - echo -n "Substrate version = "
     - if [ "${CI_COMMIT_TAG}" ]; then
diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml
index 446f5dde12e..5cc2337bf40 100644
--- a/.gitlab/pipeline/check.yml
+++ b/.gitlab/pipeline/check.yml
@@ -19,7 +19,7 @@ check-try-runtime:
     - time cargo check --locked -p parachain-template-node --features try-runtime
     # add after https://github.com/paritytech/substrate/pull/14502 is merged
     # experimental code may rely on try-runtime and vice-versa
-    - time cargo check --locked --features try-runtime,experimental
+    - time cargo check --locked --all --features try-runtime,experimental
 
 cargo-fmt-manifest:
   stage: check
diff --git a/.gitlab/pipeline/test.yml b/.gitlab/pipeline/test.yml
index 406c87923cc..b29574ad14d 100644
--- a/.gitlab/pipeline/test.yml
+++ b/.gitlab/pipeline/test.yml
@@ -121,7 +121,7 @@ test-linux-stable-runtime-benchmarks:
     # but still want to have debug assertions.
     RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
   script:
-    - time cargo nextest run --features runtime-benchmarks benchmark --locked --cargo-profile testnet
+    - time cargo nextest run --workspace --features runtime-benchmarks benchmark --locked --cargo-profile testnet
 
 # these ones can be really slow so it's better to run them separately
 test-linux-stable-slow:
@@ -185,7 +185,7 @@ test-doc:
     # but still want to have debug assertions.
     RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
   script:
-    - time cargo test --doc
+    - time cargo test --doc --workspace
 
 test-rustdoc:
   stage: test
@@ -368,7 +368,7 @@ quick-benchmarks:
     WASM_BUILD_NO_COLOR: 1
     WASM_BUILD_RUSTFLAGS: "-C debug-assertions -D warnings"
   script:
-    - time cargo run --locked --release --features runtime-benchmarks -- benchmark pallet --execution wasm --wasm-execution compiled --chain dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1
+    - time cargo run --locked --release -p node-cli --bin substrate-node --features runtime-benchmarks -- benchmark pallet --execution wasm --wasm-execution compiled --chain dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1
 
 test-frame-examples-compile-to-wasm:
   # into one job
diff --git a/Cargo.toml b/Cargo.toml
index 4db27b98e90..8a9c2afe1d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -452,6 +452,7 @@ members = [
 	"substrate/utils/prometheus",
 	"substrate/utils/wasm-builder",
 ]
+default-members = [ "polkadot" ]
 
 [profile.release]
 # Polkadot runtime requires unwinding.
diff --git a/polkadot/Cargo.toml b/polkadot/Cargo.toml
index f173557a0ff..b9c132bbff9 100644
--- a/polkadot/Cargo.toml
+++ b/polkadot/Cargo.toml
@@ -19,6 +19,7 @@ readme = "README.md"
 authors.workspace = true
 edition.workspace = true
 version = "1.0.0"
+default-run = "polkadot"
 
 [dependencies]
 color-eyre = { version = "0.6.1", default-features = false }
-- 
GitLab