Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 15 additions & 95 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ uuid = { version = "1", default-features = false, features = ["fast-rng", "v4"]

[build-dependencies]
rand = "0.8"
vergen = { version = "7", default-features = false, features = ["build", "git"] }
vergen = { version = "8", default-features = false, features = ["build", "git", "gitcl"] }

[dev-dependencies]
env_logger = "0.10"
Expand Down
19 changes: 7 additions & 12 deletions core/build.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
use rand::{distributions::Alphanumeric, Rng};
use vergen::{vergen, Config, ShaKind, TimestampKind};
use vergen::EmitBuilder;

fn main() {
let mut config = Config::default();
*config.build_mut().kind_mut() = TimestampKind::DateOnly;
*config.git_mut().enabled_mut() = true;
*config.git_mut().commit_timestamp_mut() = true;
*config.git_mut().commit_timestamp_kind_mut() = TimestampKind::DateOnly;
*config.git_mut().sha_mut() = true;
*config.git_mut().sha_kind_mut() = ShaKind::Short;
*config.git_mut().rerun_on_head_change_mut() = true;

vergen(config).expect("Unable to generate the cargo keys!");

EmitBuilder::builder()
.build_date() // outputs 'VERGEN_BUILD_DATE'
.git_sha(true) // outputs 'VERGEN_GIT_SHA', and sets the 'short' flag true
.git_commit_date() // outputs 'VERGEN_GIT_COMMIT_DATE'
.emit()
.expect("Unable to generate the cargo keys!");
let build_id = match std::env::var("SOURCE_DATE_EPOCH") {
Ok(val) => val,
Err(_) => rand::thread_rng()
Expand Down
4 changes: 2 additions & 2 deletions core/src/version.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// Version string of the form "librespot-<sha>"
pub const VERSION_STRING: &str = concat!("librespot-", env!("VERGEN_GIT_SHA_SHORT"));
pub const VERSION_STRING: &str = concat!("librespot-", env!("VERGEN_GIT_SHA"));

/// Generate a timestamp string representing the build date (UTC).
pub const BUILD_DATE: &str = env!("VERGEN_BUILD_DATE");

/// Short sha of the latest git commit.
pub const SHA_SHORT: &str = env!("VERGEN_GIT_SHA_SHORT");
pub const SHA_SHORT: &str = env!("VERGEN_GIT_SHA");

/// Date of the latest git commit.
pub const COMMIT_DATE: &str = env!("VERGEN_GIT_COMMIT_DATE");
Expand Down