summaryrefslogtreecommitdiff
path: root/BUILD.gn
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-10-23 19:39:31 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-10-24 14:52:38 -0700
commitfd68f85ce8cfbb036f0bc2c532f423d8ffa78289 (patch)
treedc6ed9f2fad00efdd5ae5468b4abf3631d54bd24 /BUILD.gn
parent3438dbe3509da8e8674dd803e8ecdc92e30f7d61 (diff)
libdeno: deno_new should take a snapshot parameter.
Diffstat (limited to 'BUILD.gn')
-rw-r--r--BUILD.gn106
1 files changed, 47 insertions, 59 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 5dd7d3ca4..e4ce1c9b5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -124,52 +124,26 @@ rust_executable("deno") {
extern = main_extern
deps = [
":libdeno",
+ ":snapshot",
]
}
-rust_executable("hyper_hello") {
- source_root = "tools/hyper_hello.rs"
- extern = [
- "$rust_build:hyper",
- "$rust_build:ring",
- ]
-}
-
-rust_test("test_rs") {
- source_root = "src/main.rs"
- extern = main_extern
- deps = [
- ":libdeno",
- ]
-}
-
-v8_executable("test_cc") {
- testonly = true
- sources = [
- "libdeno/test.cc",
- ]
- deps = [
- ":deno_base_test",
- "//testing/gtest:gtest",
- ]
- configs = [ ":deno_config" ]
-}
-
-static_library("libdeno") {
- complete_static_lib = true
+source_set("snapshot") {
sources = [
- "libdeno/from_snapshot.cc",
+ "src/snapshot.cc",
]
- inputs = [
+ configs += [ ":deno_config" ]
+ data = [
"$target_gen_dir/snapshot_deno.bin",
]
deps = [
":create_snapshot_deno",
- ":deno_bindings",
]
- configs += [ ":deno_config" ]
- # from_snapshot.cc uses an assembly '.incbin' directive to embed the snapshot.
+ # snapshot.cc doesn't need to depend on libdeno, it just needs deno_buf.
+ include_dirs = [ "libdeno/" ]
+
+ # src/snapshot.cc uses an assembly '.incbin' directive to embed the snapshot.
# This causes trouble when using sccache: since the snapshot file is not
# inlined by the c preprocessor, sccache doesn't take its contents into
# consideration, leading to false-positive cache hits.
@@ -178,7 +152,9 @@ static_library("libdeno") {
# header file that contains the the sha256 hash of the snapshot.
if (cc_wrapper != "" && cc_wrapper != "ccache") {
hash_h = "$target_gen_dir/bundle/hash.h"
- inputs += [ hash_h ]
+ inputs = [
+ hash_h,
+ ]
deps += [ ":bundle_hash_h" ]
if (is_win) {
cflags = [ "/FI" + rebase_path(hash_h, target_out_dir) ]
@@ -191,49 +167,61 @@ static_library("libdeno") {
}
}
-# 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_source_set("deno_base") {
- sources = [
- "libdeno/binding.cc",
- "libdeno/deno.h",
- "libdeno/file_util.cc",
- "libdeno/file_util.h",
- "libdeno/internal.h",
+rust_executable("hyper_hello") {
+ source_root = "tools/hyper_hello.rs"
+ extern = [
+ "$rust_build:hyper",
+ "$rust_build:ring",
]
- public_deps = [
- "third_party/v8:v8_monolith",
+}
+
+rust_test("test_rs") {
+ source_root = "src/main.rs"
+ extern = main_extern
+ deps = [
+ ":libdeno",
+ ":snapshot",
]
- configs = [ ":deno_config" ]
}
-v8_source_set("deno_base_test") {
+v8_executable("test_cc") {
testonly = true
sources = [
"libdeno/file_util_test.cc",
- "libdeno/from_snapshot.cc",
"libdeno/libdeno_test.cc",
"libdeno/test.cc",
]
deps = [
":create_snapshot_libdeno_test",
- ":deno_base",
+ ":libdeno",
"//testing/gtest:gtest",
]
data = [
"$target_gen_dir/snapshot_libdeno_test.bin",
]
- defines = [ "LIBDENO_TEST" ]
+ snapshot_abs_path = rebase_path(data[0])
+ defines = [ "SNAPSHOT_PATH=\"$snapshot_abs_path\"" ]
configs = [ ":deno_config" ]
}
-v8_source_set("deno_bindings") {
- deps = [
- ":deno_base",
+# 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.
+static_library("libdeno") {
+ complete_static_lib = true
+ sources = [
+ "libdeno/binding.cc",
+ "libdeno/deno.h",
+ "libdeno/file_util.cc",
+ "libdeno/file_util.h",
+ "libdeno/internal.h",
+ "libdeno/new.cc",
]
- configs = [ ":deno_config" ]
+ public_deps = [
+ "third_party/v8:v8_monolith",
+ ]
+ configs += [ ":deno_config" ]
}
executable("snapshot_creator") {
@@ -241,7 +229,7 @@ executable("snapshot_creator") {
"libdeno/snapshot_creator.cc",
]
deps = [
- ":deno_base",
+ ":libdeno",
]
configs += [ ":deno_config" ]
}