0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-12 02:27:50 -05:00

clean up (#4)

This commit is contained in:
Ry Dahl 2019-11-01 13:50:12 -04:00 committed by GitHub
parent 7846160a63
commit 0463a8bbfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 21 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018-2019 the Deno authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -4,3 +4,6 @@
This is a project to replace libdeno with a full V8 binding. It's very much This is a project to replace libdeno with a full V8 binding. It's very much
under construction and not usable. I'll update this message if it ever is. under construction and not usable. I'll update this message if it ever is.
Env vars used in build.rs: `SCCACHE`, `GCLIENT_SYNC`

View file

@ -1,3 +1,4 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use cargo_gn; use cargo_gn;
use std::env; use std::env;
use std::path::Path; use std::path::Path;
@ -26,25 +27,26 @@ fn main() {
println!("cargo:warning=Not using sccache"); println!("cargo:warning=Not using sccache");
} }
// gn_root should be absolute. // gn_root needs to be an absolute path.
let gn_root = env::current_dir() let gn_root = env::current_dir()
.unwrap() .unwrap()
.into_os_string() .into_os_string()
.into_string() .into_string()
.unwrap();; .unwrap();
let gn_out = cargo_gn::maybe_gen(&gn_root, gn_args); let gn_out = cargo_gn::maybe_gen(&gn_root, gn_args);
assert!(gn_out.exists()); assert!(gn_out.exists());
assert!(gn_out.join("args.gn").exists()); assert!(gn_out.join("args.gn").exists());
cargo_gn::build("rusty_v8"); cargo_gn::build("rusty_v8");
println!("cargo:rustc-link-lib=static=rusty_v8"); println!("cargo:rustc-link-lib=static=rusty_v8");
if cfg!(target_os = "windows") { if cfg!(target_os = "windows") {
println!("cargo:rustc-link-lib=dylib=winmm"); println!("cargo:rustc-link-lib=dylib=winmm");
} }
} }
fn git_submodule_update() { fn git_submodule_update() {
println!("cargo:warning=Running git submodule update");
Command::new("git") Command::new("git")
.arg("submodule") .arg("submodule")
.arg("update") .arg("update")
@ -57,30 +59,27 @@ fn gclient_sync() {
let root = env::current_dir().unwrap(); let root = env::current_dir().unwrap();
let third_party = root.join("third_party"); let third_party = root.join("third_party");
let gclient_rel = PathBuf::from("depot_tools/gclient.py"); let gclient_rel = PathBuf::from("depot_tools/gclient.py");
let gclient_file = third_party.join("gclient_config.py");
assert!(gclient_file.exists());
if !third_party.join(&gclient_rel).exists() { if !third_party.join(&gclient_rel).exists() {
git_submodule_update(); git_submodule_update();
} }
println!( println!("Running gclient sync to download V8. This could take a while.");
"cargo:warning=Running gclient sync to download V8. This could take a while."
);
let mut cmd = Command::new("python"); let status = Command::new("python")
cmd.current_dir(&third_party); .current_dir(&third_party)
cmd.arg(&gclient_rel); .arg(&gclient_rel)
cmd.arg("sync"); .arg("sync")
cmd.arg("--no-history"); .arg("--no-history")
cmd.arg("--shallow"); .arg("--shallow")
// cmd.arg("--verbose"); .env("DEPOT_TOOLS_UPDATE", "0")
cmd.env("DEPOT_TOOLS_UPDATE", "0"); .env("DEPOT_TOOLS_METRICS", "0")
cmd.env("DEPOT_TOOLS_METRICS", "0"); .env("GCLIENT_FILE", gclient_file)
cmd.env("GCLIENT_FILE", third_party.join("gclient_config.py")); .env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0")
// We're not using Google's internal infrastructure. .status()
cmd.env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0"); .expect("gclient sync failed");
println!("running: {:?}", cmd);
let status = cmd.status().expect("gclient sync failed");
assert!(status.success()); assert!(status.success());
} }

View file

@ -1,3 +1,5 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
#![warn(clippy::all)] #![warn(clippy::all)]
#![allow(dead_code)] #![allow(dead_code)]