-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.rs
30 lines (25 loc) · 836 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// SPDX-FileCopyrightText: 2024 Ryan Cao <hello@ryanccn.dev>
//
// SPDX-License-Identifier: AGPL-3.0-only
use std::{env, time::SystemTime};
fn main() {
println!(
"cargo:rustc-env=METADATA_HOST={}",
env::var("HOST").unwrap()
);
println!(
"cargo:rustc-env=METADATA_TARGET={}",
env::var("TARGET").unwrap()
);
println!("cargo:rerun-if-changed-env=TARGET");
println!("cargo:rerun-if-changed-env=HOST");
let last_modified = env::var("METADATA_LAST_MODIFIED").unwrap_or_else(|_| {
SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_secs()
.to_string()
});
println!("cargo:rustc-env=METADATA_LAST_MODIFIED={last_modified}");
println!("cargo:rerun-if-changed-env=METADATA_LAST_MODIFIED");
}