diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/cargo_package.py | 2 | ||||
l--------- | tools/clang | 1 | ||||
-rwxr-xr-x | tools/format.py | 8 | ||||
-rwxr-xr-x | tools/lint.py | 7 | ||||
-rwxr-xr-x | tools/setup.py | 20 | ||||
-rw-r--r-- | tools/third_party.py | 24 | ||||
-rw-r--r-- | tools/util.py | 1 |
7 files changed, 35 insertions, 28 deletions
diff --git a/tools/cargo_package.py b/tools/cargo_package.py index 152685d6b..7696681e7 100755 --- a/tools/cargo_package.py +++ b/tools/cargo_package.py @@ -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) diff --git a/tools/clang b/tools/clang deleted file mode 120000 index e3fc67857..000000000 --- a/tools/clang +++ /dev/null @@ -1 +0,0 @@ -../third_party/v8/tools/clang
\ No newline at end of file diff --git a/tools/format.py b/tools/format.py index 2628928f1..ac6035804 100755 --- a/tools/format.py +++ b/tools/format.py @@ -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) diff --git a/tools/lint.py b/tools/lint.py index 29ed86fa9..61c6c59ce 100755 --- a/tools/lint.py +++ b/tools/lint.py @@ -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(), diff --git a/tools/setup.py b/tools/setup.py index b8b9da324..aef65924d 100755 --- a/tools/setup.py +++ b/tools/setup.py @@ -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__': diff --git a/tools/third_party.py b/tools/third_party.py index bcac9a5b4..bdb5662af 100644 --- a/tools/third_party.py +++ b/tools/third_party.py @@ -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()) diff --git a/tools/util.py b/tools/util.py index 82465f865..93502b06d 100644 --- a/tools/util.py +++ b/tools/util.py @@ -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") |