From 0463a8bbfb529764330e05d2e000bccdb28a9a90 Mon Sep 17 00:00:00 2001 From: Ry Dahl Date: Fri, 1 Nov 2019 13:50:12 -0400 Subject: [PATCH] clean up (#4) --- LICENSE | 21 +++++++++++++++++++++ README.md | 3 +++ build.rs | 41 ++++++++++++++++++++--------------------- src/lib.rs | 2 ++ 4 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..5a671244 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md index dfee7c28..ddaa4005 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,6 @@ 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. + + +Env vars used in build.rs: `SCCACHE`, `GCLIENT_SYNC` diff --git a/build.rs b/build.rs index 793866b8..7a12556f 100644 --- a/build.rs +++ b/build.rs @@ -1,3 +1,4 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use cargo_gn; use std::env; use std::path::Path; @@ -26,25 +27,26 @@ fn main() { 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() .unwrap() .into_os_string() .into_string() - .unwrap();; + .unwrap(); let gn_out = cargo_gn::maybe_gen(&gn_root, gn_args); assert!(gn_out.exists()); assert!(gn_out.join("args.gn").exists()); cargo_gn::build("rusty_v8"); + println!("cargo:rustc-link-lib=static=rusty_v8"); + if cfg!(target_os = "windows") { println!("cargo:rustc-link-lib=dylib=winmm"); } } fn git_submodule_update() { - println!("cargo:warning=Running git submodule update"); Command::new("git") .arg("submodule") .arg("update") @@ -57,30 +59,27 @@ fn gclient_sync() { let root = env::current_dir().unwrap(); let third_party = root.join("third_party"); 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() { git_submodule_update(); } - println!( - "cargo:warning=Running gclient sync to download V8. This could take a while." - ); + println!("Running gclient sync to download V8. This could take a while."); - let mut cmd = Command::new("python"); - cmd.current_dir(&third_party); - cmd.arg(&gclient_rel); - cmd.arg("sync"); - cmd.arg("--no-history"); - cmd.arg("--shallow"); - // cmd.arg("--verbose"); - cmd.env("DEPOT_TOOLS_UPDATE", "0"); - cmd.env("DEPOT_TOOLS_METRICS", "0"); - cmd.env("GCLIENT_FILE", third_party.join("gclient_config.py")); - // We're not using Google's internal infrastructure. - cmd.env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0"); - - println!("running: {:?}", cmd); - let status = cmd.status().expect("gclient sync failed"); + let status = Command::new("python") + .current_dir(&third_party) + .arg(&gclient_rel) + .arg("sync") + .arg("--no-history") + .arg("--shallow") + .env("DEPOT_TOOLS_UPDATE", "0") + .env("DEPOT_TOOLS_METRICS", "0") + .env("GCLIENT_FILE", gclient_file) + .env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0") + .status() + .expect("gclient sync failed"); assert!(status.success()); } diff --git a/src/lib.rs b/src/lib.rs index 4743c070..a82b5ae3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. + #![warn(clippy::all)] #![allow(dead_code)]