1
0

build.rs 660 B

12345678910111213141516171819
  1. use anyhow::Result;
  2. use vergen::{vergen, Config, SemverKind};
  3. fn main() -> Result<()> {
  4. let mut config = Config::default();
  5. // Change the SEMVER output to the lightweight variant
  6. *config.git_mut().semver_kind_mut() = SemverKind::Lightweight;
  7. // Add a `-dirty` flag to the SEMVER output
  8. *config.git_mut().semver_dirty_mut() = Some("-dirty");
  9. // Generate the instructions
  10. if let Err(e) = vergen(config) {
  11. eprintln!("error occurred while generating instructions: {:?}", e);
  12. let mut config = Config::default();
  13. *config.git_mut().enabled_mut() = false;
  14. vergen(config)
  15. } else {
  16. Ok(())
  17. }
  18. }