diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7dc4c9ad..c24e583a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,5 +20,5 @@ jobs: run: cargo build --verbose - name: Run tests run: cargo test --verbose - - name: Run no default - run: cargo test --verbose --no-default-features + - name: Build no default + run: cargo build --verbose --no-default-features diff --git a/ndc_stdlib/Cargo.toml b/ndc_stdlib/Cargo.toml index fe7bf513..84884144 100644 --- a/ndc_stdlib/Cargo.toml +++ b/ndc_stdlib/Cargo.toml @@ -11,15 +11,20 @@ ndc_lib = { workspace = true } ndc_macros.workspace = true num.workspace = true once_cell.workspace = true -rand.workspace = true -regex.workspace = true -serde_json = { workspace = true } tap.workspace = true +# Optional +rand = { workspace = true, optional = true } +regex = { workspace = true, optional = true } +serde_json = { workspace = true, optional = true } + # Crypto md5 = { version = "0.8.0", optional = true } sha1 = { version = "0.10.6", optional = true } [features] -default = ["crypto"] +default = ["crypto", "rand", "regex", "serde"] crypto = ["dep:md5", "dep:sha1"] +rand = ["dep:rand"] +regex = ["dep:regex"] +serde = ["dep:serde_json"] diff --git a/ndc_stdlib/src/lib.rs b/ndc_stdlib/src/lib.rs index 41270177..b1acc2c2 100644 --- a/ndc_stdlib/src/lib.rs +++ b/ndc_stdlib/src/lib.rs @@ -9,15 +9,18 @@ pub mod hash_map; pub mod heap; pub mod list; pub mod math; -pub mod rand; -pub mod regex; pub mod sequence; -pub mod serde; pub mod string; pub mod value; #[cfg(feature = "crypto")] pub mod crypto; +#[cfg(feature = "rand")] +pub mod rand; +#[cfg(feature = "regex")] +pub mod regex; +#[cfg(feature = "serde")] +pub mod serde; pub fn register(env: &mut Environment) { aoc::register(env); @@ -32,10 +35,13 @@ pub fn register(env: &mut Environment) { list::register(env); math::f64::register(env); math::register(env); + #[cfg(feature = "rand")] rand::register(env); + #[cfg(feature = "regex")] regex::register(env); sequence::extra::register(env); sequence::register(env); + #[cfg(feature = "serde")] serde::register(env); string::register(env); value::register(env);