From 7665e2504b55e0161432f4b6c3d732f674b2c34c Mon Sep 17 00:00:00 2001 From: "Sean P. Kelly" Date: Mon, 23 Dec 2024 19:29:49 +0000 Subject: [PATCH] twoliter: conditionally compile pubsys While we do not publish twoliter without pubsys support built in, it can speed up development compile times to avoid needing to compile pubsys (which subsequently compiles the AWS SDK for Rust.) --- twoliter/Cargo.toml | 5 +++-- twoliter/src/tools.rs | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/twoliter/Cargo.toml b/twoliter/Cargo.toml index fa245d5b..d852198a 100644 --- a/twoliter/Cargo.toml +++ b/twoliter/Cargo.toml @@ -43,7 +43,7 @@ which.workspace = true # Binary dependencies. These are binaries that we want to embed in the Twoliter binary buildsys = { workspace = true } pipesys = { workspace = true } -pubsys = { workspace = true } +pubsys = { workspace = true, optional = true } pubsys-setup = { workspace = true } testsys = { workspace = true } tuftool = { workspace = true } @@ -58,5 +58,6 @@ tar.workspace = true test-case.workspace = true [features] -default = ["integ-tests"] +default = ["integ-tests", "pubsys"] integ-tests = [] +pubsys = ["dep:pubsys"] diff --git a/twoliter/src/tools.rs b/twoliter/src/tools.rs index 09053db8..b22c8de0 100644 --- a/twoliter/src/tools.rs +++ b/twoliter/src/tools.rs @@ -12,6 +12,7 @@ use tracing::debug; const TAR_GZ_DATA: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/tools.tar.gz")); const BUILDSYS: &[u8] = include_bytes!(env!("CARGO_BIN_FILE_BUILDSYS")); const PIPESYS: &[u8] = include_bytes!(env!("CARGO_BIN_FILE_PIPESYS")); +#[cfg(feature = "pubsys")] const PUBSYS: &[u8] = include_bytes!(env!("CARGO_BIN_FILE_PUBSYS")); const PUBSYS_SETUP: &[u8] = include_bytes!(env!("CARGO_BIN_FILE_PUBSYS_SETUP")); const TESTSYS: &[u8] = include_bytes!(env!("CARGO_BIN_FILE_TESTSYS")); @@ -44,6 +45,7 @@ pub(crate) async fn install_tools(tools_dir: impl AsRef) -> Result<()> { write_bin("buildsys", BUILDSYS, &dir, mtime).await?; write_bin("pipesys", PIPESYS, &dir, mtime).await?; + #[cfg(feature = "pubsys")] write_bin("pubsys", PUBSYS, &dir, mtime).await?; write_bin("pubsys-setup", PUBSYS_SETUP, &dir, mtime).await?; write_bin("testsys", TESTSYS, &dir, mtime).await?;