Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove build-data dependency #1144

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 11 additions & 87 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ license-files = [
[advisories]
ignore = [
"RUSTSEC-2020-0168", # mach is unmaintained
"RUSTSEC-2020-0071", # time advisory, see #1035
]

[sources]
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tokio = { version = "1", features = ["io-util", "sync", "rt", "net", "fs", "macr
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[build-dependencies]
build-data = "0.1.3"
duct = "0.13.6"

[features]
default = ["metrics"]
Expand Down
27 changes: 23 additions & 4 deletions iroh-net/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
use std::io;

use duct::cmd;

fn main() {
build_data::set_GIT_COMMIT();
build_data::set_RUSTC_VERSION();
build_data::set_SOURCE_TIMESTAMP();
build_data::no_debug_rebuilds();
// Git commit
println!("cargo:rustc-env=GIT_COMMIT={}", get_git_commit().unwrap());

// Rustc version
println!(
"cargo:rustc-env=RUSTC_VERSION={}",
get_rustc_version().unwrap()
);
}

fn get_git_commit() -> std::io::Result<String> {
cmd!("git", "rev-parse", "HEAD").read()
}

fn get_rustc_version() -> io::Result<String> {
let rustc_var = std::env::var_os("RUSTC")
.filter(|s| !s.is_empty())
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "RUSTC env var is not set"))?;
cmd!(rustc_var, "--version").read()
}
1 change: 1 addition & 0 deletions iroh-net/src/hp/hostinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ mod tests {
let info = Hostinfo::default();
println!("{:#?}", info);

assert!(!info.git_commit.is_empty());
assert!(!info.rust_version.is_empty());
}
}
Loading