mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-01-13 01:22:42 -05:00
Add missing cargo:rerun-if-env-changed (#807)
In addition to the problem described in issue #378, we noticed link error when updating rusty_v8 without doing a clean build. As far as I can tell, there were two potential bugs: * Cargo not being informed that it should run build.rs when CARGO_PKG_VERSION changed. * Even if build.rs was rerun, it would not download a new package. It seems that build.rs should either verify that the right package was downloaded or should just trust cargo to not rerun it when not needed. Fixes: #378
This commit is contained in:
parent
2a21f5abf9
commit
26d60b7dfe
1 changed files with 32 additions and 4 deletions
36
build.rs
36
build.rs
|
@ -13,6 +13,35 @@ use which::which;
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rerun-if-changed=src/binding.cc");
|
println!("cargo:rerun-if-changed=src/binding.cc");
|
||||||
|
|
||||||
|
// These are all the environment variables that we check. This is
|
||||||
|
// probably more than what is needed, but missing an important
|
||||||
|
// variable can lead to broken links when switching rusty_v8
|
||||||
|
// versions.
|
||||||
|
let envs = vec![
|
||||||
|
"CARGO",
|
||||||
|
"CARGO_MANIFEST_DIR",
|
||||||
|
"CARGO_PKG_VERSION",
|
||||||
|
"CCACHE",
|
||||||
|
"CLANG_BASE_PATH",
|
||||||
|
"DENO_TRYBUILD",
|
||||||
|
"DOCS_RS",
|
||||||
|
"GN",
|
||||||
|
"GN_ARGS",
|
||||||
|
"HOST",
|
||||||
|
"NINJA",
|
||||||
|
"OUT_DIR",
|
||||||
|
"PROFILE",
|
||||||
|
"RUSTY_V8_ARCHIVE",
|
||||||
|
"RUSTY_V8_MIRROR",
|
||||||
|
"SCCACHE",
|
||||||
|
"TARGET",
|
||||||
|
"V8_FORCE_DEBUG",
|
||||||
|
"V8_FROM_SOURCE",
|
||||||
|
];
|
||||||
|
for env in envs {
|
||||||
|
println!("cargo:rerun-if-env-changed={}", env);
|
||||||
|
}
|
||||||
|
|
||||||
// Detect if trybuild tests are being compiled.
|
// Detect if trybuild tests are being compiled.
|
||||||
let is_trybuild = env::var_os("DENO_TRYBUILD").is_some();
|
let is_trybuild = env::var_os("DENO_TRYBUILD").is_some();
|
||||||
|
|
||||||
|
@ -313,11 +342,10 @@ fn download_static_lib_binaries() {
|
||||||
|
|
||||||
let filename = static_lib_path();
|
let filename = static_lib_path();
|
||||||
if filename.exists() {
|
if filename.exists() {
|
||||||
println!("static lib already exists {}", filename.display());
|
println!("Deleting old static lib {}", filename.display());
|
||||||
println!("To re-download this file, it must be manually deleted.");
|
std::fs::remove_file(&filename).unwrap();
|
||||||
} else {
|
|
||||||
download_file(url, filename);
|
|
||||||
}
|
}
|
||||||
|
download_file(url, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_link_flags() {
|
fn print_link_flags() {
|
||||||
|
|
Loading…
Reference in a new issue