diff options
-rw-r--r-- | .gitignore | 11 | ||||
l--------- | third_party/.gclient | 1 | ||||
l--------- | third_party/googletest | 1 | ||||
l--------- | third_party/jinja2 | 1 | ||||
l--------- | third_party/llvm-build | 1 | ||||
l--------- | third_party/markupsafe | 1 | ||||
l--------- | third_party/package.json | 1 | ||||
l--------- | third_party/yarn.lock | 1 | ||||
-rwxr-xr-x | tools/build_third_party.py | 41 |
9 files changed, 41 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore index 306b0b7fc..f349cf0c2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,12 +4,5 @@ # npm deps node_modules -# git deps -/third_party/v8/ -/third_party/cpplint/ -/third_party/zlib/ -/third_party/rust_crates/libc/ -/third_party/flatbuffers/ - -# gclient files -/third_party/.gclient_entries +# third party deps +/third_party/ diff --git a/third_party/.gclient b/third_party/.gclient deleted file mode 120000 index 597d72036..000000000 --- a/third_party/.gclient +++ /dev/null @@ -1 +0,0 @@ -../gclient_config.py
\ No newline at end of file diff --git a/third_party/googletest b/third_party/googletest deleted file mode 120000 index c9ff314a1..000000000 --- a/third_party/googletest +++ /dev/null @@ -1 +0,0 @@ -v8/third_party/googletest
\ No newline at end of file diff --git a/third_party/jinja2 b/third_party/jinja2 deleted file mode 120000 index 2f1c1924c..000000000 --- a/third_party/jinja2 +++ /dev/null @@ -1 +0,0 @@ -v8/third_party/jinja2
\ No newline at end of file diff --git a/third_party/llvm-build b/third_party/llvm-build deleted file mode 120000 index 0b5b02b34..000000000 --- a/third_party/llvm-build +++ /dev/null @@ -1 +0,0 @@ -v8/third_party/llvm-build
\ No newline at end of file diff --git a/third_party/markupsafe b/third_party/markupsafe deleted file mode 120000 index c233a58a3..000000000 --- a/third_party/markupsafe +++ /dev/null @@ -1 +0,0 @@ -v8/third_party/markupsafe
\ No newline at end of file diff --git a/third_party/package.json b/third_party/package.json deleted file mode 120000 index 4e26811d4..000000000 --- a/third_party/package.json +++ /dev/null @@ -1 +0,0 @@ -../package.json
\ No newline at end of file diff --git a/third_party/yarn.lock b/third_party/yarn.lock deleted file mode 120000 index 1fe23b6e3..000000000 --- a/third_party/yarn.lock +++ /dev/null @@ -1 +0,0 @@ -../yarn.lock
\ No newline at end of file diff --git a/tools/build_third_party.py b/tools/build_third_party.py index 7457bb51b..e5c2885dc 100755 --- a/tools/build_third_party.py +++ b/tools/build_third_party.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# This script updates the third party dependencies of deno. +# 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. @@ -8,14 +8,26 @@ # Use //js/package.json to modify the npm deps. import os +from os.path import join import subprocess root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -third_party_path = os.path.join(root_path, "third_party") +third_party_path = join(root_path, "third_party") def main(): + try: + os.makedirs(third_party_path) + 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", "--no-history"]) run(["yarn"]) @@ -26,5 +38,30 @@ def run(args): subprocess.check_call(args, env=env) +def remove_and_symlink(target, name): + try: + os.unlink(name) + except: + pass + os.symlink(target, name) + + +def symlink(target, name, target_is_dir=False): + if os.name == "nt": + import ctypes + CreateSymbolicLinkW = ctypes.windll.kernel32.CreateSymbolicLinkW + CreateSymbolicLinkW.restype = ctypes.c_ubyte + CreateSymbolicLinkW.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, + ctypes.c_uint32) + + flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE + if (target_is_dir): + flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY + if not CreateSymbolicLinkW(name, target, flags): + raise ctypes.WinError() + else: + os.symlink(target, name) + + if '__main__' == __name__: main() |