-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(()) | ||
} |