Skip to content

Commit

Permalink
Add feature status to version
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Nov 8, 2021
1 parent a01f833 commit 7e13f6d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ fn build_syntax(dir: &str, out: &str) {
dump_to_file(&ss, Path::new(&out_dir).join(out)).unwrap();
}

fn feature_status(feature: &str) -> String {
if env::var_os(format!(
"CARGO_FEATURE_{}",
feature.to_uppercase().replace("-", "_")
))
.is_some()
{
format!("+{}", feature)
} else {
format!("-{}", feature)
}
}

fn features() -> String {
feature_status("native-tls")
}

fn main() {
for dir in &["assets", "assets/basic", "assets/large"] {
println!("cargo:rerun-if-changed={}", dir);
Expand All @@ -31,4 +48,6 @@ fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let ts = ThemeSet::load_from_folder("assets").unwrap();
dump_to_file(&ts, Path::new(&out_dir).join("themepack.themedump")).unwrap();

println!("cargo:rustc-env=XH_FEATURES={}", features());
}
1 change: 1 addition & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use crate::utils::config_dir;
#[derive(StructOpt, Debug)]
#[structopt(
name = "xh",
version = concat!(env!("CARGO_PKG_VERSION"), "\n", env!("XH_FEATURES")),
settings = &[
AppSettings::DeriveDisplayOrder,
AppSettings::UnifiedHelpMessage,
Expand Down

0 comments on commit 7e13f6d

Please sign in to comment.