-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding build script, further debug info
- Loading branch information
1 parent
b29ec9a
commit f59fce4
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//! Booster NGFW build script | ||
//! | ||
//! # Copyright | ||
//! Copyright (C) 2020 QUARTIQ GmbH - All Rights Reserved | ||
//! Unauthorized usage, editing, or copying is strictly prohibited. | ||
//! Proprietary and confidential. | ||
//! | ||
//! # Note | ||
//! This build script is run immediately before the build is completed and is used to inject | ||
//! environment variables into the build. | ||
use std::process::Command; | ||
|
||
fn main() { | ||
// Inject the git revision into an environment variable for compilation. | ||
let output = Command::new("git") | ||
.args(&["rev-parse", "HEAD"]) | ||
.output() | ||
.unwrap(); | ||
let revision = String::from_utf8(output.stdout).unwrap(); | ||
println!("cargo:rustc-env=GIT_REVISION={}", revision); | ||
|
||
let output = Command::new("git") | ||
.args(&["describe", "--tags"]) | ||
.output() | ||
.unwrap(); | ||
let version = String::from_utf8(output.stdout).unwrap(); | ||
println!("cargo:rustc-env=VERSION={}", version); | ||
|
||
// Collect all of the enabled features and inject them as an environment variable. | ||
let mut features: Vec<String> = Vec::new(); | ||
for (key, _) in std::env::vars() { | ||
let strings: Vec<&str> = key.split("CARGO_FEATURE_").collect(); | ||
if strings.len() > 1 { | ||
println!("{}", strings[1]); | ||
features.push(String::from(strings[1])); | ||
} | ||
} | ||
|
||
println!("cargo:rustc-env=ALL_FEATURES={}", features.join(", ")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters