mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-24 08:09:16 -05:00
Put gn_ninja_binaries in target/debug instead of out_dir (#261)
This commit is contained in:
parent
62a52e0241
commit
71c650bc05
2 changed files with 17 additions and 12 deletions
17
build.rs
17
build.rs
|
@ -108,8 +108,19 @@ fn platform() -> &'static str {
|
||||||
|
|
||||||
fn download_gn_ninja_binaries() {
|
fn download_gn_ninja_binaries() {
|
||||||
let root = env::current_dir().unwrap();
|
let root = env::current_dir().unwrap();
|
||||||
let out_dir = root.join(env::var_os("OUT_DIR").unwrap());
|
// target/debug//build/rusty_v8-d9e5a424d4f96994/out/
|
||||||
let d = out_dir.join("gn_ninja_binaries").join(platform());
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||||
|
let out_dir_abs = root.join(out_dir);
|
||||||
|
// This would be target/debug or target/release
|
||||||
|
let target_dir = out_dir_abs
|
||||||
|
.parent()
|
||||||
|
.unwrap()
|
||||||
|
.parent()
|
||||||
|
.unwrap()
|
||||||
|
.parent()
|
||||||
|
.unwrap();
|
||||||
|
let download_dir = target_dir.join("gn_ninja_binaries");
|
||||||
|
let d = download_dir.join("gn_ninja_binaries").join(platform());
|
||||||
let gn = d.join("gn");
|
let gn = d.join("gn");
|
||||||
let ninja = d.join("ninja");
|
let ninja = d.join("ninja");
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
@ -121,7 +132,7 @@ fn download_gn_ninja_binaries() {
|
||||||
let status = Command::new("python")
|
let status = Command::new("python")
|
||||||
.arg("./tools/gn_ninja_binaries.py")
|
.arg("./tools/gn_ninja_binaries.py")
|
||||||
.arg("--dir")
|
.arg("--dir")
|
||||||
.arg(&out_dir)
|
.arg(&download_dir)
|
||||||
.status()
|
.status()
|
||||||
.expect("gn_ninja_binaries.py download failed");
|
.expect("gn_ninja_binaries.py download failed");
|
||||||
assert!(status.success());
|
assert!(status.success());
|
||||||
|
|
|
@ -87,7 +87,7 @@ def EnsureDirExists(path):
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
|
|
||||||
|
|
||||||
def DownloadAndUnpack(url, output_dir, path_prefixes=None):
|
def DownloadAndUnpack(url, output_dir):
|
||||||
"""Download an archive from url and extract into output_dir. If path_prefixes
|
"""Download an archive from url and extract into output_dir. If path_prefixes
|
||||||
is not None, only extract files whose paths within the archive start with
|
is not None, only extract files whose paths within the archive start with
|
||||||
any prefix in path_prefixes."""
|
any prefix in path_prefixes."""
|
||||||
|
@ -96,20 +96,14 @@ def DownloadAndUnpack(url, output_dir, path_prefixes=None):
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
EnsureDirExists(output_dir)
|
EnsureDirExists(output_dir)
|
||||||
t = tarfile.open(mode='r:gz', fileobj=f)
|
t = tarfile.open(mode='r:gz', fileobj=f)
|
||||||
members = None
|
t.extractall(path=output_dir)
|
||||||
if path_prefixes is not None:
|
|
||||||
members = [
|
|
||||||
m for m in t.getmembers() if any(
|
|
||||||
m.name.startswith(p) for p in path_prefixes)
|
|
||||||
]
|
|
||||||
t.extractall(path=output_dir, members=members)
|
|
||||||
|
|
||||||
|
|
||||||
def Update():
|
def Update():
|
||||||
if os.path.exists(DIR):
|
if os.path.exists(DIR):
|
||||||
RmTree(DIR)
|
RmTree(DIR)
|
||||||
try:
|
try:
|
||||||
DownloadAndUnpack(URL, DIR, None)
|
DownloadAndUnpack(URL, DIR)
|
||||||
except URLError:
|
except URLError:
|
||||||
print('Failed to download prebuilt ninja/gn binaries %s' % URL)
|
print('Failed to download prebuilt ninja/gn binaries %s' % URL)
|
||||||
print('Exiting.')
|
print('Exiting.')
|
||||||
|
|
Loading…
Reference in a new issue