2022-01-09 00:03:47 +00:00
|
|
|
use rand::{distributions::Alphanumeric, Rng};
|
|
|
|
use vergen::{vergen, Config, ShaKind, TimestampKind};
|
2017-08-03 18:58:44 +00:00
|
|
|
|
|
|
|
fn main() {
|
2022-01-09 00:03:47 +00:00
|
|
|
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!");
|
2017-08-03 18:58:44 +00:00
|
|
|
|
2021-02-10 21:54:35 +00:00
|
|
|
let build_id: String = rand::thread_rng()
|
|
|
|
.sample_iter(Alphanumeric)
|
2019-07-09 16:32:04 +00:00
|
|
|
.take(8)
|
2021-02-10 21:54:35 +00:00
|
|
|
.map(char::from)
|
2019-07-09 16:32:04 +00:00
|
|
|
.collect();
|
2021-02-13 17:43:24 +00:00
|
|
|
|
|
|
|
println!("cargo:rustc-env=LIBRESPOT_BUILD_ID={}", build_id);
|
2017-08-03 18:58:44 +00:00
|
|
|
}
|