0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-24 00:00:06 -05:00

Put gn_ninja_binaries in target/debug instead of out_dir (#261)

This commit is contained in:
Ryan Dahl 2020-01-28 18:27:11 -05:00 committed by GitHub
parent 62a52e0241
commit 71c650bc05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 12 deletions

View file

@ -108,8 +108,19 @@ fn platform() -> &'static str {
fn download_gn_ninja_binaries() {
let root = env::current_dir().unwrap();
let out_dir = root.join(env::var_os("OUT_DIR").unwrap());
let d = out_dir.join("gn_ninja_binaries").join(platform());
// target/debug//build/rusty_v8-d9e5a424d4f96994/out/
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 ninja = d.join("ninja");
#[cfg(windows)]
@ -121,7 +132,7 @@ fn download_gn_ninja_binaries() {
let status = Command::new("python")
.arg("./tools/gn_ninja_binaries.py")
.arg("--dir")
.arg(&out_dir)
.arg(&download_dir)
.status()
.expect("gn_ninja_binaries.py download failed");
assert!(status.success());

View file

@ -87,7 +87,7 @@ def EnsureDirExists(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
is not None, only extract files whose paths within the archive start with
any prefix in path_prefixes."""
@ -96,20 +96,14 @@ def DownloadAndUnpack(url, output_dir, path_prefixes=None):
f.seek(0)
EnsureDirExists(output_dir)
t = tarfile.open(mode='r:gz', fileobj=f)
members = None
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)
t.extractall(path=output_dir)
def Update():
if os.path.exists(DIR):
RmTree(DIR)
try:
DownloadAndUnpack(URL, DIR, None)
DownloadAndUnpack(URL, DIR)
except URLError:
print('Failed to download prebuilt ninja/gn binaries %s' % URL)
print('Exiting.')