From 6830370c3e4f7d9f09c08fe76f8902193e027c1d Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sun, 1 Jul 2018 20:47:28 +0900 Subject: [PATCH] reorg: Move GN files to root (#309) refs: #285 --- src/.gclient => .gclient | 0 .gitignore | 14 +++++----- src/.gn => .gn | 0 .travis.yml | 3 +-- src/BUILD.gn => BUILD.gn | 50 ++++++++++++++++++------------------ README.md | 7 ++--- src/build => build | 0 build_overrides | 1 + src/buildtools => buildtools | 0 src/deno.gni => deno.gni | 4 +-- src/build_overrides | 1 - src/third_party/googletest | 1 - src/third_party/jinja2 | 1 - src/third_party/llvm-build | 1 - src/third_party/markupsafe | 1 - src/testing => testing | 0 third_party/googletest | 1 + third_party/jinja2 | 1 + third_party/llvm-build | 1 + third_party/markupsafe | 1 + {src/tools => tools}/clang | 0 tools/format.sh | 3 --- 22 files changed, 42 insertions(+), 49 deletions(-) rename src/.gclient => .gclient (100%) rename src/.gn => .gn (100%) rename src/BUILD.gn => BUILD.gn (81%) rename src/build => build (100%) create mode 120000 build_overrides rename src/buildtools => buildtools (100%) rename src/deno.gni => deno.gni (98%) delete mode 120000 src/build_overrides delete mode 120000 src/third_party/googletest delete mode 120000 src/third_party/jinja2 delete mode 120000 src/third_party/llvm-build delete mode 120000 src/third_party/markupsafe rename src/testing => testing (100%) create mode 120000 third_party/googletest create mode 120000 third_party/jinja2 create mode 120000 third_party/llvm-build create mode 120000 third_party/markupsafe rename {src/tools => tools}/clang (100%) diff --git a/src/.gclient b/.gclient similarity index 100% rename from src/.gclient rename to .gclient diff --git a/.gitignore b/.gitignore index 3d688b8720..3e495ea255 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/src/.gn b/.gn similarity index 100% rename from src/.gn rename to .gn diff --git a/.travis.yml b/.travis.yml index 662ed7a146..c73da8c94b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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, @@ -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 diff --git a/src/BUILD.gn b/BUILD.gn similarity index 81% rename from src/BUILD.gn rename to BUILD.gn index 09ce945bb0..fcc10b98d3 100644 --- a/src/BUILD.gn +++ b/BUILD.gn @@ -9,7 +9,7 @@ config("deno_config") { } rust_executable("deno") { - source_root = "main.rs" + source_root = "src/main.rs" rust_deps = [ ":libc" ] deps = [ ":libdeno", @@ -26,7 +26,7 @@ rust_library("libc") { executable("mock_main") { sources = [ - "mock_main.cc", + "src/mock_main.cc", ] deps = [ ":libdeno", @@ -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", @@ -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", @@ -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", @@ -80,7 +80,7 @@ v8_source_set("deno_nosnapshot") { executable("snapshot_creator") { sources = [ - "snapshot_creator.cc", + "src/snapshot_creator.cc", ] deps = [ ":deno_nosnapshot", @@ -90,7 +90,7 @@ executable("snapshot_creator") { proto_library("msg_proto") { sources = [ - "msg.proto", + "src/msg.proto", ] generate_python = false } @@ -98,10 +98,10 @@ proto_library("msg_proto") { 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", @@ -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, ] @@ -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", @@ -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 = [] } diff --git a/README.md b/README.md index 6dc1889b3d..25b001ceeb 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 ' diff --git a/src/build b/build similarity index 100% rename from src/build rename to build diff --git a/build_overrides b/build_overrides new file mode 120000 index 0000000000..f1aca1a07d --- /dev/null +++ b/build_overrides @@ -0,0 +1 @@ +v8/build_overrides \ No newline at end of file diff --git a/src/buildtools b/buildtools similarity index 100% rename from src/buildtools rename to buildtools diff --git a/src/deno.gni b/deno.gni similarity index 98% rename from src/deno.gni rename to deno.gni index 66deaa96cc..367a7f4506 100644 --- a/src/deno.gni +++ b/deno.gni @@ -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" } } @@ -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) { diff --git a/src/build_overrides b/src/build_overrides deleted file mode 120000 index 06eeb9d4cc..0000000000 --- a/src/build_overrides +++ /dev/null @@ -1 +0,0 @@ -v8/build_overrides/ \ No newline at end of file diff --git a/src/third_party/googletest b/src/third_party/googletest deleted file mode 120000 index 21e82410ce..0000000000 --- a/src/third_party/googletest +++ /dev/null @@ -1 +0,0 @@ -../v8/third_party/googletest/ \ No newline at end of file diff --git a/src/third_party/jinja2 b/src/third_party/jinja2 deleted file mode 120000 index 36528ba754..0000000000 --- a/src/third_party/jinja2 +++ /dev/null @@ -1 +0,0 @@ -../v8/third_party/jinja2/ \ No newline at end of file diff --git a/src/third_party/llvm-build b/src/third_party/llvm-build deleted file mode 120000 index 7aebd33827..0000000000 --- a/src/third_party/llvm-build +++ /dev/null @@ -1 +0,0 @@ -../v8/third_party/llvm-build/ \ No newline at end of file diff --git a/src/third_party/markupsafe b/src/third_party/markupsafe deleted file mode 120000 index b0960604b0..0000000000 --- a/src/third_party/markupsafe +++ /dev/null @@ -1 +0,0 @@ -../v8/third_party/markupsafe/ \ No newline at end of file diff --git a/src/testing b/testing similarity index 100% rename from src/testing rename to testing diff --git a/third_party/googletest b/third_party/googletest new file mode 120000 index 0000000000..80cee42e34 --- /dev/null +++ b/third_party/googletest @@ -0,0 +1 @@ +../v8/third_party/googletest \ No newline at end of file diff --git a/third_party/jinja2 b/third_party/jinja2 new file mode 120000 index 0000000000..268588bb99 --- /dev/null +++ b/third_party/jinja2 @@ -0,0 +1 @@ +../v8/third_party/jinja2 \ No newline at end of file diff --git a/third_party/llvm-build b/third_party/llvm-build new file mode 120000 index 0000000000..d023bbec2b --- /dev/null +++ b/third_party/llvm-build @@ -0,0 +1 @@ +../v8/third_party/llvm-build \ No newline at end of file diff --git a/third_party/markupsafe b/third_party/markupsafe new file mode 120000 index 0000000000..8e9e53c9e9 --- /dev/null +++ b/third_party/markupsafe @@ -0,0 +1 @@ +../v8/third_party/markupsafe \ No newline at end of file diff --git a/src/tools/clang b/tools/clang similarity index 100% rename from src/tools/clang rename to tools/clang diff --git a/tools/format.sh b/tools/format.sh index 0a5967c52d..40531748e7 100755 --- a/tools/format.sh +++ b/tools/format.sh @@ -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 \