Use gitcl instead of git2 to avoid compiling git

This commit is contained in:
Clément Renault
2024-05-23 16:38:44 +02:00
parent b1f5a72d0d
commit 5f4b0a0b25
3 changed files with 7 additions and 65 deletions

View File

@@ -15,4 +15,4 @@ time = { version = "0.3.34", features = ["parsing"] }
[build-dependencies]
anyhow = "1.0.80"
vergen-git2 = "1.0.0-beta.2"
vergen-gitcl = "1.0.0-beta.2"

View File

@@ -8,7 +8,7 @@ fn emit_git_variables() -> anyhow::Result<()> {
// Note: any code that needs VERGEN_ environment variables should take care to define them manually in the Dockerfile and pass them
// in the corresponding GitHub workflow (publish_docker.yml).
// This is due to the Dockerfile building the binary outside of the git directory.
let mut builder = vergen_git2::Git2Builder::default();
let mut builder = vergen_gitcl::GitclBuilder::default();
builder.branch(true);
builder.commit_timestamp(true);
@@ -16,7 +16,6 @@ fn emit_git_variables() -> anyhow::Result<()> {
builder.describe(true, true, None);
builder.sha(false);
let git2 = builder.build()?;
vergen_git2::Emitter::default().fail_on_error().add_instructions(&git2)?.emit()
let gitcl = builder.build()?;
vergen_gitcl::Emitter::default().fail_on_error().add_instructions(&gitcl)?.emit()
}