1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-10 08:09:06 -05:00

build: work around sccache false positives due to asm .incbin usage

This commit is contained in:
Bert Belder 2018-08-29 08:42:30 +02:00
parent 542eb54254
commit 4cadf6e609
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461

View file

@ -1,4 +1,5 @@
# Copyright 2018 the Deno authors. All rights reserved. MIT license. # 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/gni/v8.gni")
import("//third_party/v8/snapshot_toolchain.gni") import("//third_party/v8/snapshot_toolchain.gni")
import("//build_extra/flatbuffers/flatbuffer.gni") import("//build_extra/flatbuffers/flatbuffer.gni")
@ -102,6 +103,27 @@ static_library("libdeno") {
":deno_bindings", ":deno_bindings",
] ]
configs += [ ":deno_config" ] configs += [ ":deno_config" ]
# from_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),
]
}
}
} }
# Only functionality needed for libdeno_test and snapshot_creator # Only functionality needed for libdeno_test and snapshot_creator
@ -241,6 +263,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),
]
}
}
source_set("libdeno_nosnapshot") { source_set("libdeno_nosnapshot") {
bundle_outputs = get_target_outputs(":bundle") bundle_outputs = get_target_outputs(":bundle")
bundle_location = rebase_path(bundle_outputs[0], root_build_dir) bundle_location = rebase_path(bundle_outputs[0], root_build_dir)