Update to vergen 8
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Valentin Brandl 2023-04-13 11:55:52 +02:00
parent e57294ff4c
commit 914ee4b637
5 changed files with 1124 additions and 483 deletions

1571
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ name = "hoc"
version = "0.33.0" version = "0.33.0"
authors = ["Valentin Brandl <vbrandl@riseup.net>"] authors = ["Valentin Brandl <vbrandl@riseup.net>"]
edition = "2021" edition = "2021"
build = "build.rs" build = "src/build.rs"
[lib] [lib]
path = "src/lib.rs" path = "src/lib.rs"
@ -37,8 +37,9 @@ tracing-log = "0.1.3"
tracing-subscriber = { version = "0.3.16", features = ["registry", "env-filter"] } tracing-subscriber = { version = "0.3.16", features = ["registry", "env-filter"] }
[build-dependencies] [build-dependencies]
anyhow = "1.0.70"
ructe = { version = "0.16.1", features = ["mime03"] } ructe = { version = "0.16.1", features = ["mime03"] }
vergen = { version = "8.1.1", default-features = false, features = ["git"] } vergen = { version = "8.1.1", default-features = false, features = ["git", "gitoxide"] }
[dev-dependencies] [dev-dependencies]
awc = "3.1.1" awc = "3.1.1"

View File

@ -1,15 +0,0 @@
extern crate ructe;
extern crate vergen;
use ructe::{Ructe, RucteError};
use vergen::{vergen, Config, ShaKind};
fn main() -> Result<(), RucteError> {
let mut config = Config::default();
*config.git_mut().sha_kind_mut() = ShaKind::Short;
vergen(config).expect("Unable to generate static repo info");
let mut ructe = Ructe::from_env()?;
let mut statics = ructe.statics()?;
statics.add_files("static")?;
ructe.compile_templates("templates")
}

14
src/build.rs Normal file
View File

@ -0,0 +1,14 @@
use anyhow::Result;
use ructe::Ructe;
use vergen::EmitBuilder;
fn main() -> Result<()> {
EmitBuilder::builder()
.git_sha(true)
.emit()?;
let mut ructe = Ructe::from_env()?;
let mut statics = ructe.statics()?;
statics.add_files("static")?;
Ok(ructe.compile_templates("templates")?)
}

View File

@ -4,7 +4,7 @@ pub struct VersionInfo<'a> {
} }
pub(crate) const VERSION_INFO: VersionInfo = VersionInfo { pub(crate) const VERSION_INFO: VersionInfo = VersionInfo {
commit: env!("VERGEN_GIT_SHA_SHORT"), commit: env!("VERGEN_GIT_SHA"),
version: env!("CARGO_PKG_VERSION"), version: env!("CARGO_PKG_VERSION"),
}; };