Move GN root into //core/libdeno (#2943)

This commit is contained in:
Christian Moritz 2019-09-12 21:07:21 +02:00 committed by Bert Belder
parent 40a6d83073
commit 9c282d6a0e
No known key found for this signature in database
GPG Key ID: 7A77887B2E2ED461
31 changed files with 81 additions and 80 deletions

6
.gitattributes vendored
View File

@ -4,7 +4,7 @@
# Tell git which symlinks point to files, and which ones point to directories.
# This is relevant for Windows only, and requires git >= 2.19.2 to work.
/* symlink=dir
/website/* symlink=dir
/tools/clang symlink=dir
/core/libdeno/* symlink=dir
/node_modules symlink=dir
/tools/memory symlink=dir
/website/* symlink=dir

2
.gitmodules vendored
View File

@ -2,7 +2,7 @@
path = third_party
url = https://github.com/denoland/deno_third_party.git
[submodule "build"]
path = build
path = core/libdeno/build
url = https://github.com/denoland/chromium_build.git
[submodule "js/deps/https/deno.land/x/std"]
path = js/deps/https/deno.land/std

View File

@ -1,6 +0,0 @@
group("default") {
testonly = true
deps = [
"core/libdeno:default",
]
}

View File

@ -1 +0,0 @@
third_party/v8/build_overrides

View File

@ -1 +0,0 @@
third_party/v8/buildtools

View File

@ -4,12 +4,9 @@
fn main() {
let build = gn::Build::setup();
println!(
"cargo:rustc-link-search=native={}/obj/core/libdeno",
build.gn_out_dir
);
println!("cargo:rustc-link-search=native={}/obj", build.gn_out_dir);
build.run("core/libdeno:default");
build.run("default");
}
mod gn {

View File

@ -1,5 +1,5 @@
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import("//third_party/v8/gni/v8.gni")
import("//v8/gni/v8.gni")
group("default") {
testonly = true
@ -11,8 +11,8 @@ group("default") {
}
config("deno_config") {
include_dirs = [ "//third_party/v8" ] # This allows us to v8/src/base/ libraries.
configs = [ "//third_party/v8:external_config" ]
include_dirs = [ "//v8" ] # This allows us to v8/src/base/ libraries.
configs = [ "//v8:external_config" ]
cflags = []
if (is_debug) {
@ -39,10 +39,10 @@ config("deno_config") {
v8_source_set("v8") {
deps = [
"//third_party/v8:v8",
"//third_party/v8:v8_libbase",
"//third_party/v8:v8_libplatform",
"//third_party/v8:v8_libsampler",
"//v8:v8",
"//v8:v8_libbase",
"//v8:v8_libplatform",
"//v8:v8_libsampler",
]
configs = [ ":deno_config" ]
}

View File

@ -5,9 +5,9 @@
#include <iostream>
#include <string>
#include "third_party/v8/include/libplatform/libplatform.h"
#include "third_party/v8/include/v8.h"
#include "third_party/v8/src/base/logging.h"
#include "v8/include/libplatform/libplatform.h"
#include "v8/include/v8.h"
#include "v8/src/base/logging.h"
#include "deno.h"
#include "exceptions.h"

View File

@ -14,8 +14,8 @@
#include <windows.h>
#endif // _WIN32
#include "third_party/v8/include/v8.h"
#include "third_party/v8/src/base/logging.h"
#include "v8/include/v8.h"
#include "v8/src/base/logging.h"
#include "deno.h"
#include "exceptions.h"

View File

@ -10,8 +10,8 @@
#include <unordered_map>
#include <utility>
#include "third_party/v8/include/v8.h"
#include "third_party/v8/src/base/logging.h"
#include "v8/include/v8.h"
#include "v8/src/base/logging.h"
namespace deno {

View File

@ -0,0 +1 @@
v8/build_overrides

1
core/libdeno/buildtools Symbolic link
View File

@ -0,0 +1 @@
v8/buildtools

View File

@ -3,7 +3,7 @@
#define EXCEPTIONS_H_
#include <string>
#include "third_party/v8/include/v8.h"
#include "v8/include/v8.h"
namespace deno {

View File

@ -9,8 +9,8 @@
#include "buffer.h"
#include "deno.h"
#include "third_party/v8/include/v8.h"
#include "third_party/v8/src/base/logging.h"
#include "v8/include/v8.h"
#include "v8/src/base/logging.h"
namespace deno {

1
core/libdeno/testing Symbolic link
View File

@ -0,0 +1 @@
v8/testing

1
core/libdeno/third_party Symbolic link
View File

@ -0,0 +1 @@
v8/third_party

1
core/libdeno/tools Symbolic link
View File

@ -0,0 +1 @@
v8/tools

1
core/libdeno/v8 Symbolic link
View File

@ -0,0 +1 @@
../../third_party/v8

View File

@ -8,9 +8,9 @@ testPerm({ read: true }, async function statSyncSuccess(): Promise<void> {
assert(packageInfo.isFile());
assert(!packageInfo.isSymlink());
const testingInfo = Deno.statSync("testing");
assert(testingInfo.isDirectory());
assert(!testingInfo.isSymlink());
const modulesInfo = Deno.statSync("node_modules");
assert(modulesInfo.isDirectory());
assert(!modulesInfo.isSymlink());
const testsInfo = Deno.statSync("tests");
assert(testsInfo.isDirectory());
@ -50,9 +50,9 @@ testPerm({ read: true }, async function lstatSyncSuccess(): Promise<void> {
assert(packageInfo.isFile());
assert(!packageInfo.isSymlink());
const testingInfo = Deno.lstatSync("testing");
assert(!testingInfo.isDirectory());
assert(testingInfo.isSymlink());
const modulesInfo = Deno.lstatSync("node_modules");
assert(!modulesInfo.isDirectory());
assert(modulesInfo.isSymlink());
const testsInfo = Deno.lstatSync("tests");
assert(testsInfo.isDirectory());
@ -92,9 +92,9 @@ testPerm({ read: true }, async function statSuccess(): Promise<void> {
assert(packageInfo.isFile());
assert(!packageInfo.isSymlink());
const testingInfo = await Deno.stat("testing");
assert(testingInfo.isDirectory());
assert(!testingInfo.isSymlink());
const modulesInfo = await Deno.stat("node_modules");
assert(modulesInfo.isDirectory());
assert(!modulesInfo.isSymlink());
const testsInfo = await Deno.stat("tests");
assert(testsInfo.isDirectory());
@ -134,9 +134,9 @@ testPerm({ read: true }, async function lstatSuccess(): Promise<void> {
assert(packageInfo.isFile());
assert(!packageInfo.isSymlink());
const testingInfo = await Deno.lstat("testing");
assert(!testingInfo.isDirectory());
assert(testingInfo.isSymlink());
const modulesInfo = await Deno.lstat("node_modules");
assert(!modulesInfo.isDirectory());
assert(modulesInfo.isSymlink());
const testsInfo = await Deno.lstat("tests");
assert(testsInfo.isDirectory());

View File

@ -1 +0,0 @@
third_party/v8/testing

@ -1 +1 @@
Subproject commit 4b36ce22a2ef7310f815acb6a2de0d26766a24b6
Subproject commit 5f9af82470e8770a1c0170bbcf30502509332dac

View File

@ -30,7 +30,7 @@ elif sys.platform == "win32":
else:
assert (False)
lib_name = os.path.join(root_path, "target/release/obj/core/libdeno",
lib_name = os.path.join(root_path, "target", "release", "obj",
"libdeno" + static_lib_suffix)

View File

@ -1 +0,0 @@
../third_party/v8/tools/clang

View File

@ -3,7 +3,7 @@
import os
import sys
import argparse
from third_party import google_env, python_env
from third_party import get_buildtools_tool_path, google_env, python_env
from util import git_ls_files, third_party_path, root_path, run
@ -44,8 +44,8 @@ def main():
def clang_format():
print "clang_format"
exe = os.path.join(third_party_path, "depot_tools", "clang-format")
print "clang-format"
exe = get_buildtools_tool_path("clang-format")
source_files = git_ls_files(root_path, ["*.cc", "*.h"])
run([exe, "-i", "-style", "Google", "--"] + source_files,
env=google_env(),
@ -54,7 +54,7 @@ def clang_format():
def gn_format():
print "gn format"
exe = os.path.join(third_party_path, "depot_tools", "gn")
exe = get_buildtools_tool_path("gn")
source_files = git_ls_files(root_path, ["*.gn", "*.gni"])
run([exe, "format", "--"] + source_files, env=google_env(), quiet=True)

View File

@ -4,7 +4,7 @@
import os
import sys
from util import enable_ansi_colors, git_ls_files, root_path, run
from util import enable_ansi_colors, git_ls_files, libdeno_path, root_path, run
from util import third_party_path
from third_party import python_env
@ -20,14 +20,13 @@ def main():
def cpplint():
print "cpplint"
script = os.path.join(third_party_path, "cpplint", "cpplint.py")
libdeno_dir = os.path.join(root_path, "core", "libdeno")
source_files = git_ls_files(libdeno_dir, ["*.cc", "*.h"])
source_files = git_ls_files(libdeno_path, ["*.cc", "*.h"])
run([
sys.executable,
script,
"--quiet",
"--filter=-build/include_subdir",
"--repository=" + libdeno_dir,
"--repository=" + libdeno_path,
"--",
] + source_files,
env=python_env(),

View File

@ -6,8 +6,8 @@ import sys
from distutils.spawn import find_executable
import argparse
import third_party
from util import build_mode, build_path, enable_ansi_colors, run, shell_quote
from util import root_path, third_party_path
from util import build_mode, build_path, enable_ansi_colors, libdeno_path
from util import shell_quote, root_path, run, third_party_path
parser = argparse.ArgumentParser()
parser.add_argument(
@ -49,15 +49,17 @@ def write_if_not_exists(filename, contents):
def write_lastchange():
lastchange_file = os.path.join(libdeno_path, "build", "util", "LASTCHANGE")
committime_file = lastchange_file + ".committime"
write_if_not_exists(
"build/util/LASTCHANGE",
lastchange_file,
"LASTCHANGE=c42e4ddbb7973bfb0c57a49ab6bf6dc432baad7e-\n")
write_if_not_exists("build/util/LASTCHANGE.committime", "1535518087")
write_if_not_exists(committime_file, "1535518087")
# TODO Properly we should call the following script, but it seems to cause
# a rebuild on every commit.
# run([
# sys.executable, "build/util/lastchange.py", "-o",
# "build/util/LASTCHANGE", "--source-dir", root_path, "--filter="
# sys.executable, "build/util/lastchange.py", "-o", lastchange_file,
# "--source-dir", root_path, "--filter="
# ])
@ -146,7 +148,7 @@ def gn_exe():
if "DENO_GN_PATH" in os.environ:
return os.environ["DENO_GN_PATH"]
else:
return os.path.join(third_party_path, "depot_tools", "gn")
return third_party.get_buildtools_tool_path("gn")
# gn gen.
@ -175,7 +177,9 @@ def gn_gen(mode):
for line in gn_args:
print " " + line
run([gn_exe(), "gen", build_path()], env=third_party.google_env())
run([gn_exe(), "gen", build_path()],
cwd=libdeno_path,
env=third_party.google_env())
if __name__ == '__main__':

View File

@ -7,10 +7,9 @@ import re
import site
import sys
from tempfile import mkdtemp
from util import add_env_path, executable_suffix, make_env, rmtree, root_path
from util import run, third_party_path
from util import add_env_path, executable_suffix, libdeno_path, make_env, rmtree
from util import root_path, run, third_party_path
chromium_build_path = os.path.join(root_path, "build")
depot_tools_path = os.path.join(third_party_path, "depot_tools")
prebuilt_path = os.path.join(root_path, "prebuilt")
python_packages_path = os.path.join(third_party_path, "python_packages")
@ -32,7 +31,8 @@ def python_env(env=None, merge_env=None):
python_site_env = {}
temp = os.environ["PATH"], sys.path
os.environ["PATH"], sys.path = "", []
site.addsitedir(chromium_build_path) # Modifies PATH and sys.path.
site.addsitedir(os.path.join(libdeno_path,
"build")) # Modifies PATH and sys.path.
site.addsitedir(python_packages_path) # Modifies PATH and sys.path.
python_site_env = {"PATH": os.environ["PATH"], "PYTHONPATH": sys.path}
os.environ["PATH"], sys.path = temp
@ -181,6 +181,11 @@ def get_prebuilt_tool_path(tool):
tool + executable_suffix)
def get_buildtools_tool_path(tool):
return os.path.join(libdeno_path, "buildtools", get_platform_dir_name(),
tool + executable_suffix)
# Download the given item from Google storage.
def download_from_google_storage(item, bucket, base_dir):
download_script = os.path.join(depot_tools_path,
@ -202,7 +207,7 @@ def download_from_google_storage(item, bucket, base_dir):
# Download the given item from Chrome Infrastructure Package Deployment.
def download_from_cipd(item, version):
cipd_exe = os.path.join(depot_tools_path, "cipd")
download_dir = os.path.join(third_party_path, "v8", "buildtools",
download_dir = os.path.join(libdeno_path, "buildtools",
get_platform_dir_name())
if sys.platform == "win32":
@ -239,9 +244,8 @@ def download_gn():
# Download clang-format from Google storage.
def download_clang_format():
download_from_google_storage(
"clang-format", "chromium-clang-format",
os.path.join(third_party_path, "v8", "buildtools"))
download_from_google_storage("clang-format", "chromium-clang-format",
os.path.join(libdeno_path, "buildtools"))
def download_sccache():
@ -254,13 +258,13 @@ def download_hyperfine():
# Download clang by calling the clang update script.
def download_clang():
update_script = os.path.join(third_party_path, "v8", "tools", "clang",
update_script = os.path.join(libdeno_path, "v8", "tools", "clang",
"scripts", "update.py")
run([sys.executable, update_script], env=google_env())
def maybe_download_sysroot():
if sys.platform.startswith("linux"):
install_script = os.path.join(chromium_build_path, "linux",
install_script = os.path.join(libdeno_path, "build", "linux",
"sysroot_scripts", "install-sysroot.py")
run([sys.executable, install_script, "--arch=amd64"], env=google_env())

View File

@ -20,6 +20,7 @@ else:
executable_suffix = ".exe" if os.name == "nt" else ""
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
libdeno_path = os.path.join(root_path, "core", "libdeno")
tests_path = os.path.join(root_path, "tests")
third_party_path = os.path.join(root_path, "third_party")

View File

@ -204,16 +204,16 @@ ninja -C target/debug
cargo build --release
# List executable targets.
gn ls target/debug //:* --as=output --type=executable
gn --root=core/libdeno ls target/debug "//:*" --as=output --type=executable
# List build configuration.
gn args target/debug/ --list
gn --root=core/libdeno args target/debug/ --list
# Edit build configuration.
gn args target/debug/
gn --root=core/libdeno args target/debug/
# Describe a target.
gn desc target/debug/ :deno
gn --root=core/libdeno desc target/debug/ :deno
gn help
# Update third_party modules