mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
c600297f52
- Use variables directly in format strings. As reported by clippy, variables can be used directly in the `format!` string. - Use rewind() instead of seeking to 0. - Remove superfluous & and ref. Signed-off-by: Petr Tesarik <petr@tesarici.cz>
26 lines
917 B
Rust
26 lines
917 B
Rust
use rand::{distributions::Alphanumeric, Rng};
|
|
use vergen::{vergen, Config, ShaKind, TimestampKind};
|
|
|
|
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!");
|
|
|
|
let build_id = match std::env::var("SOURCE_DATE_EPOCH") {
|
|
Ok(val) => val,
|
|
Err(_) => rand::thread_rng()
|
|
.sample_iter(Alphanumeric)
|
|
.take(8)
|
|
.map(char::from)
|
|
.collect(),
|
|
};
|
|
|
|
println!("cargo:rustc-env=LIBRESPOT_BUILD_ID={build_id}");
|
|
}
|