Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix_url
Browse files Browse the repository at this point in the history
  • Loading branch information
ztplz committed Oct 25, 2018
2 parents 1eec5ac + 2cfa608 commit 7b09eb6
Show file tree
Hide file tree
Showing 30 changed files with 716 additions and 622 deletions.
6 changes: 5 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ after_test:
Select-String $trap -Path $files -SimpleMatch | where {
# V8 took the liberty to produce an absolute path in their ninja
# output. We can't do much about that, so we just ignore it.
$_.Line -notmatch "v8/builtins-generated/bytecodes-builtins-list.h"
$_.Line -notmatch "v8/builtins-generated/bytecodes-builtins-list.h" -and
# The absolute path to snapshot_libdeno_test.bin is passed to test_cc
# via pre-processor variable. It's absolute because we want to be able
# to execute test_cc from both the project root and the build root.
$_.Line -notmatch "snapshot_libdeno_test.bin"
} | tee -Variable line_matches
if ($line_matches) {
$ctx = $line_matches.Line |
Expand Down
145 changes: 51 additions & 94 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ group("default") {
testonly = true
deps = [
":deno",
":deno_ns",
":hyper_hello",
":test_cc",
":test_rs",
Expand Down Expand Up @@ -125,64 +124,26 @@ rust_executable("deno") {
extern = main_extern
deps = [
":libdeno",
":snapshot",
]
}

# This target is for fast incremental development.
# When modifying the javascript runtime, this target will not go through the
# extra process of building a snapshot and instead load the bundle from disk.
# ns = no snapshot
rust_executable("deno_ns") {
source_root = "src/main.rs"
extern = main_extern
deps = [
":libdeno_nosnapshot",
]
}

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.
Expand All @@ -191,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) ]
Expand All @@ -204,56 +167,69 @@ 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",
]
inputs = [
"$target_gen_dir/snapshot_libdeno_test.bin",
"libdeno/test.cc",
]
deps = [
":create_snapshot_libdeno_test",
":deno_base",
":libdeno",
"//testing/gtest:gtest",
]
defines = [ "LIBDENO_TEST" ]
data = [
"$target_gen_dir/snapshot_libdeno_test.bin",
]
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/api.cc",
"libdeno/binding.cc",
"libdeno/deno.h",
"libdeno/file_util.cc",
"libdeno/file_util.h",
"libdeno/internal.h",
]
configs = [ ":deno_config" ]
public_deps = [
"third_party/v8:v8_monolith",
]
configs += [ ":deno_config" ]
}

executable("snapshot_creator") {
sources = [
"libdeno/snapshot_creator.cc",
]
deps = [
":deno_base",
":libdeno",
]
configs += [ ":deno_config" ]
}
Expand Down Expand Up @@ -335,25 +311,6 @@ action("bundle_hash_h") {
}
}

source_set("libdeno_nosnapshot") {
bundle_outputs = get_target_outputs(":bundle")
bundle_location = rebase_path(bundle_outputs[0], root_build_dir)
bundle_map_location = rebase_path(bundle_outputs[1], root_build_dir)
inputs = bundle_outputs
sources = [
"libdeno/from_filesystem.cc",
]
deps = [
":bundle",
":deno_bindings",
]
configs += [ ":deno_config" ]
defines = [
"BUNDLE_LOCATION=\"$bundle_location\"",
"BUNDLE_MAP_LOCATION=\"$bundle_map_location\"",
]
}

ts_flatbuffer("msg_ts") {
sources = [
"src/msg.fbs",
Expand Down
1 change: 1 addition & 0 deletions js/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export class DenoCompiler
// arguments
private readonly _options: Readonly<ts.CompilerOptions> = {
allowJs: true,
checkJs: true,
module: ts.ModuleKind.AMD,
outDir: "$deno$",
// TODO https://github.com/denoland/deno/issues/23
Expand Down
2 changes: 2 additions & 0 deletions js/libdeno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface Libdeno {

print(x: string, isErr?: boolean): void;

shared: ArrayBuffer;

setGlobalErrorHandler: (
handler: (
message: string,
Expand Down
Loading

0 comments on commit 7b09eb6

Please sign in to comment.