From 337fb9ab676c5c1c1d1fee09c1d4feccc93167ba Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Wed, 15 Jan 2025 13:28:59 -0800 Subject: [PATCH] build: migrate tokio console control to build.rs Instead of relying on dirty-ing a checked in file (.cargo/config.toml), switch to a feature flag based flow to enable the tokio debug console. This avoids accidental thrashing in the checked in file. It also allows a discoverable path from the justfile for new developers. --- .cargo/config.toml | 4 ---- Cargo.toml | 1 + build.rs | 4 ++++ justfile | 4 ++++ 4 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 .cargo/config.toml create mode 100644 build.rs diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 7e2ebc6..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,4 +0,0 @@ -# uncomment to use tokio-console - -# [build] -# rustflags = ["--cfg", "tokio_unstable"] diff --git a/Cargo.toml b/Cargo.toml index 0d9bf4e..7b1008c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,6 +47,7 @@ database = ["rusqlite"] dns = [] tor = ["arti-client", "tor-rtcompat"] filter-control = [] +tokio-console = [] [dev-dependencies] corepc-node = { version = "0.5.0", default-features = false, features = [ diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..32b7c82 --- /dev/null +++ b/build.rs @@ -0,0 +1,4 @@ +fn main() { + #[cfg(feature = "tokio-console")] + println!("cargo:rustc-cfg=tokio_unstable"); +} diff --git a/justfile b/justfile index a4717ba..af5ff38 100644 --- a/justfile +++ b/justfile @@ -4,6 +4,10 @@ default: build: cargo build +# Run with the tokio console enabled for verbose debugging. +run-with-console: + cargo run --features tokio-console + check: cargo fmt cargo clippy --all-targets