2019-01-17 07:59:25 +00:00
|
|
|
use rand::distributions::Alphanumeric;
|
2019-07-09 16:32:04 +00:00
|
|
|
use rand::Rng;
|
2022-05-02 11:18:53 +00:00
|
|
|
use std::env;
|
2019-07-09 16:32:04 +00:00
|
|
|
use vergen::{generate_cargo_keys, ConstantsFlags};
|
2017-08-03 18:58:44 +00:00
|
|
|
|
|
|
|
fn main() {
|
2019-07-09 16:32:04 +00:00
|
|
|
let mut flags = ConstantsFlags::all();
|
|
|
|
flags.toggle(ConstantsFlags::REBUILD_ON_HEAD_CHANGE);
|
|
|
|
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
|
2017-08-03 18:58:44 +00:00
|
|
|
|
2022-05-21 19:36:56 +00:00
|
|
|
let build_id = match env::var("SOURCE_DATE_EPOCH") {
|
|
|
|
Ok(val) => val,
|
|
|
|
Err(_) => rand::thread_rng()
|
|
|
|
.sample_iter(Alphanumeric)
|
|
|
|
.take(8)
|
|
|
|
.map(char::from)
|
|
|
|
.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
|
|
|
}
|