Skip to content

Commit ac129fe

Browse files
committed
chore: Add built
1 parent bc3537d commit ac129fe

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ axum = { version = "0.7", features = ["http2"] }
2222
axum-extra = { version = "0.9", features = ["typed-header"] }
2323
bcrypt = "0.15"
2424
bindgen = "0.70.1"
25+
built = "0.8.0"
2526
cc = "1.0.106"
2627
clap = { version = "4.5", features = ["derive", "env"] }
2728
clap_complete = "4.5"

rust/stackablectl/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ indicatif.workspace = true
3838
termion.workspace = true
3939
urlencoding.workspace = true
4040
libc.workspace = true
41+
42+
[build-dependencies]
43+
built.workspace = true

rust/stackablectl/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
built::write_built_file().expect("failed to acquire build-time information");
3+
}

rust/stackablectl/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ pub mod cmds;
44
pub mod constants;
55
pub mod output;
66
pub mod utils;
7+
8+
pub mod built_info {
9+
use std::{str::FromStr, sync::LazyLock};
10+
11+
include!(concat!(env!("OUT_DIR"), "/built.rs"));
12+
13+
pub static PKG_SEMVER: LazyLock<semver::Version> = LazyLock::new(|| {
14+
semver::Version::from_str(PKG_VERSION).expect("must be a valid semantic version")
15+
});
16+
}

0 commit comments

Comments
 (0)