Skip to content

Commit

Permalink
Merge pull request #467 from DaniPopes/optional-build
Browse files Browse the repository at this point in the history
Disable build script for library builds
  • Loading branch information
Alex-Fischman authored Nov 18, 2024
2 parents ca52ac1 + 1bcaef5 commit 1d31817
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 11 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ required-features = ["bin"]
[features]
default = ["bin"]

bin = ["serde", "graphviz", "dep:clap", "dep:env_logger", "dep:serde_json"]
bin = [
"serde",
"graphviz",
"dep:clap",
"dep:env_logger",
"dep:serde_json",
"dep:chrono",
]
serde = ["egraph-serialize/serde"]
graphviz = ["egraph-serialize/graphviz"]
wasm-bindgen = ["instant/wasm-bindgen", "dep:getrandom"]
Expand Down Expand Up @@ -66,7 +73,9 @@ im-rc = "15.1.0"
im = "15.1.0"

[build-dependencies]
chrono = { version = "0.4", default-features = false, features = ["now"] }
chrono = { version = "0.4", default-features = false, optional = true, features = [
"now",
] }

[dev-dependencies]
codspeed-criterion-compat = "2.7.2"
Expand Down
8 changes: 6 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::{env, process::Command};

#[cfg(feature = "bin")]
#[allow(clippy::disallowed_macros)] // for println!
fn main() {
use std::{env, process::Command};

let git_hash = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
Expand All @@ -16,3 +17,6 @@ fn main() {
let full_version = format!("{}_{}{}", version, build_date, git_hash);
println!("cargo:rustc-env=FULL_VERSION={}", full_version);
}

#[cfg(not(feature = "bin"))]
fn main() {}

0 comments on commit 1d31817

Please sign in to comment.