• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use std::env;
2 use std::ffi::OsString;
3 use std::process;
4 
main()5 fn main() {
6     println!("cargo:rerun-if-changed=build.rs");
7 
8     println!("cargo:rustc-check-cfg=cfg(exhaustive)");
9     println!("cargo:rustc-check-cfg=cfg(prettyplease_debug)");
10     println!("cargo:rustc-check-cfg=cfg(prettyplease_debug_indent)");
11 
12     let pkg_version = cargo_env_var("CARGO_PKG_VERSION");
13     println!("cargo:VERSION={}", pkg_version.to_str().unwrap());
14 }
15 
cargo_env_var(key: &str) -> OsString16 fn cargo_env_var(key: &str) -> OsString {
17     env::var_os(key).unwrap_or_else(|| {
18         eprintln!("Environment variable ${key} is not set during execution of build script");
19         process::exit(1);
20     })
21 }
22