diff --git a/.gitignore b/.gitignore index c15ce30e5b..15b975b8de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,9 @@ # build /out/ *.pyc - +gclient_config.py_entries # npm deps node_modules -# third party deps -/third_party/ - # RLS generated files -/target/ \ No newline at end of file +/target/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..82935121a8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party"] + path = third_party + url = https://github.com/ry/deno_third_party.git diff --git a/.travis.yml b/.travis.yml index f0aa43c6c6..4549b5bfdc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ branches: cache: ccache: true directories: - - third_party/node_modules/ - $DEPOT_TOOLS_PATH - $BUILD_PATH env: @@ -28,7 +27,10 @@ install: - curl -sSf https://sh.rustup.rs | sh -s -- -y - export PATH=$HOME/.cargo/bin:$PATH - rustc --version - - ./tools/build_third_party.py + # TODO(ry) Do not depend on run_hooks because it calls + # //third_party/depot_tools/download_from_google_storage.py + # Use git lfs and combine run_hooks with build_third_party? + - ./tools/run_hooks.py # ccache needs the custom LLVM to be in PATH and other variables. - export PATH=`pwd`/third_party/llvm-build/Release+Asserts/bin:$PATH - export CCACHE_CPP2=yes diff --git a/README.md b/README.md index 6c4af1de11..2363f5d7aa 100644 --- a/README.md +++ b/README.md @@ -56,41 +56,40 @@ Roadmap is [here](https://github.com/ry/deno/blob/master/Roadmap.md). Also see this presentation: http://tinyclouds.org/jsconf2018.pdf -### Github Noise - I am excited about all the interest in this project. However, do understand that this is very much a non-functional prototype. There's a huge amount of heavy lifting to do. Unless you are participating in that, please maintain radio silence on github. This includes submitting trivial PRs (like improving README build instructions). -## Compile instructions +## Build instructions -Get [Depot Tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) and make sure it's in your path. +To ensure reproducable builds, Deno has most of its dependencies in a git +submodule. However, you need +[rustc](https://www.rust-lang.org/en-US/install.html) installed separately. -You need [yarn](https://yarnpkg.com/lang/en/docs/install/) installed. +You probably want +[ccache](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/ccache) +installed too. -You need [rust](https://www.rust-lang.org/en-US/install.html) installed. +To build: -You might want [ccache](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/ccache) installed. + # Fetch deps. + git clone --recurse-submodules https://github.com/ry/deno.git + cd deno + ./tools/run_hooks.py -Fetch the third party dependencies. + # Configure + ./third_party/depot_tools/gn gen out/default + ./third_party/depot_tools/gn gen out/release --args='cc_wrapper="ccache" is_official_build=true' + ./third_party/depot_tools/gn gen out/debug --args='cc_wrapper="ccache" is_debug=true ' - ./tools/build_third_party.py - -Generate ninja files. - - gn gen out/Default - gn gen out/Release --args='cc_wrapper="ccache" is_official_build=true' - gn gen out/Debug --args='cc_wrapper="ccache" is_debug=true ' - -Then build with ninja (will take a while to complete): - - ninja -C out/Debug/ deno + # Build + ./third_party/depot_tools/ninja -C out/default/ deno Other useful commands: - gn args out/Debug/ --list - gn args out/Debug/ - gn desc out/Debug/ :deno - gn help + ./third_party/depot_tools/gn args out/default/ --list + ./third_party/depot_tools/gn args out/default/ + ./third_party/depot_tools/gn desc out/default/ :deno + ./third_party/depot_tools/gn help diff --git a/gclient_config.py b/gclient_config.py index 32bfcc425f..e20d7dce69 100644 --- a/gclient_config.py +++ b/gclient_config.py @@ -17,6 +17,11 @@ solutions = [{ 'v8/test/test262/harness': None, 'v8/tools/luci-go': None } +}, { + 'url': + 'https://chromium.googlesource.com/chromium/tools/depot_tools@40bacee96a94600ad2179d69a8025469d119960f', + 'name': + 'depot_tools' }, { 'url': 'https://chromium.googlesource.com/chromium/src/third_party/zlib@39b4a6260702da4c089eca57136abf40a39667e9', diff --git a/third_party b/third_party new file mode 160000 index 0000000000..2dde8457b0 --- /dev/null +++ b/third_party @@ -0,0 +1 @@ +Subproject commit 2dde8457b037a399f07106ccfc34382a80c469bb diff --git a/tools/build_third_party.py b/tools/build_third_party.py index e46c8ddd1f..474fcbfd22 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 0000000000..2ec671186d --- /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)