Skip to content

Commit

Permalink
Fix vergen emit
Browse files Browse the repository at this point in the history
  • Loading branch information
quietvoid committed Aug 4, 2024
1 parent 5cf3eb7 commit a3075cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ assert_fs = "1.1.2"
predicates = "3.1.2"

[build-dependencies]
anyhow = "1.0.86"
vergen-gitcl = { version = "1.0.0", default-features = false, features = ["build"] }

[features]
Expand Down
25 changes: 17 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
use vergen_gitcl::{BuildBuilder, GitclBuilder};
use anyhow::Result;
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder};

fn main() {
let mut gitcl_builder = GitclBuilder::default();
gitcl_builder.describe(true, true, Some("[0-9]*"));
fn main() -> Result<()> {
let mut emitter = Emitter::default();

// Generate the instructions
if let Err(e) = gitcl_builder.build() {
eprintln!("error occured while generating instructions: {e:?}");
let gitcl_res = GitclBuilder::default()
.describe(true, true, Some("[0-9]*"))
.build();

BuildBuilder::default()
if let Ok(gitcl) = gitcl_res {
emitter.add_instructions(&gitcl)?;
} else {
let build = BuildBuilder::default()
.build()
.expect("non-git vergen should succeed");
emitter.add_instructions(&build)?;
}

// Generate the instructions
emitter.emit()?;

Ok(())
}

0 comments on commit a3075cb

Please sign in to comment.