Default to linking against release v8 builds (#783)

Unless $V8_FORCE_DEBUG=true to speedup CI for main deno repo
This commit is contained in:
Aaron O'Mullan 2021-09-22 12:02:55 +02:00 committed by GitHub
parent b6537573c4
commit 0bd141c78d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View File

@ -42,6 +42,13 @@ from github to get the static lib. To disable this build using the
When making changes to rusty_v8 itself, it should be tested by build from
source. The CI always builds from source.
## The `V8_FORCE_DEBUG` environment variable
By default `rusty_v8` will link against release builds of `v8`, if you want to
use a debug build of `v8` set `V8_FORCE_DEBUG=true`.
We default to release builds of `v8` due to performance & CI reasons in `deno`.
## The `RUSTY_V8_MIRROR` environment variable
Tells the build script where to get binary builds from. Understands

View File

@ -206,14 +206,24 @@ fn static_lib_url() -> String {
env::var("RUSTY_V8_MIRROR").unwrap_or_else(|_| default_base.into());
let version = env::var("CARGO_PKG_VERSION").unwrap();
let target = env::var("TARGET").unwrap();
// Note: we always use the release build on windows.
if cfg!(target_os = "windows") {
// Note: we always use the release build on windows.
format!("{}/v{}/rusty_v8_release_{}.lib", base, version, target)
} else {
let profile = env::var("PROFILE").unwrap();
assert!(profile == "release" || profile == "debug");
format!("{}/v{}/librusty_v8_{}_{}.a", base, version, profile, target)
return format!("{}/v{}/rusty_v8_release_{}.lib", base, version, target);
}
// Use v8 in release mode unless $V8_FORCE_DEBUG=true
let profile = match env_bool("V8_FORCE_DEBUG") {
true => "debug",
_ => "release",
};
format!("{}/v{}/librusty_v8_{}_{}.a", base, version, profile, target)
}
fn env_bool(key: &str) -> bool {
matches!(
env::var(key).unwrap_or_default().as_str(),
"true" | "1" | "yes"
)
}
fn static_lib_name() -> &'static str {