mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Merge pull request #995 from bmwiedemann/dev
Allow to override build_id with SOURCE_DATE_EPOCH
This commit is contained in:
commit
1efda79787
1 changed files with 12 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
use rand::distributions::Alphanumeric;
|
use rand::distributions::Alphanumeric;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
use std::env;
|
||||||
use vergen::{generate_cargo_keys, ConstantsFlags};
|
use vergen::{generate_cargo_keys, ConstantsFlags};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -7,11 +8,17 @@ fn main() {
|
||||||
flags.toggle(ConstantsFlags::REBUILD_ON_HEAD_CHANGE);
|
flags.toggle(ConstantsFlags::REBUILD_ON_HEAD_CHANGE);
|
||||||
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
|
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
|
||||||
|
|
||||||
let build_id: String = rand::thread_rng()
|
let build_id: String;
|
||||||
.sample_iter(Alphanumeric)
|
match env::var("SOURCE_DATE_EPOCH") {
|
||||||
.take(8)
|
Ok(val) => build_id = val,
|
||||||
.map(char::from)
|
Err(_) => {
|
||||||
.collect();
|
build_id = rand::thread_rng()
|
||||||
|
.sample_iter(Alphanumeric)
|
||||||
|
.take(8)
|
||||||
|
.map(char::from)
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
println!("cargo:rustc-env=LIBRESPOT_BUILD_ID={}", build_id);
|
println!("cargo:rustc-env=LIBRESPOT_BUILD_ID={}", build_id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue