Skip to content

Commit

Permalink
Add deno_third_party as git submodule.
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jul 21, 2018
1 parent 3563638 commit 5d1cb54
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 47 deletions.
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# build
/out/
*.pyc

gclient_config.py_entries
# npm deps
node_modules

# third party deps
/third_party/

# RLS generated files
/target/
/target/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third_party"]
path = third_party
url = https://github.com/ry/deno_third_party.git
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ branches:
cache:
ccache: true
directories:
- third_party/node_modules/
- $DEPOT_TOOLS_PATH
- $BUILD_PATH
env:
Expand All @@ -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
Expand Down
45 changes: 22 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,41 +56,40 @@ Roadmap is [here](https://github.com/ry/deno/blob/master/Roadmap.md).

Also see this presentation: http:https://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

Get [Depot Tools](http:https://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.

You need [yarn](https://yarnpkg.com/lang/en/docs/install/) installed.

You need [rust](https://www.rust-lang.org/en-US/install.html) installed.

You might want [ccache](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/ccache) installed.
## Build instructions

Fetch the third party dependencies.
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.

./tools/build_third_party.py
You probably want
[ccache](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/ccache)
installed too.

Generate ninja files.
To build:

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 '
# Fetch deps.
git clone --recurse-submodules https://github.com/ry/deno.git
cd deno
./tools/run_hooks.py

Then build with ninja (will take a while to complete):
# 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 '

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

5 changes: 5 additions & 0 deletions gclient_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
'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',
Expand Down
1 change: 1 addition & 0 deletions third_party
Submodule third_party added at 2dde84
36 changes: 19 additions & 17 deletions tools/build_third_party.py
Original file line number Diff line number Diff line change
@@ -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:https://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__)))
Expand All @@ -20,14 +13,23 @@
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 "%"
29 changes: 29 additions & 0 deletions tools/run_hooks.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 5d1cb54

Please sign in to comment.