Skip to content

Commit

Permalink
reorg: Move GN files to root (denoland#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k authored and ry committed Jul 1, 2018
1 parent f65d5fb commit 6830370
Show file tree
Hide file tree
Showing 22 changed files with 42 additions and 49 deletions.
File renamed without changes.
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/src/out/
/out/
node_modules
/src/v8/
/src/tools/protoc_wrapper/
/src/third_party/protobuf/
/src/third_party/zlib/
/src/third_party/rust_crates/libc/
/src/.gclient_entries
/v8/
/tools/protoc_wrapper/
/third_party/protobuf/
/third_party/zlib/
/third_party/rust_crates/libc/
/.gclient_entries
File renamed without changes.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ before_install: |
fi
install:
- export PATH=$PATH:$DEPOT_TOOLS_PATH
- cd src
# Sync dependencies.
# TODO(ry) These sync steps are very terrible and only here temporarily.
# A single deno_deps git submodule should be created which contains V8,
Expand All @@ -29,7 +28,7 @@ install:
- curl -sSf https://sh.rustup.rs | sh -s -- -y
- export PATH=$HOME/.cargo/bin:$PATH
- rustc --version
- (cd js; yarn)
- (cd src/js; yarn)
- gclient sync -j2 --no-history
# ccache needs the custom LLVM to be in PATH and other variables.
- export PATH=`pwd`/third_party/llvm-build/Release+Asserts/bin:$PATH
Expand Down
50 changes: 25 additions & 25 deletions src/BUILD.gn → BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ config("deno_config") {
}

rust_executable("deno") {
source_root = "main.rs"
source_root = "src/main.rs"
rust_deps = [ ":libc" ]
deps = [
":libdeno",
Expand All @@ -26,7 +26,7 @@ rust_library("libc") {

executable("mock_main") {
sources = [
"mock_main.cc",
"src/mock_main.cc",
]
deps = [
":libdeno",
Expand All @@ -39,9 +39,9 @@ executable("mock_main") {
executable("mock_runtime_test") {
testonly = true
sources = [
"file_util_test.cc",
"from_snapshot.cc",
"mock_runtime_test.cc",
"src/file_util_test.cc",
"src/from_snapshot.cc",
"src/mock_runtime_test.cc",
]
deps = [
":create_snapshot_mock_runtime",
Expand All @@ -55,7 +55,7 @@ executable("mock_runtime_test") {
static_library("libdeno") {
complete_static_lib = true
sources = [
"from_snapshot.cc",
"src/from_snapshot.cc",
]
deps = [
":create_snapshot_deno",
Expand All @@ -66,11 +66,11 @@ static_library("libdeno") {

v8_source_set("deno_nosnapshot") {
sources = [
"deno.cc",
"deno_internal.h",
"file_util.cc",
"file_util.h",
"include/deno.h",
"src/deno.cc",
"src/deno_internal.h",
"src/file_util.cc",
"src/file_util.h",
"src/include/deno.h",
]
deps = [
"v8:v8_monolith",
Expand All @@ -80,7 +80,7 @@ v8_source_set("deno_nosnapshot") {

executable("snapshot_creator") {
sources = [
"snapshot_creator.cc",
"src/snapshot_creator.cc",
]
deps = [
":deno_nosnapshot",
Expand All @@ -90,18 +90,18 @@ executable("snapshot_creator") {

proto_library("msg_proto") {
sources = [
"msg.proto",
"src/msg.proto",
]
generate_python = false
}

run_node("bundle") {
out_dir = "$target_gen_dir/bundle/"
sources = [
"js/main.ts",
"js/msg.pb.d.ts",
"js/msg.pb.js",
"js/package.json", # The `browserslist` field controls Babel behavior.
"src/js/main.ts",
"src/js/msg.pb.d.ts",
"src/js/msg.pb.js",
"src/js/package.json", # The `browserslist` field controls Babel behavior.
]
outputs = [
out_dir + "main.js",
Expand All @@ -116,19 +116,19 @@ run_node("bundle") {
"--no-minify",
"--out-dir",
rebase_path(out_dir, root_build_dir),
rebase_path("js/main.ts", root_build_dir),
rebase_path("src/js/main.ts", root_build_dir),
]
}

# Due to bugs in Parcel we must run TSC independently in order to catch errors.
# https://github.com/parcel-bundler/parcel/issues/954
run_node("run_tsc") {
main = "js/main.ts"
tsconfig = "js/tsconfig.json"
main = "src/js/main.ts"
tsconfig = "src/js/tsconfig.json"
out_dir = "$target_gen_dir/tsc_dist/"
sources = [
"js/msg.pb.d.ts",
"js/msg.pb.js",
"src/js/msg.pb.d.ts",
"src/js/msg.pb.js",
main,
tsconfig,
]
Expand Down Expand Up @@ -156,9 +156,9 @@ run_node("run_tsc") {
# be removed at some point. If msg.proto is changed, commit changes to the
# generated JS files. The stamp file is just to make gn work.
action("protobufjs") {
script = "js/pbjs_hack.py"
script = "src/js/pbjs_hack.py"
sources = [
"msg.proto",
"src/msg.proto",
]
outputs = [
"$target_gen_dir/pbjs_hack.stamp",
Expand All @@ -180,6 +180,6 @@ create_snapshot("deno") {
# Generates $target_gen_dir/snapshot_mock_runtime.cc
create_snapshot("mock_runtime") {
testonly = true
js = "js/mock_runtime.js"
js = "src/js/mock_runtime.js"
deps = []
}
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ You need [yarn](https://yarnpkg.com/lang/en/docs/install/) installed.

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

Go to `src/` folder:
``` bash
cd src/
```
You need [ccache](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/ccache) installed.

Fetch packages and v8:
``` bash
Expand All @@ -83,7 +80,7 @@ gclient sync --no-history

Install the javascript deps.

(cd js; yarn install)
(cd src/js; yarn install)

gn gen out/Debug --args='cc_wrapper="ccache" is_debug=true '

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions build_overrides
File renamed without changes.
4 changes: 2 additions & 2 deletions src/deno.gni → deno.gni
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
template("run_node") {
action(target_name) {
forward_variables_from(invoker, "*")
script = "js/run_node.py"
script = "src/js/run_node.py"
}
}

Expand Down Expand Up @@ -151,7 +151,7 @@ template("rust_executable") {
stdlib_target = target_name + "_stdlib"
rust_crate(stdlib_target) {
crate_type = "staticlib"
source_root = "empty.rs"
source_root = "src/empty.rs"
}

executable(target_name) {
Expand Down
1 change: 0 additions & 1 deletion src/build_overrides

This file was deleted.

1 change: 0 additions & 1 deletion src/third_party/googletest

This file was deleted.

1 change: 0 additions & 1 deletion src/third_party/jinja2

This file was deleted.

1 change: 0 additions & 1 deletion src/third_party/llvm-build

This file was deleted.

1 change: 0 additions & 1 deletion src/third_party/markupsafe

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions third_party/googletest
1 change: 1 addition & 0 deletions third_party/jinja2
1 change: 1 addition & 0 deletions third_party/llvm-build
1 change: 1 addition & 0 deletions third_party/markupsafe
File renamed without changes.
3 changes: 0 additions & 3 deletions tools/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ set -e
cd `dirname "$0"`/..
clang-format -i -style Google src/*.cc src/*.h src/include/*.h

# TODO(ry) Remove pushd/popd once .gn is moved to root.
pushd src/
gn format BUILD.gn
gn format deno.gni
gn format .gn
popd

yapf -i src/js/*.py
prettier --write \
Expand Down

0 comments on commit 6830370

Please sign in to comment.