mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-23 15:50:11 -05:00
replace gclient with git submodules so 'cargo package' works with verification (#19)
This commit is contained in:
parent
011b9f31a7
commit
624f678bc7
18 changed files with 356 additions and 293 deletions
183
.gclient
183
.gclient
|
@ -1,183 +0,0 @@
|
|||
solutions = [
|
||||
{
|
||||
'url': 'https://github.com/v8/v8.git@7.9.317.12',
|
||||
'name': 'v8',
|
||||
'custom_hooks': [
|
||||
# Surpress v8 hooks... one wishes there was a better way to do this.
|
||||
{ 'name': 'disable_depot_tools_selfupdate' },
|
||||
{ 'name': 'landmines' },
|
||||
{ 'name': 'clang_format_win' },
|
||||
{ 'name': 'clang_format_mac' },
|
||||
{ 'name': 'clang_format_linux' },
|
||||
{ 'name': 'gcmole' },
|
||||
{ 'name': 'jsfunfuzz' },
|
||||
{ 'name': 'wasm_spec_tests' },
|
||||
{ 'name': 'wasm_js' },
|
||||
{ 'name': 'msan_chained_origins' },
|
||||
{ 'name': 'msan_no_origins' },
|
||||
{ 'name': 'win_toolchain' },
|
||||
{ 'name': 'mac_toolchain' },
|
||||
{ 'name': 'binutils' },
|
||||
{ 'name': 'clang' },
|
||||
{ 'name': 'lastchange' },
|
||||
{ 'name': 'fuchsia_sdk' },
|
||||
{ 'name': 'lld/mac' },
|
||||
{ 'name': 'llvm-objdump' },
|
||||
{ 'name': 'vpython_common' },
|
||||
{ 'name': 'check_v8_header_includes' },
|
||||
{ 'name': 'sysroot_arm' },
|
||||
{ 'name': 'sysroot_arm64' },
|
||||
{ 'name': 'sysroot_x86' },
|
||||
{ 'name': 'sysroot_x64' },
|
||||
],
|
||||
'custom_deps': {
|
||||
'v8/build': None,
|
||||
'v8/buildtools': None,
|
||||
'v8/buildtools/clang_format/script': None,
|
||||
'v8/buildtools/linux64': None,
|
||||
'v8/buildtools/mac': None,
|
||||
'v8/test/benchmarks/data': None,
|
||||
'v8/test/mozilla/data': None,
|
||||
'v8/test/test262/data': None,
|
||||
'v8/test/test262/harness': None,
|
||||
'v8/test/wasm-js': None,
|
||||
'v8/third_party/android_tools': None,
|
||||
'v8/third_party/catapult': None,
|
||||
'v8/third_party/colorama/src': None,
|
||||
'v8/third_party/depot_tools': None,
|
||||
#'v8/third_party/googletest/src': None,
|
||||
'v8/third_party/icu': None,
|
||||
'v8/third_party/instrumented_libraries': None,
|
||||
'v8/third_party/jinja2': None,
|
||||
'v8/third_party/markupsafe': None,
|
||||
'v8/third_party/perfetto': None,
|
||||
'v8/third_party/protobuf': None,
|
||||
'v8/tools/clang': None,
|
||||
'v8/tools/clang/dsymutil': None,
|
||||
'v8/tools/gyp': None,
|
||||
'v8/tools/luci-go': None,
|
||||
'v8/tools/swarming_client': None,
|
||||
}
|
||||
},
|
||||
{
|
||||
'url':
|
||||
'https://chromium.googlesource.com/chromium/src/build.git@082f11b29976c3be67dddd74bd75c6d1793201c7',
|
||||
'name': 'build',
|
||||
},
|
||||
{
|
||||
'url':
|
||||
'https://chromium.googlesource.com/chromium/src/buildtools.git@cf454b247c611167388742c7a31ef138a6031172',
|
||||
'name': 'buildtools',
|
||||
},
|
||||
{
|
||||
'url':
|
||||
'https://chromium.googlesource.com/chromium/src/tools/clang.git@c5d85f1e9d3a01e4de2ccf4dfaa7847653ae9121',
|
||||
'name': 'tools/clang',
|
||||
},
|
||||
{
|
||||
'url':
|
||||
'https://chromium.googlesource.com/chromium/src/third_party/jinja2.git@b41863e42637544c2941b574c7877d3e1f663e25',
|
||||
'name': 'third_party/jinja2',
|
||||
},
|
||||
{
|
||||
'url':
|
||||
'https://chromium.googlesource.com/chromium/src/third_party/markupsafe.git@8f45f5cfa0009d2a70589bcda0349b8cb2b72783',
|
||||
'name': 'third_party/markupsafe',
|
||||
},
|
||||
]
|
||||
|
||||
hooks = [
|
||||
{
|
||||
# Ensure that the DEPS'd "depot_tools" has its self-update capability
|
||||
# disabled.
|
||||
'name': 'disable_depot_tools_selfupdate',
|
||||
'pattern': '.',
|
||||
'action': [
|
||||
'python',
|
||||
'third_party/depot_tools/update_depot_tools_toggle.py',
|
||||
'--disable',
|
||||
],
|
||||
},
|
||||
# {
|
||||
# # This clobbers when necessary (based on get_landmines.py). It must be the
|
||||
# # first hook so that other things that get/generate into the output
|
||||
# # directory will not subsequently be clobbered.
|
||||
# 'name': 'landmines',
|
||||
# 'pattern': '.',
|
||||
# 'action': [
|
||||
# 'python',
|
||||
# 'build/landmines.py',
|
||||
# '--landmine-scripts',
|
||||
# 'tools/get_landmines.py',
|
||||
# ],
|
||||
# },
|
||||
{
|
||||
'name': 'sysroot_arm',
|
||||
'pattern': '.',
|
||||
'condition': '(checkout_linux and checkout_arm)',
|
||||
'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--arch=arm'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_arm64',
|
||||
'pattern': '.',
|
||||
'condition': '(checkout_linux and checkout_arm64)',
|
||||
'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--arch=arm64'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_x86',
|
||||
'pattern': '.',
|
||||
'condition': '(checkout_linux and (checkout_x86 or checkout_x64))',
|
||||
'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--arch=x86'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_x64',
|
||||
'pattern': '.',
|
||||
'condition': 'checkout_linux and checkout_x64',
|
||||
'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--arch=x64'],
|
||||
},
|
||||
{
|
||||
# Update the Windows toolchain if necessary.
|
||||
'name': 'win_toolchain',
|
||||
'pattern': '.',
|
||||
'condition': 'checkout_win',
|
||||
'action': ['python', 'build/vs_toolchain.py', 'update'],
|
||||
},
|
||||
{
|
||||
# Update the Mac toolchain if necessary.
|
||||
'name': 'mac_toolchain',
|
||||
'pattern': '.',
|
||||
'condition': 'checkout_mac',
|
||||
'action': ['python', 'build/mac_toolchain.py'],
|
||||
},
|
||||
# Pull binutils for linux, enabled debug fission for faster linking /
|
||||
# debugging when used with clang on Ubuntu Precise.
|
||||
# https://code.google.com/p/chromium/issues/detail?id=352046
|
||||
#{
|
||||
# 'name': 'binutils',
|
||||
# 'pattern': 'third_party/binutils',
|
||||
# 'condition': 'host_os == "linux"',
|
||||
# 'action': [
|
||||
# 'python',
|
||||
# 'v8/third_party/binutils/download.py',
|
||||
# ],
|
||||
#},
|
||||
{
|
||||
# Note: On Win, this should run after win_toolchain, as it may use it.
|
||||
'name': 'clang',
|
||||
'pattern': '.',
|
||||
# clang not supported on aix
|
||||
'condition': 'host_os != "aix"',
|
||||
'action': ['python', 'tools/clang/scripts/update.py'],
|
||||
},
|
||||
{
|
||||
# Update LASTCHANGE.
|
||||
'name': 'lastchange',
|
||||
'pattern': '.',
|
||||
'action': ['python', 'build/util/lastchange.py',
|
||||
'-o', 'build/util/LASTCHANGE'],
|
||||
},
|
||||
]
|
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
|
@ -18,25 +18,18 @@ jobs:
|
|||
uses: actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 10
|
||||
submodules: true
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Install rust
|
||||
uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
rust-version: "1.38.0"
|
||||
|
||||
- name: Remove unused versions of Python
|
||||
# Depot_tools brings its own Python and bootstraps virtualenv. The
|
||||
# latter fails on windows when unused versions of Python are in present
|
||||
# in PATH, so we remove those.
|
||||
# 🤯 Removing items from PATH does not seem possible on Github Actions,
|
||||
# not even by using `echo ::set-env name=PATH`, so we have to rename
|
||||
# or delete the actual Python directories.
|
||||
if: startsWith(matrix.os, 'windows')
|
||||
run: |-
|
||||
$env:PATH -split ";" |
|
||||
Where-Object { Test-Path "$_\python.exe" } |
|
||||
ForEach-Object { Move-Item "$_" "$_.disabled" }
|
||||
- name: Install python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: "2.7.x"
|
||||
architecture: x64
|
||||
|
||||
- name: Environment (common)
|
||||
run: echo ::set-env name=RUSTC_WRAPPER::sccache
|
||||
|
|
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -3,13 +3,3 @@
|
|||
|
||||
/.vscode/
|
||||
/target/
|
||||
/.cipd/
|
||||
.gclient_entries
|
||||
/v8/
|
||||
/build/
|
||||
/buildtools/
|
||||
/tools/clang/
|
||||
/third_party/jinja2/
|
||||
/third_party/markupsafe/
|
||||
/third_party/llvm-build/
|
||||
.landmines
|
||||
|
|
24
.gitmodules
vendored
24
.gitmodules
vendored
|
@ -1,3 +1,21 @@
|
|||
[submodule "depot_tools"]
|
||||
path = third_party/depot_tools
|
||||
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
[submodule "v8"]
|
||||
path = v8
|
||||
url = https://github.com/v8/v8.git
|
||||
[submodule "build"]
|
||||
path = build
|
||||
url = https://github.com/denoland/chromium_build.git
|
||||
[submodule "tools/clang"]
|
||||
path = tools/clang
|
||||
url = https://chromium.googlesource.com/chromium/src/tools/clang.git
|
||||
[submodule "base/trace_event/common"]
|
||||
path = base/trace_event/common
|
||||
url = https://chromium.googlesource.com/chromium/src/base/trace_event/common.git
|
||||
[submodule "third_party/jinja2"]
|
||||
path = third_party/jinja2
|
||||
url = https://chromium.googlesource.com/chromium/src/third_party/jinja2.git
|
||||
[submodule "third_party/markupsafe"]
|
||||
path = third_party/markupsafe
|
||||
url = https://chromium.googlesource.com/chromium/src/third_party/markupsafe.git
|
||||
[submodule "buildtools"]
|
||||
path = buildtools
|
||||
url = https://github.com/denoland/chromium_buildtools.git
|
||||
|
|
4
.gn
4
.gn
|
@ -41,6 +41,10 @@ default_args = {
|
|||
# this breaks cargo build in debug mode in OSX.
|
||||
is_component_build = false
|
||||
|
||||
use_sysroot = false
|
||||
|
||||
use_dummy_lastchange = true
|
||||
|
||||
symbol_level = 1
|
||||
treat_warnings_as_errors = true
|
||||
|
||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -60,7 +60,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "rusty_v8"
|
||||
version = "0.0.2"
|
||||
version = "0.0.5"
|
||||
dependencies = [
|
||||
"cargo_gn 0.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
44
Cargo.toml
44
Cargo.toml
|
@ -1,23 +1,45 @@
|
|||
[package]
|
||||
name = "rusty_v8"
|
||||
version = "0.0.2"
|
||||
version = "0.0.5"
|
||||
description = "Rust bindings to V8"
|
||||
readme = "README.md"
|
||||
authors = ["the Deno authors"]
|
||||
license = "MIT"
|
||||
edition = "2018"
|
||||
repository = "https://github.com/denoland/rusty_v8"
|
||||
|
||||
exclude = [
|
||||
".cipd",
|
||||
".gclient_entries",
|
||||
"v8",
|
||||
"build",
|
||||
"buildtools",
|
||||
"tools/clang",
|
||||
"third_party/jinja2",
|
||||
"third_party/markupsafe",
|
||||
"third_party/llvm-build",
|
||||
".landmines",
|
||||
# To keep the package under the 10mb limit imposed by crates.io we exclude
|
||||
# a lot of files that are not needed for the build.
|
||||
"*.md",
|
||||
"*.txt",
|
||||
"*.settings",
|
||||
"*OWNERS*",
|
||||
"AUTHORS",
|
||||
"LICENSE*",
|
||||
"README*",
|
||||
"build/android/",
|
||||
"build/chromeos/",
|
||||
"build/fuchsia/",
|
||||
"buildtools/third_party/libc++/trunk/test/",
|
||||
"buildtools/third_party/libc++abi/trunk/test/",
|
||||
"buildtools/checkdeps/",
|
||||
"buildtools/clang_format/",
|
||||
"v8/ChangeLog",
|
||||
"v8/docs/",
|
||||
"v8/benchmarks/",
|
||||
"v8/samples/",
|
||||
"v8/test/",
|
||||
"v8/third_party/wasm-api",
|
||||
"v8/tools/",
|
||||
# These files are required for the build.
|
||||
"!BUILD.gn",
|
||||
"!test-torque.tq",
|
||||
"!v8/tools/run.py",
|
||||
"!v8/tools/testrunner/utils/dump_build_config.py",
|
||||
"!v8/tools/gen-postmortem-metadata.py",
|
||||
"!v8/tools/js2c.py",
|
||||
"!tools/clang/scripts/update.py",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
|
|
1
base/trace_event/common
Submodule
1
base/trace_event/common
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 5e4fce17a9d2439c44a7b57ceecef6df9287ec2f
|
1
build
Submodule
1
build
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 4d6554f3741e76b4c57d4aa58d5df98716a38c05
|
160
build.rs
160
build.rs
|
@ -2,16 +2,32 @@
|
|||
use cargo_gn;
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use which::which;
|
||||
|
||||
fn main() {
|
||||
init_depot_tools();
|
||||
env::set_var("DEPOT_TOOLS_WIN_TOOLCHAIN", "0");
|
||||
|
||||
if !Path::new("v8/src").is_dir()
|
||||
|| env::var_os("GCLIENT_SYNC").is_some()
|
||||
{
|
||||
gclient_sync();
|
||||
// cargo publish doesn't like pyc files.
|
||||
env::set_var("PYTHONDONTWRITEBYTECODE", "1");
|
||||
|
||||
// git submodule update --init --recursive
|
||||
let libcxx_src = PathBuf::from("buildtools/third_party/libc++/trunk/src");
|
||||
if !libcxx_src.is_dir() {
|
||||
eprintln!(
|
||||
"missing source code. Run 'git submodule update --init --recursive'"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't build if "cargo doc" is being run.
|
||||
if env::var_os("RUSTDOCFLAGS").is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
if need_gn_ninja_download() {
|
||||
download_gn_ninja_binaries();
|
||||
}
|
||||
|
||||
// On windows, rustc cannot link with a V8 debug build.
|
||||
|
@ -21,6 +37,9 @@ fn main() {
|
|||
vec!["is_debug=false".to_string()]
|
||||
};
|
||||
|
||||
let clang_base_path = clang_download();
|
||||
gn_args.push(format!("clang_base_path={:?}", clang_base_path));
|
||||
|
||||
if let Some(p) = env::var_os("SCCACHE") {
|
||||
cc_wrapper(&mut gn_args, &Path::new(&p));
|
||||
} else if let Ok(p) = which("sccache") {
|
||||
|
@ -44,78 +63,77 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
fn init_depot_tools() {
|
||||
env::set_var("DEPOT_TOOLS_WIN_TOOLCHAIN", "0");
|
||||
env::set_var("DEPOT_TOOLS_UPDATE", "0");
|
||||
env::set_var("DEPOT_TOOLS_METRICS", "0");
|
||||
|
||||
let depot_tools = env::current_dir()
|
||||
.unwrap()
|
||||
.join("third_party")
|
||||
.join("depot_tools");
|
||||
|
||||
// Add third_party/depot_tools and buildtools/win to PATH.
|
||||
// TODO: buildtools/win should not be added; instead, cargo_gn should invoke
|
||||
// depot_tools/gn.bat.
|
||||
let buildtools_win =
|
||||
env::current_dir().unwrap().join("buildtools").join("win");
|
||||
|
||||
// Bootstrap depot_tools.
|
||||
let path = env::var_os("PATH").unwrap();
|
||||
|
||||
// "Add depot_tools to the start of your PATH (must be ahead of any installs
|
||||
// of Python)."
|
||||
// https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
|
||||
let paths = vec![depot_tools.clone(), buildtools_win]
|
||||
.into_iter()
|
||||
.chain(env::split_paths(&path))
|
||||
.collect::<Vec<_>>();
|
||||
let path = env::join_paths(paths).unwrap();
|
||||
env::set_var("PATH", &path);
|
||||
|
||||
env::set_var("GN", which("gn").unwrap());
|
||||
|
||||
if cfg!(windows) {
|
||||
// Bootstrap depot_tools.
|
||||
if !depot_tools.join("git.bat").is_file() {
|
||||
let status = Command::new("cmd.exe")
|
||||
.arg("/c")
|
||||
.arg("bootstrap\\win_tools.bat")
|
||||
.current_dir(&depot_tools)
|
||||
.status()
|
||||
.expect("bootstrapping depot_tools failed");
|
||||
assert!(status.success());
|
||||
}
|
||||
fn platform() -> &'static str {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
"win"
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
"linux64"
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
"mac"
|
||||
}
|
||||
}
|
||||
|
||||
fn gclient_sync() {
|
||||
fn download_gn_ninja_binaries() {
|
||||
let root = env::current_dir().unwrap();
|
||||
let third_party = root.join("third_party");
|
||||
let depot_tools = third_party.join("depot_tools");
|
||||
|
||||
let gclient = depot_tools.join(if cfg!(windows) {
|
||||
"gclient.bat"
|
||||
} else {
|
||||
"gclient"
|
||||
});
|
||||
if !gclient.is_file() {
|
||||
panic!(
|
||||
"Could not find gclient {}. Maybe run git submodule update?",
|
||||
gclient.display()
|
||||
);
|
||||
}
|
||||
|
||||
println!("Running gclient sync to download V8. This could take a while.");
|
||||
|
||||
let status = Command::new(gclient)
|
||||
.current_dir(&root)
|
||||
.arg("sync")
|
||||
.arg("--no-history")
|
||||
.arg("--shallow")
|
||||
let out_dir = root.join(env::var_os("OUT_DIR").unwrap());
|
||||
let status = Command::new("python")
|
||||
.arg("./tools/gn_ninja_binaries.py")
|
||||
.arg("--dir")
|
||||
.arg(&out_dir)
|
||||
.status()
|
||||
.expect("gclient sync failed");
|
||||
.expect("gn_ninja_binaries.py download failed");
|
||||
assert!(status.success());
|
||||
|
||||
let d = out_dir.join("gn_ninja_binaries").join(platform());
|
||||
|
||||
let gn = d.join("gn");
|
||||
let ninja = d.join("ninja");
|
||||
|
||||
#[cfg(windows)]
|
||||
let gn = gn.with_extension("exe");
|
||||
#[cfg(windows)]
|
||||
let ninja = ninja.with_extension("exe");
|
||||
|
||||
env::set_var("GN", gn);
|
||||
env::set_var("NINJA", ninja);
|
||||
}
|
||||
|
||||
fn need_gn_ninja_download() -> bool {
|
||||
!((which("ninja").is_ok() || env::var_os("NINJA").is_some())
|
||||
&& env::var_os("GN").is_some())
|
||||
}
|
||||
|
||||
// Download chromium's clang into OUT_DIR because Cargo will not allow us to
|
||||
// modify the source directory.
|
||||
fn clang_download() -> PathBuf {
|
||||
// TODO(ry) We can support clang 10 and above.... if that is installed use
|
||||
// it.
|
||||
/*
|
||||
if let Ok(clang_path) = which("clang") {
|
||||
//
|
||||
let bin_path = clang_path.parent().unwrap();
|
||||
return bin_path.parent().unwrap().to_path_buf();
|
||||
}
|
||||
*/
|
||||
|
||||
let root = env::current_dir().unwrap();
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
let clang_base_path = root.join(out_dir).join("clang");
|
||||
println!("clang_base_path {}", clang_base_path.display());
|
||||
let status = Command::new("python")
|
||||
.arg("./tools/clang/scripts/update.py")
|
||||
.arg("--clang-dir")
|
||||
.arg(&clang_base_path)
|
||||
.status()
|
||||
.expect("clang download failed");
|
||||
assert!(status.success());
|
||||
assert!(clang_base_path.exists());
|
||||
clang_base_path
|
||||
}
|
||||
|
||||
fn cc_wrapper(gn_args: &mut Vec<String>, sccache_path: &Path) {
|
||||
|
|
1
buildtools
Submodule
1
buildtools
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit f446d2d4fda7b7da42670ecb9b42059d561e1166
|
1
third_party/depot_tools
vendored
1
third_party/depot_tools
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit ba97f6065ed1e9336585468dd85e680cf09d5166
|
61
third_party/googletest/src/googletest/include/gtest/gtest_prod.h
vendored
Normal file
61
third_party/googletest/src/googletest/include/gtest/gtest_prod.h
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright 2006, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//
|
||||
// Google C++ Testing and Mocking Framework definitions useful in production code.
|
||||
// GOOGLETEST_CM0003 DO NOT DELETE
|
||||
|
||||
#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
|
||||
#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
|
||||
|
||||
// When you need to test the private or protected members of a class,
|
||||
// use the FRIEND_TEST macro to declare your tests as friends of the
|
||||
// class. For example:
|
||||
//
|
||||
// class MyClass {
|
||||
// private:
|
||||
// void PrivateMethod();
|
||||
// FRIEND_TEST(MyClassTest, PrivateMethodWorks);
|
||||
// };
|
||||
//
|
||||
// class MyClassTest : public testing::Test {
|
||||
// // ...
|
||||
// };
|
||||
//
|
||||
// TEST_F(MyClassTest, PrivateMethodWorks) {
|
||||
// // Can call MyClass::PrivateMethod() here.
|
||||
// }
|
||||
//
|
||||
// Note: The test class must be in the same namespace as the class being tested.
|
||||
// For example, putting MyClassTest in an anonymous namespace will not work.
|
||||
|
||||
#define FRIEND_TEST(test_case_name, test_name)\
|
||||
friend class test_case_name##_##test_name##_Test
|
||||
|
||||
#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
|
1
third_party/jinja2
vendored
Submodule
1
third_party/jinja2
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit b41863e42637544c2941b574c7877d3e1f663e25
|
1
third_party/markupsafe
vendored
Submodule
1
third_party/markupsafe
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 8f45f5cfa0009d2a70589bcda0349b8cb2b72783
|
1
tools/clang
Submodule
1
tools/clang
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit c5d85f1e9d3a01e4de2ccf4dfaa7847653ae9121
|
134
tools/gn_ninja_binaries.py
Executable file
134
tools/gn_ninja_binaries.py
Executable file
|
@ -0,0 +1,134 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
"""This script is used to download prebuilt gn/ninja binaries."""
|
||||
|
||||
# TODO: Running stand-alone won't work on Windows due to the dia dll copying.
|
||||
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
try:
|
||||
from urllib2 import HTTPError, URLError, urlopen
|
||||
except ImportError: # For Py3 compatibility
|
||||
from urllib.error import HTTPError, URLError
|
||||
from urllib.request import urlopen
|
||||
|
||||
URL = "https://s3.amazonaws.com/deno.land/gn_ninja_binaries.tar.gz"
|
||||
DIR = None
|
||||
|
||||
|
||||
def RmTree(dir):
|
||||
"""Delete dir."""
|
||||
|
||||
def ChmodAndRetry(func, path, _):
|
||||
# Subversion can leave read-only files around.
|
||||
if not os.access(path, os.W_OK):
|
||||
os.chmod(path, stat.S_IWUSR)
|
||||
return func(path)
|
||||
raise
|
||||
|
||||
shutil.rmtree(dir, onerror=ChmodAndRetry)
|
||||
|
||||
|
||||
def DownloadUrl(url, output_file):
|
||||
"""Download url into output_file."""
|
||||
CHUNK_SIZE = 4096
|
||||
TOTAL_DOTS = 10
|
||||
num_retries = 3
|
||||
retry_wait_s = 5 # Doubled at each retry.
|
||||
|
||||
while True:
|
||||
try:
|
||||
sys.stdout.write('Downloading %s ' % url)
|
||||
sys.stdout.flush()
|
||||
response = urlopen(url)
|
||||
total_size = int(response.info().get('Content-Length').strip())
|
||||
bytes_done = 0
|
||||
dots_printed = 0
|
||||
while True:
|
||||
chunk = response.read(CHUNK_SIZE)
|
||||
if not chunk:
|
||||
break
|
||||
output_file.write(chunk)
|
||||
bytes_done += len(chunk)
|
||||
num_dots = TOTAL_DOTS * bytes_done // total_size
|
||||
sys.stdout.write('.' * (num_dots - dots_printed))
|
||||
sys.stdout.flush()
|
||||
dots_printed = num_dots
|
||||
if bytes_done != total_size:
|
||||
raise URLError(
|
||||
"only got %d of %d bytes" % (bytes_done, total_size))
|
||||
print(' Done.')
|
||||
return
|
||||
except URLError as e:
|
||||
sys.stdout.write('\n')
|
||||
print(e)
|
||||
if num_retries == 0 or isinstance(e, HTTPError) and e.code == 404:
|
||||
raise e
|
||||
num_retries -= 1
|
||||
print('Retrying in %d s ...' % retry_wait_s)
|
||||
sys.stdout.flush()
|
||||
time.sleep(retry_wait_s)
|
||||
retry_wait_s *= 2
|
||||
|
||||
|
||||
def EnsureDirExists(path):
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
|
||||
|
||||
def DownloadAndUnpack(url, output_dir, path_prefixes=None):
|
||||
"""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."""
|
||||
with tempfile.TemporaryFile() as f:
|
||||
DownloadUrl(url, f)
|
||||
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)
|
||||
|
||||
|
||||
def Update():
|
||||
if os.path.exists(DIR):
|
||||
RmTree(DIR)
|
||||
try:
|
||||
DownloadAndUnpack(URL, DIR, None)
|
||||
except URLError:
|
||||
print('Failed to download prebuilt ninja/gn binaries %s' % URL)
|
||||
print('Exiting.')
|
||||
sys.exit(1)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Download ninja/gn binaries.')
|
||||
parser.add_argument('--dir', help='Where to extract the package.')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.dir:
|
||||
global DIR
|
||||
DIR = os.path.abspath(args.dir)
|
||||
|
||||
return Update()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
1
v8
Submodule
1
v8
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 9d867c52741eb9fd5e63918e18e124d496d526d9
|
Loading…
Reference in a new issue