summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build_third_party.py36
-rwxr-xr-xtools/run_hooks.py29
2 files changed, 48 insertions, 17 deletions
diff --git a/tools/build_third_party.py b/tools/build_third_party.py
index e46c8ddd1..474fcbfd2 100755
--- a/tools/build_third_party.py
+++ b/tools/build_third_party.py
@@ -1,15 +1,8 @@
#!/usr/bin/env python
-# This script generates the third party dependencies of deno.
-# - Get Depot Tools and make sure it's in your path.
-# http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
-# - You need yarn installed as well.
-# https://yarnpkg.com/lang/en/docs/install/
-# Use //gclient_config.py to modify the git deps.
-# Use //js/package.json to modify the npm deps.
+# Only run this script if you are changing Deno's dependencies.
import os
from os.path import join
-import subprocess
from util import run, remove_and_symlink
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
@@ -20,14 +13,23 @@ try:
except:
pass
os.chdir(third_party_path)
-remove_and_symlink(join("..", "gclient_config.py"), ".gclient")
-remove_and_symlink(join("..", "package.json"), "package.json")
-remove_and_symlink(join("..", "yarn.lock"), "yarn.lock")
-remove_and_symlink(join("v8", "third_party", "googletest"), "googletest")
-remove_and_symlink(join("v8", "third_party", "jinja2"), "jinja2")
-remove_and_symlink(join("v8", "third_party", "llvm-build"), "llvm-build")
-remove_and_symlink(join("v8", "third_party", "markupsafe"), "markupsafe")
-run(["gclient", "sync", "--shallow", "--no-history"])
+
+# Run yarn to install JavaScript dependencies.
+remove_and_symlink("../package.json", "package.json")
+remove_and_symlink("../yarn.lock", "yarn.lock")
run(["yarn"])
-run(["cargo", "fetch", "--manifest-path=../Cargo.toml"],
+# Run cargo to install Rust dependencies.
+run(["cargo", "fetch", "--manifest-path=" + root_path + "/Cargo.toml"],
envs={'CARGO_HOME': third_party_path + '/rust_crates'})
+# Run gclient to install other dependencies.
+run(["gclient", "sync", "--reset", "--shallow", "--no-history", "--nohooks"],
+ envs={'GCLIENT_FILE': root_path + "/gclient_config.py"})
+# TODO(ry) Is it possible to remove these symlinks?
+remove_and_symlink("v8/third_party/googletest", "googletest")
+remove_and_symlink("v8/third_party/jinja2", "jinja2")
+remove_and_symlink("v8/third_party/llvm-build", "llvm-build")
+remove_and_symlink("v8/third_party/markupsafe", "markupsafe")
+
+# To update the deno_third_party git repo after running this, try the following:
+# cd third_party
+# find . -type f | grep -v "\.git" | xargs -I% git add -f --no-warn-embedded-repo "%"
diff --git a/tools/run_hooks.py b/tools/run_hooks.py
new file mode 100755
index 000000000..2ec671186
--- /dev/null
+++ b/tools/run_hooks.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+import os
+import sys
+from util import run
+
+root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+third_party_path = os.path.join(root_path, "third_party")
+depot_tools_path = os.path.join(third_party_path, "depot_tools")
+os.chdir(root_path)
+
+
+def download(fn):
+ run([
+ os.path.join(depot_tools_path + '/download_from_google_storage.py'),
+ '--no_resume', '--platform=' + sys.platform, '--no_auth', '--bucket',
+ 'chromium-gn', '-s',
+ os.path.join(root_path, fn)
+ ],
+ quiet=True)
+
+
+if sys.platform == 'win32':
+ download("third_party/v8/buildtools/win/gn.exe.sha1")
+elif sys.platform == 'darwin':
+ download("third_party/v8/buildtools/mac/gn.sha1")
+elif sys.platform.startswith('linux'):
+ download("third_party/v8/buildtools/linux64/gn.sha1")
+run(['python', 'third_party/v8/tools/clang/scripts/update.py', '--if-needed'],
+ quiet=True)