mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
1ac2934604
So we can float patches before sending them upstream. https://github.com/denoland/chromium_build Remove build_extra/toolchain
281 lines
6.2 KiB
Text
281 lines
6.2 KiB
Text
# Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
|
import("//build/toolchain/cc_wrapper.gni")
|
|
import("//build_extra/flatbuffers/flatbuffer.gni")
|
|
import("//build_extra/flatbuffers/rust/rust_flatbuffer.gni")
|
|
import("//build_extra/rust/rust.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_rs",
|
|
"libdeno:test_cc",
|
|
]
|
|
}
|
|
|
|
# Set of targets that need to be built for `cargo check` to succeed.
|
|
group("cargo_check_deps") {
|
|
deps = [
|
|
":msg_rs",
|
|
]
|
|
}
|
|
|
|
main_extern = [
|
|
"$rust_build:atty",
|
|
"$rust_build:dirs",
|
|
"$rust_build:futures",
|
|
"$rust_build:getopts",
|
|
"$rust_build:http",
|
|
"$rust_build:hyper",
|
|
"$rust_build:hyper_rustls",
|
|
"$rust_build:lazy_static",
|
|
"$rust_build:libc",
|
|
"$rust_build:log",
|
|
"$rust_build:rand",
|
|
"$rust_build:remove_dir_all",
|
|
"$rust_build:ring",
|
|
"$rust_build:rustyline",
|
|
"$rust_build:tempfile",
|
|
"$rust_build:tokio",
|
|
"$rust_build:tokio_executor",
|
|
"$rust_build:tokio_fs",
|
|
"$rust_build:tokio_io",
|
|
"$rust_build:tokio_process",
|
|
"$rust_build:tokio_threadpool",
|
|
"$rust_build:url",
|
|
"//build_extra/flatbuffers/rust:flatbuffers",
|
|
]
|
|
|
|
ts_sources = [
|
|
"js/assets.ts",
|
|
"js/blob.ts",
|
|
"js/buffer.ts",
|
|
"js/chmod.ts",
|
|
"js/compiler.ts",
|
|
"js/console.ts",
|
|
"js/copy_file.ts",
|
|
"js/deno.ts",
|
|
"js/dir.ts",
|
|
"js/dispatch.ts",
|
|
"js/dom_types.ts",
|
|
"js/errors.ts",
|
|
"js/fetch.ts",
|
|
"js/file.ts",
|
|
"js/file_info.ts",
|
|
"js/files.ts",
|
|
"js/flatbuffers.ts",
|
|
"js/form_data.ts",
|
|
"js/global_eval.ts",
|
|
"js/globals.ts",
|
|
"js/headers.ts",
|
|
"js/io.ts",
|
|
"js/libdeno.ts",
|
|
"js/main.ts",
|
|
"js/make_temp_dir.ts",
|
|
"js/metrics.ts",
|
|
"js/mkdir.ts",
|
|
"js/mock_builtin.js",
|
|
"js/net.ts",
|
|
"js/os.ts",
|
|
"js/platform.ts",
|
|
"js/plugins.d.ts",
|
|
"js/process.ts",
|
|
"js/promise_util.ts",
|
|
"js/read_dir.ts",
|
|
"js/read_file.ts",
|
|
"js/read_link.ts",
|
|
"js/remove.ts",
|
|
"js/rename.ts",
|
|
"js/repl.ts",
|
|
"js/resources.ts",
|
|
"js/runner.ts",
|
|
"js/stat.ts",
|
|
"js/symlink.ts",
|
|
"js/text_encoding.ts",
|
|
"js/timers.ts",
|
|
"js/truncate.ts",
|
|
"js/types.ts",
|
|
"js/url_search_params.ts",
|
|
"js/util.ts",
|
|
"js/v8_source_maps.ts",
|
|
"js/write_file.ts",
|
|
"tsconfig.json",
|
|
|
|
# Listing package.json and yarn.lock as sources ensures the bundle is rebuilt
|
|
# when npm packages are added/removed or their contents changes.
|
|
"package.json",
|
|
"third_party/yarn.lock",
|
|
]
|
|
|
|
rust_executable("deno") {
|
|
source_root = "src/main.rs"
|
|
extern = main_extern
|
|
deps = [
|
|
":deno_deps",
|
|
]
|
|
}
|
|
|
|
source_set("snapshot") {
|
|
sources = [
|
|
"src/snapshot.cc",
|
|
]
|
|
configs += [ "libdeno: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") {
|
|
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 = [
|
|
":deno_deps",
|
|
]
|
|
}
|
|
|
|
v8_static_library("deno_deps") {
|
|
complete_static_lib = true
|
|
public_deps = [
|
|
":msg_rs",
|
|
":snapshot",
|
|
"libdeno:libdeno",
|
|
]
|
|
configs = [ "libdeno:deno_config" ]
|
|
}
|
|
|
|
# Generates the core TypeScript type library for deno that will be
|
|
# included in the runtime bundle
|
|
run_node("deno_runtime_declaration") {
|
|
out_dir = target_gen_dir
|
|
sources = ts_sources
|
|
outputs = [
|
|
"$out_dir/lib/lib.deno_runtime.d.ts",
|
|
]
|
|
deps = [
|
|
":msg_ts",
|
|
]
|
|
args = [
|
|
rebase_path("node_modules/ts-node/dist/bin.js", root_build_dir),
|
|
"--project",
|
|
rebase_path("tools/ts_library_builder/tsconfig.json"),
|
|
rebase_path("tools/ts_library_builder/main.ts", root_build_dir),
|
|
"--basePath",
|
|
rebase_path(".", root_build_dir),
|
|
"--buildPath",
|
|
rebase_path(root_build_dir, root_build_dir),
|
|
"--outFile",
|
|
rebase_path("$out_dir/lib/lib.deno_runtime.d.ts", root_build_dir),
|
|
"--silent",
|
|
]
|
|
if (is_debug) {
|
|
args += [ "--debug" ]
|
|
}
|
|
}
|
|
|
|
run_node("bundle") {
|
|
out_dir = "$target_gen_dir/bundle/"
|
|
outputs = [
|
|
out_dir + "main.js",
|
|
out_dir + "main.js.map",
|
|
]
|
|
depfile = out_dir + "main.d"
|
|
deps = [
|
|
":deno_runtime_declaration",
|
|
":msg_ts",
|
|
]
|
|
args = [
|
|
rebase_path("third_party/node_modules/rollup/bin/rollup", root_build_dir),
|
|
"-c",
|
|
rebase_path("rollup.config.js", root_build_dir),
|
|
"-i",
|
|
rebase_path("js/main.ts", root_build_dir),
|
|
"-o",
|
|
rebase_path(out_dir + "main.js", root_build_dir),
|
|
"--sourcemapFile",
|
|
rebase_path("."),
|
|
"--silent",
|
|
]
|
|
}
|
|
|
|
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",
|
|
]
|
|
}
|
|
|
|
rust_flatbuffer("msg_rs") {
|
|
sources = [
|
|
"src/msg.fbs",
|
|
]
|
|
}
|
|
|
|
# Generates $target_gen_dir/snapshot_deno.bin
|
|
create_snapshot("deno") {
|
|
js = "$target_gen_dir/bundle/main.js"
|
|
source_map = "$target_gen_dir/bundle/main.js.map"
|
|
deps = [
|
|
":bundle",
|
|
]
|
|
}
|