1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

tools: generate third_party dir and symlinks from the script. (#346)

Everyone needs to run ./tools/build_third_party.py after this commit.
This commit is contained in:
Yoshiya Hinosawa 2018-07-08 15:18:14 +09:00 committed by Ryan Dahl
parent cf0c0668da
commit 6c79b471aa
9 changed files with 41 additions and 18 deletions

11
.gitignore vendored
View file

@ -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/

View file

@ -1 +0,0 @@
../gclient_config.py

View file

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

1
third_party/jinja2 vendored
View file

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

View file

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

View file

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

View file

@ -1 +0,0 @@
../package.json

View file

@ -1 +0,0 @@
../yarn.lock

View file

@ -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()