mirror of
https://github.com/dtolnay/cargo-expand.git
synced 2025-04-04 05:17:37 +03:00
Make prettyplease version appear only if '--version --verbose' is used
This commit is contained in:
parent
edebe7b5ca
commit
828ea84c93
4 changed files with 38 additions and 15 deletions
14
build.rs
14
build.rs
|
@ -5,14 +5,12 @@ use std::path::PathBuf;
|
|||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
let mut version = env!("CARGO_PKG_VERSION").to_owned();
|
||||
if let Ok(prettyplease_version) = env::var("DEP_PRETTYPLEASE02_VERSION") {
|
||||
// TODO: Make this appear only if `--version --verbose` is used.
|
||||
version.push_str(" + prettyplease ");
|
||||
version.push_str(&prettyplease_version);
|
||||
}
|
||||
let prettyplease_version = match env::var("DEP_PRETTYPLEASE02_VERSION") {
|
||||
Ok(prettyplease_version) => format!(r#"Some("{}")"#, prettyplease_version.escape_debug()),
|
||||
Err(_) => "None".to_owned(),
|
||||
};
|
||||
|
||||
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
let version_file = out_dir.join("version");
|
||||
fs::write(version_file, version).unwrap();
|
||||
let prettyplease_version_file = out_dir.join("prettyplease.version");
|
||||
fs::write(prettyplease_version_file, prettyplease_version).unwrap();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue