summaryrefslogtreecommitdiff
path: root/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'BUILD.gn')
-rw-r--r--BUILD.gn51
1 files changed, 51 insertions, 0 deletions
diff --git a/BUILD.gn b/BUILD.gn
index d35ded317..064f8d146 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -146,12 +146,40 @@ rust_executable("deno") {
}
source_set("snapshot") {
+ sources = [
+ "src/snapshot.cc",
+ ]
+ configs += [ ":deno_config" ]
inputs = [
"$target_gen_dir/snapshot_deno.bin",
]
deps = [
":create_snapshot_deno",
]
+
+ # 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.
+ # Maybe other caching tools have this issue too, but ccache is unaffected.
+ # Therefore, if a cc_wrapper is used that isn't ccache, include a generated
+ # 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 ]
+ deps += [ ":bundle_hash_h" ]
+ if (is_win) {
+ cflags = [ "/FI" + rebase_path(hash_h, target_out_dir) ]
+ } else {
+ cflags = [
+ "-include",
+ rebase_path(hash_h, target_out_dir),
+ ]
+ }
+ }
}
rust_executable("hyper_hello") {
@@ -283,6 +311,29 @@ run_node("bundle") {
]
}
+action("bundle_hash_h") {
+ script = "//tools/sha256sum.py"
+ inputs = get_target_outputs(":bundle")
+ outputs = [
+ "$target_gen_dir/bundle/hash.h",
+ ]
+ deps = [
+ ":bundle",
+ ]
+ args = [
+ "--format",
+ "__attribute__((__unused__)) static const int dummy_%s = 0;",
+ "--outfile",
+ rebase_path(outputs[0], root_build_dir),
+ ]
+ foreach(input, inputs) {
+ args += [
+ "--infile",
+ rebase_path(input, root_build_dir),
+ ]
+ }
+}
+
ts_flatbuffer("msg_ts") {
sources = [
"src/msg.fbs",