-
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.
Merge pull request #131 from quartiq/feature/service-status
Adding support for reporting service information
- Loading branch information
Showing
8 changed files
with
147 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,55 @@ | ||
//! 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 dirty_flag = if !Command::new("git") | ||
.args(&["diff", "--quiet"]) | ||
.status() | ||
.unwrap() | ||
.success() | ||
{ | ||
"-dirty" | ||
} else { | ||
"" | ||
}; | ||
|
||
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.trim(), | ||
dirty_flag | ||
); | ||
|
||
let output = Command::new("git") | ||
.args(&["describe", "--tags"]) | ||
.output() | ||
.unwrap(); | ||
let version = String::from_utf8(output.stdout).unwrap(); | ||
println!("cargo:rustc-env=VERSION={}", version.trim()); | ||
|
||
// 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
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
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