summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn120
-rw-r--r--libdeno/BUILD.gn98
-rw-r--r--libdeno/deno.gni (renamed from build_extra/deno.gni)2
-rwxr-xr-xtools/format.py3
4 files changed, 108 insertions, 115 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 060b024a1..c6b29306e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1,20 +1,20 @@
# Copyright 2018 the Deno authors. All rights reserved. MIT license.
import("//build/toolchain/cc_wrapper.gni")
-import("//third_party/v8/gni/v8.gni")
-import("//third_party/v8/snapshot_toolchain.gni")
import("//build_extra/flatbuffers/flatbuffer.gni")
import("//build_extra/flatbuffers/rust/rust_flatbuffer.gni")
-import("//build_extra/deno.gni")
import("//build_extra/rust/rust.gni")
import("//build_extra/toolchain/validate.gni")
+import("//third_party/v8/gni/v8.gni")
+import("//third_party/v8/snapshot_toolchain.gni")
+import("libdeno/deno.gni")
group("default") {
testonly = true
deps = [
":deno",
":hyper_hello",
- ":test_cc",
":test_rs",
+ "libdeno:test_cc",
]
}
@@ -25,31 +25,6 @@ group("cargo_check_deps") {
]
}
-config("deno_config") {
- include_dirs = [ "third_party/v8" ] # This allows us to v8/src/base/ libraries.
- configs = [ "third_party/v8:external_config" ]
- if (is_debug) {
- defines = [ "DEBUG" ]
- }
-
- # Targets built with the `rust_executable()` template automatically pick up
- # these dependencies, but those built with `executable()` need them when they
- # have Rust inputs. Currently, there's only one such target, `test_cc`.
- if (is_mac) {
- libs = [ "resolv" ]
- }
- if (is_win) {
- libs = [ "userenv.lib" ]
- }
-
- if (is_clang) {
- cflags = [
- "-fcolor-diagnostics",
- "-fansi-escape-codes",
- ]
- }
-}
-
main_extern = [
"$rust_build:atty",
"$rust_build:dirs",
@@ -149,7 +124,7 @@ source_set("snapshot") {
sources = [
"src/snapshot.cc",
]
- configs += [ ":deno_config" ]
+ configs += [ "libdeno:deno_config" ]
inputs = [
"$target_gen_dir/snapshot_deno.bin",
]
@@ -198,89 +173,14 @@ rust_test("test_rs") {
]
}
-v8_executable("test_cc") {
- testonly = true
- sources = [
- "libdeno/file_util_test.cc",
- "libdeno/libdeno_test.cc",
- "libdeno/test.cc",
- ]
- deps = [
- ":create_snapshot_libdeno_test",
- ":libdeno",
- "//testing/gtest:gtest",
- ]
- data = [
- "$target_gen_dir/snapshot_libdeno_test.bin",
- ]
- snapshot_path = rebase_path(data[0], root_build_dir)
- defines = [ "SNAPSHOT_PATH=\"$snapshot_path\"" ]
- configs = [ ":deno_config" ]
-}
-
-v8_static_library("v8") {
- public_deps = [
- "third_party/v8:v8",
- "third_party/v8:v8_libbase",
- "third_party/v8:v8_libplatform",
- "third_party/v8:v8_libsampler",
- "//build/win:default_exe_manifest",
- ]
- configs = [ ":deno_config" ]
-}
-
-# Only functionality needed for libdeno_test and snapshot_creator
-# In particular no flatbuffers, no assets, no rust, no msg handlers.
-# Because snapshots are slow, it's important that snapshot_creator's
-# dependencies are minimal.
-v8_static_library("libdeno") {
- configs = [ ":deno_config" ]
- sources = [
- "libdeno/api.cc",
- "libdeno/binding.cc",
- "libdeno/deno.h",
- "libdeno/file_util.cc",
- "libdeno/file_util.h",
- "libdeno/internal.h",
- ]
- if (!use_prebuilt_v8) {
- public_deps = [
- ":v8",
- ]
- } else {
- # TODO(ry) It would be nice to have a standalone target for the prebuilt
- # library that could simply be added to the deps here, but it wasn't
- # obvious how to accomplish that in gn.
- if (is_mac) {
- libs = [ "//prebuilt/mac/libv8.a" ]
- } else if (is_linux) {
- libs = [ "//prebuilt/linux64/libv8.a" ]
- } else if (is_win) {
- libs = [ "//prebuilt/win/v8.lib" ]
- } else {
- assert(false, "We don't have prebuilt binaries for this platform yet.")
- }
- }
-}
-
v8_static_library("deno_deps") {
complete_static_lib = true
public_deps = [
- ":libdeno",
":msg_rs",
":snapshot",
+ "libdeno:libdeno",
]
- configs = [ ":deno_config" ]
-}
-
-v8_executable("snapshot_creator") {
- sources = [
- "libdeno/snapshot_creator.cc",
- ]
- deps = [
- ":libdeno",
- ]
- configs = [ ":deno_config" ]
+ configs = [ "libdeno:deno_config" ]
}
# Generates the core TypeScript type library for deno that will be
@@ -380,9 +280,3 @@ create_snapshot("deno") {
":bundle",
]
}
-
-# Generates $target_gen_dir/snapshot_libdeno_test.bin
-create_snapshot("libdeno_test") {
- testonly = true
- js = "libdeno/libdeno_test.js"
-}
diff --git a/libdeno/BUILD.gn b/libdeno/BUILD.gn
new file mode 100644
index 000000000..5cd774eaa
--- /dev/null
+++ b/libdeno/BUILD.gn
@@ -0,0 +1,98 @@
+# Copyright 2018 the Deno authors. All rights reserved. MIT license.
+import("./deno.gni")
+import("//third_party/v8/gni/v8.gni")
+
+config("deno_config") {
+ include_dirs = [ "//third_party/v8" ] # This allows us to v8/src/base/ libraries.
+ configs = [ "//third_party/v8:external_config" ]
+ if (is_debug) {
+ defines = [ "DEBUG" ]
+ }
+ if (is_clang) {
+ cflags = [
+ "-fcolor-diagnostics",
+ "-fansi-escape-codes",
+ ]
+ }
+}
+
+v8_static_library("v8") {
+ public_deps = [
+ "//build/win:default_exe_manifest",
+ "//third_party/v8:v8",
+ "//third_party/v8:v8_libbase",
+ "//third_party/v8:v8_libplatform",
+ "//third_party/v8:v8_libsampler",
+ ]
+ configs = [ ":deno_config" ]
+}
+
+# Only functionality needed for libdeno_test and snapshot_creator
+# In particular no flatbuffers, no assets, no rust, no msg handlers.
+# Because snapshots are slow, it's important that snapshot_creator's
+# dependencies are minimal.
+v8_static_library("libdeno") {
+ configs = [ ":deno_config" ]
+ sources = [
+ "api.cc",
+ "binding.cc",
+ "deno.h",
+ "file_util.cc",
+ "file_util.h",
+ "internal.h",
+ ]
+ if (!use_prebuilt_v8) {
+ public_deps = [
+ ":v8",
+ ]
+ } else {
+ # TODO(ry) It would be nice to have a standalone target for the prebuilt
+ # library that could simply be added to the deps here, but it wasn't
+ # obvious how to accomplish that in gn.
+ if (is_mac) {
+ libs = [ "//prebuilt/mac/libv8.a" ]
+ } else if (is_linux) {
+ libs = [ "//prebuilt/linux64/libv8.a" ]
+ } else if (is_win) {
+ libs = [ "//prebuilt/win/v8.lib" ]
+ } else {
+ assert(false, "We don't have prebuilt binaries for this platform yet.")
+ }
+ }
+}
+
+v8_executable("snapshot_creator") {
+ sources = [
+ "snapshot_creator.cc",
+ ]
+ deps = [
+ ":libdeno",
+ ]
+ configs = [ ":deno_config" ]
+}
+
+v8_executable("test_cc") {
+ testonly = true
+ sources = [
+ "file_util_test.cc",
+ "libdeno_test.cc",
+ "test.cc",
+ ]
+ deps = [
+ ":create_snapshot_libdeno_test",
+ ":libdeno",
+ "//testing/gtest:gtest",
+ ]
+ data = [
+ "$target_gen_dir/snapshot_libdeno_test.bin",
+ ]
+ snapshot_path = rebase_path(data[0], root_build_dir)
+ defines = [ "SNAPSHOT_PATH=\"$snapshot_path\"" ]
+ configs = [ ":deno_config" ]
+}
+
+# Generates $target_gen_dir/snapshot_libdeno_test.bin
+create_snapshot("libdeno_test") {
+ testonly = true
+ js = "libdeno_test.js"
+}
diff --git a/build_extra/deno.gni b/libdeno/deno.gni
index 9e0d43cab..55662145f 100644
--- a/build_extra/deno.gni
+++ b/libdeno/deno.gni
@@ -31,7 +31,7 @@ template("create_snapshot") {
"testonly",
"deps",
])
- tool = ":snapshot_creator"
+ tool = "//libdeno:snapshot_creator"
visibility = [ ":*" ] # Only targets in this file can depend on this.
snapshot_out_bin = "$target_gen_dir/snapshot_$name.bin"
inputs = [
diff --git a/tools/format.py b/tools/format.py
index d1e8753d8..d0f2dbab4 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -26,7 +26,8 @@ qrun([clang_format_path, "-i", "-style", "Google"] +
find_exts(["libdeno"], [".cc", ".h"]))
print "gn format"
-for fn in ["BUILD.gn", ".gn"] + find_exts(["build_extra"], [".gn", ".gni"]):
+for fn in ["BUILD.gn", ".gn"] + find_exts(["build_extra", "libdeno"],
+ [".gn", ".gni"]):
qrun(["third_party/depot_tools/gn", "format", fn], env=google_env())
print "yapf"