mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 16:19:12 -05:00
Move //libdeno to //core/libdeno (#2015)
Fixes some sed errors introduced in c43cfe. Unfortunately moving libdeno required splitting build.rs into two parts, one for cli and one for core. I've also removed the arm64 build - it's complicating things at this re-org and we're not even testing it. I need to swing back to it and get tools/test.py running for it.
This commit is contained in:
parent
ad3cbc50fb
commit
c9614d86c1
74 changed files with 604 additions and 602 deletions
|
@ -212,15 +212,15 @@ after_test:
|
|||
}
|
||||
|
||||
# Verify that javascript and typescript files which are bundled by rollup are
|
||||
# listed explicitly in BUILD.gn. This is not an air-tight check.
|
||||
# listed explicitly in cli\BUILD.gn. This is not an air-tight check.
|
||||
# TODO: make rollup or another bundler write a depfile.
|
||||
- ps: |-
|
||||
$ignore = "test_util.ts", "unit_tests.ts", "*_test.ts"
|
||||
Get-ChildItem "js" -File -Force -Name |
|
||||
where { $name = $_; -not ($ignore | where { $name -like $_ }) } |
|
||||
where { -not (Select-String -Pattern $_ -Path BUILD.gn `
|
||||
where { -not (Select-String -Pattern $_ -Path cli\BUILD.gn `
|
||||
-SimpleMatch -CaseSensitive) } |
|
||||
foreach { throw "$_ should be listed in BUILD.gn but isn't." }
|
||||
foreach { throw "$_ should be listed in cli\BUILD.gn but isn't." }
|
||||
|
||||
# Verify that generated ninja files do not use absolute path names.
|
||||
# If they do, it makes ccache/sccache much less effective.
|
||||
|
|
24
.travis.yml
24
.travis.yml
|
@ -109,30 +109,6 @@ jobs:
|
|||
branch: master
|
||||
repo: denoland/deno
|
||||
skip-cleanup: true
|
||||
|
||||
- name: "cargo release linux arm64"
|
||||
os: linux
|
||||
dist: xenial
|
||||
script:
|
||||
- ./tools/lint.py
|
||||
- ./tools/test_format.py
|
||||
- rustup target add aarch64-unknown-linux-gnu
|
||||
- sudo apt update
|
||||
- |-
|
||||
sudo apt -yq --no-install-suggests --no-install-recommends install \
|
||||
g++-5-aarch64-linux-gnu gcc-5-aarch64-linux-gnu g++-5-multilib \
|
||||
libc6-arm64-cross
|
||||
- build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
|
||||
- export DENO_BUILD_ARGS="target_cpu=\"arm64\" v8_target_cpu=\"arm64\""
|
||||
- export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="/usr/bin/aarch64-linux-gnu-gcc-5"
|
||||
- export CC_aarch64_unknown_linux_gnu="/usr/bin/aarch64-linux-gnu-gcc-5"
|
||||
- cargo build -vv --target=aarch64-unknown-linux-gnu --release --locked
|
||||
- cargo build -vv --target=aarch64-unknown-linux-gnu --release --tests --locked
|
||||
- sudo apt -yq install qemu qemu-user binfmt-support qemu-user-binfmt
|
||||
- sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1
|
||||
- export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu
|
||||
#- $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/deno tests/002_hello.ts
|
||||
# - DENO_BUILD_MODE=release ./tools/test.py $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release TODO(afinch7): Get the tests working
|
||||
|
||||
- name: "cargo release linux x86_64"
|
||||
os: linux
|
||||
|
|
277
BUILD.gn
277
BUILD.gn
|
@ -1,184 +1,13 @@
|
|||
# Copyright 2018-2019 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",
|
||||
"cli:deno",
|
||||
"cli:test_rs",
|
||||
"core:default",
|
||||
"libdeno:test_cc",
|
||||
]
|
||||
}
|
||||
|
||||
main_extern = [
|
||||
"core:deno_core",
|
||||
|
||||
"$rust_build:ansi_term",
|
||||
"$rust_build:atty",
|
||||
"$rust_build:dirs",
|
||||
"$rust_build:flatbuffers",
|
||||
"$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:regex",
|
||||
"$rust_build:remove_dir_all",
|
||||
"$rust_build:ring",
|
||||
"$rust_build:rustyline",
|
||||
"$rust_build:serde_json",
|
||||
"$rust_build:source_map_mappings",
|
||||
"$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",
|
||||
]
|
||||
if (is_win) {
|
||||
main_extern += [ "$rust_build:winapi" ]
|
||||
}
|
||||
|
||||
ts_sources = [
|
||||
"js/assets.ts",
|
||||
"js/blob.ts",
|
||||
"js/buffer.ts",
|
||||
"js/build.ts",
|
||||
"js/chmod.ts",
|
||||
"js/console_table.ts",
|
||||
"js/compiler.ts",
|
||||
"js/console.ts",
|
||||
"js/copy_file.ts",
|
||||
"js/core.ts",
|
||||
"js/custom_event.ts",
|
||||
"js/deno.ts",
|
||||
"js/dir.ts",
|
||||
"js/dispatch.ts",
|
||||
"js/dom_types.ts",
|
||||
"js/errors.ts",
|
||||
"js/event.ts",
|
||||
"js/event_target.ts",
|
||||
"js/fetch.ts",
|
||||
"js/format_error.ts",
|
||||
"js/dom_file.ts",
|
||||
"js/file_info.ts",
|
||||
"js/files.ts",
|
||||
"js/flatbuffers.ts",
|
||||
"js/form_data.ts",
|
||||
"js/globals.ts",
|
||||
"js/headers.ts",
|
||||
"js/io.ts",
|
||||
"js/lib.web_assembly.d.ts",
|
||||
"js/location.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/permissions.ts",
|
||||
"js/plugins.d.ts",
|
||||
"js/process.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/stat.ts",
|
||||
"js/symlink.ts",
|
||||
"js/text_encoding.ts",
|
||||
"js/timers.ts",
|
||||
"js/truncate.ts",
|
||||
"js/types.ts",
|
||||
"js/url.ts",
|
||||
"js/url_search_params.ts",
|
||||
"js/util.ts",
|
||||
"js/window.ts",
|
||||
"js/workers.ts",
|
||||
"js/write_file.ts",
|
||||
"js/performance.ts",
|
||||
"js/version.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",
|
||||
]
|
||||
|
||||
# When Cargo is driving the build, GN/Ninja are used to produce these non-Rust
|
||||
# targets. Cargo handles all Rust source files and the final linking step.
|
||||
group("deno_deps") {
|
||||
deps = [
|
||||
":msg_rs",
|
||||
":snapshot_compiler",
|
||||
":snapshot_deno",
|
||||
"libdeno:libdeno_static_lib",
|
||||
]
|
||||
}
|
||||
|
||||
# Optimized dependencies for cross compiled builds.
|
||||
# This can be removed once we get snapshots into cross compiled builds.
|
||||
group("deno_deps_cross") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":compiler_bundle",
|
||||
":main_bundle",
|
||||
":msg_rs",
|
||||
"libdeno:libdeno_static_lib",
|
||||
"libdeno:test_cc",
|
||||
]
|
||||
}
|
||||
|
||||
# Reads the cargo info from Cargo.toml
|
||||
deno_cargo_info = exec_script("build_extra/rust/get_cargo_info.py",
|
||||
[ rebase_path("Cargo.toml", root_build_dir) ],
|
||||
"json")
|
||||
|
||||
rust_executable("deno") {
|
||||
source_root = "cli/main.rs"
|
||||
extern = main_extern
|
||||
deps = [
|
||||
":deno_deps",
|
||||
]
|
||||
|
||||
# Extract version from Cargo.toml
|
||||
# TODO integrate this into rust.gni by allowing the rust_executable template
|
||||
# to specify a cargo.toml from which it will extract a version.
|
||||
crate_version = deno_cargo_info.version
|
||||
inputs = [
|
||||
"Cargo.toml",
|
||||
]
|
||||
}
|
||||
|
||||
rust_test("test_rs") {
|
||||
source_root = "cli/main.rs"
|
||||
extern = main_extern
|
||||
deps = [
|
||||
":deno_deps",
|
||||
]
|
||||
|
||||
# Extract version from Cargo.toml
|
||||
crate_version = deno_cargo_info.version
|
||||
inputs = [
|
||||
"Cargo.toml",
|
||||
"core/libdeno:test_cc",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -189,103 +18,3 @@ rust_executable("hyper_hello") {
|
|||
"$rust_build:ring",
|
||||
]
|
||||
}
|
||||
|
||||
# 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",
|
||||
]
|
||||
inputs = ts_sources + [
|
||||
"tools/ts_library_builder/tsconfig.json",
|
||||
"tools/ts_library_builder/main.ts",
|
||||
"tools/ts_library_builder/build_library.ts",
|
||||
"tools/ts_library_builder/ast_util.ts",
|
||||
]
|
||||
args = [
|
||||
rebase_path("node_modules/ts-node/dist/bin.js", root_build_dir),
|
||||
"--project",
|
||||
rebase_path("tools/ts_library_builder/tsconfig.json"),
|
||||
"--skip-ignore",
|
||||
rebase_path("tools/ts_library_builder/main.ts", root_build_dir),
|
||||
"--basePath",
|
||||
rebase_path(".", root_build_dir),
|
||||
"--inline",
|
||||
rebase_path("js/lib.web_assembly.d.ts", root_build_dir),
|
||||
"--buildPath",
|
||||
rebase_path(root_build_dir, root_build_dir),
|
||||
"--outFile",
|
||||
rebase_path(outputs[0], root_build_dir),
|
||||
"--silent",
|
||||
]
|
||||
if (is_debug) {
|
||||
args += [ "--debug" ]
|
||||
}
|
||||
}
|
||||
|
||||
bundle("main_bundle") {
|
||||
out_dir = "$target_gen_dir/bundle/"
|
||||
out_name = "main"
|
||||
deps = [
|
||||
":deno_runtime_declaration",
|
||||
":msg_ts",
|
||||
":write_gn_args",
|
||||
]
|
||||
data = [
|
||||
"$target_gen_dir/gn_args.txt",
|
||||
]
|
||||
}
|
||||
|
||||
bundle("compiler_bundle") {
|
||||
out_dir = "$target_gen_dir/bundle/"
|
||||
out_name = "compiler"
|
||||
deps = [
|
||||
":deno_runtime_declaration",
|
||||
":msg_ts",
|
||||
":write_gn_args",
|
||||
]
|
||||
data = [
|
||||
"$target_gen_dir/gn_args.txt",
|
||||
]
|
||||
}
|
||||
|
||||
ts_flatbuffer("msg_ts") {
|
||||
sources = [
|
||||
"cli/msg.fbs",
|
||||
]
|
||||
}
|
||||
|
||||
rust_flatbuffer("msg_rs") {
|
||||
sources = [
|
||||
"cli/msg.fbs",
|
||||
]
|
||||
}
|
||||
|
||||
# Generates $target_gen_dir/snapshot_deno.bin
|
||||
snapshot("snapshot_deno") {
|
||||
source_root = "$target_gen_dir/bundle/main.js"
|
||||
deps = [
|
||||
":main_bundle",
|
||||
]
|
||||
}
|
||||
|
||||
# Generates $target_gen_dir/snapshot_compiler.bin
|
||||
snapshot("snapshot_compiler") {
|
||||
source_root = "$target_gen_dir/bundle/compiler.js"
|
||||
deps = [
|
||||
":compiler_bundle",
|
||||
]
|
||||
}
|
||||
|
||||
action("write_gn_args") {
|
||||
script = "//tools/write_gn_args.py"
|
||||
outputs = [
|
||||
"$target_gen_dir/gn_args.txt",
|
||||
]
|
||||
args = [ rebase_path(outputs[0], root_build_dir) ]
|
||||
}
|
||||
|
|
53
Cargo.toml
53
Cargo.toml
|
@ -1,56 +1,5 @@
|
|||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
# Dummy package info required by `cargo fetch`.
|
||||
# Use tools/sync_third_party.py to install deps after editing this file.
|
||||
# Deno does not build with cargo. Deno uses a build system called gn.
|
||||
# See build_extra/rust/BUILD.gn for the manually built configuration of rust
|
||||
# crates.
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"./",
|
||||
"cli",
|
||||
"core",
|
||||
]
|
||||
|
||||
[[bin]]
|
||||
name = "deno"
|
||||
path = "cli/main.rs"
|
||||
|
||||
[package]
|
||||
name = "deno"
|
||||
version = "0.3.5"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
deno_core = { path = "./core" }
|
||||
|
||||
ansi_term = "0.11.0"
|
||||
atty = "0.2.11"
|
||||
dirs = "1.0.5"
|
||||
flatbuffers = "0.5.0"
|
||||
futures = "0.1.25"
|
||||
getopts = "0.2.18"
|
||||
http = "0.1.16"
|
||||
hyper = "0.12.25"
|
||||
hyper-rustls = "0.16.1"
|
||||
integer-atomics = "1.0.2"
|
||||
lazy_static = "1.3.0"
|
||||
libc = "0.2.51"
|
||||
log = "0.4.6"
|
||||
rand = "0.6.5"
|
||||
regex = "1.1.2"
|
||||
remove_dir_all = "0.5.1"
|
||||
ring = "0.14.6"
|
||||
rustyline = "3.0.0"
|
||||
serde_json = "1.0.39"
|
||||
source-map-mappings = "0.5.0"
|
||||
tempfile = "3.0.7"
|
||||
tokio = "0.1.18"
|
||||
tokio-executor = "0.1.7"
|
||||
tokio-fs = "0.1.6"
|
||||
tokio-io = "0.1.12"
|
||||
tokio-process = "0.2.3"
|
||||
tokio-threadpool = "0.1.13"
|
||||
url = "1.7.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3.6"
|
||||
|
|
152
build.rs
152
build.rs
|
@ -1,152 +0,0 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// Run "cargo build -vv" if you want to see gn output.
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use std::env;
|
||||
use std::path::{self, Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let gn_mode = if cfg!(target_os = "windows") {
|
||||
// On Windows, we need to link with a release build of libdeno, because
|
||||
// rust always uses the release CRT.
|
||||
// TODO(piscisaureus): make linking with debug libdeno possible.
|
||||
String::from("release")
|
||||
} else {
|
||||
// Cargo sets PROFILE to either "debug" or "release", which conveniently
|
||||
// matches the build modes we support.
|
||||
env::var("PROFILE").unwrap()
|
||||
};
|
||||
|
||||
// Equivalent to target arch != host arch
|
||||
let is_different_target_arch =
|
||||
env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() != env::var("HOST")
|
||||
.unwrap()
|
||||
.as_str()
|
||||
.split("-")
|
||||
.collect::<Vec<&str>>()[0];
|
||||
|
||||
// If we are using the same target as the host's default
|
||||
// "rustup target list" should show your default target
|
||||
let is_default_target =
|
||||
env::var("TARGET").unwrap() == env::var("HOST").unwrap();
|
||||
|
||||
let cwd = env::current_dir().unwrap();
|
||||
// If not using host default target the output folder will change
|
||||
// target/release will become target/$TARGET/release
|
||||
// Gn should also be using this output directory as well
|
||||
// most things will work with gn using the default
|
||||
// output directory but some tests depend on artifacts
|
||||
// being in a specific directory relative to the main build output
|
||||
let gn_out_path = cwd.join(format!(
|
||||
"target/{}",
|
||||
match is_default_target {
|
||||
true => gn_mode.clone(),
|
||||
false => format!("{}/{}", env::var("TARGET").unwrap(), gn_mode.clone()),
|
||||
}
|
||||
));
|
||||
let gn_out_dir = normalize_path(&gn_out_path);
|
||||
|
||||
// Tell Cargo when to re-run this file. We do this first, so these directives
|
||||
// can take effect even if something goes wrong later in the build process.
|
||||
println!("cargo:rerun-if-env-changed=DENO_BUILD_PATH");
|
||||
// TODO: this is obviously not appropriate here.
|
||||
println!("cargo:rerun-if-env-changed=APPVEYOR_REPO_COMMIT");
|
||||
|
||||
// Detect if we're being invoked by the rust language server (RLS).
|
||||
// Unfortunately we can't detect whether we're being run by `cargo check`.
|
||||
let check_only = env::var_os("CARGO")
|
||||
.map(PathBuf::from)
|
||||
.as_ref()
|
||||
.and_then(|p| p.file_stem())
|
||||
.and_then(|f| f.to_str())
|
||||
.map(|s| s.starts_with("rls"))
|
||||
.unwrap_or(false);
|
||||
|
||||
// This helps Rust source files locate the snapshot, source map etc.
|
||||
println!("cargo:rustc-env=GN_OUT_DIR={}", gn_out_dir);
|
||||
|
||||
let gn_target;
|
||||
|
||||
if check_only {
|
||||
// When RLS is running "cargo check" to analyze the source code, we're not
|
||||
// trying to build a working executable, rather we're just compiling all
|
||||
// rust code. Therefore, make ninja build only 'msg_generated.rs'.
|
||||
gn_target = "msg_rs";
|
||||
|
||||
// Enable the 'check_only' feature, which enables some workarounds in the
|
||||
// rust source code to compile successfully without a bundle and snapshot
|
||||
println!("cargo:rustc-cfg=feature=\"check-only\"");
|
||||
} else {
|
||||
// "Full" (non-RLS) build.
|
||||
if is_different_target_arch {
|
||||
gn_target = "deno_deps_cross";
|
||||
} else {
|
||||
gn_target = "deno_deps";
|
||||
}
|
||||
// Link with libdeno.a/.lib, which includes V8.
|
||||
println!("cargo:rustc-link-search=native={}/obj/libdeno", gn_out_dir);
|
||||
if cfg!(target_os = "windows") {
|
||||
println!("cargo:rustc-link-lib=static=libdeno");
|
||||
} else {
|
||||
println!("cargo:rustc-link-lib=static=deno");
|
||||
}
|
||||
|
||||
// Link the system libraries that libdeno and V8 depend on.
|
||||
if cfg!(any(target_os = "macos", target_os = "freebsd")) {
|
||||
println!("cargo:rustc-link-lib=dylib=c++");
|
||||
} else if cfg!(target_os = "windows") {
|
||||
for lib in vec!["dbghelp", "shlwapi", "winmm", "ws2_32"] {
|
||||
println!("cargo:rustc-link-lib={}", lib);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If target_arch != host_arch disable snapshots.
|
||||
// v8 snapshots seem to not be compatible with binaries
|
||||
// other than the ones used to gernerate them,
|
||||
// so for non native architecture builds we don't
|
||||
// have an easy way to generate these snapshots.
|
||||
// We can't run any binary capable of generating
|
||||
// compatible snapshots without emulating the
|
||||
// target architecture.
|
||||
if is_different_target_arch {
|
||||
// no-snapshot-init is not related to v8_use_snapshots
|
||||
println!("cargo:rustc-cfg=feature=\"no-snapshot-init\"");
|
||||
}
|
||||
|
||||
if !gn_out_path.join("build.ninja").exists() {
|
||||
let status = Command::new("python")
|
||||
.env("DENO_BUILD_PATH", &gn_out_dir)
|
||||
.env("DENO_BUILD_MODE", &gn_mode)
|
||||
.arg("./tools/setup.py")
|
||||
.status()
|
||||
.expect("setup.py failed");
|
||||
assert!(status.success());
|
||||
}
|
||||
|
||||
let status = Command::new("python")
|
||||
.env("DENO_BUILD_PATH", &gn_out_dir)
|
||||
.env("DENO_BUILD_MODE", &gn_mode)
|
||||
.arg("./tools/build.py")
|
||||
.arg(gn_target)
|
||||
.arg("-v")
|
||||
.status()
|
||||
.expect("build.py failed");
|
||||
assert!(status.success());
|
||||
}
|
||||
|
||||
// Utility function to make a path absolute, normalizing it to use forward
|
||||
// slashes only. The returned value is an owned String, otherwise panics.
|
||||
fn normalize_path<T: AsRef<Path>>(path: T) -> String {
|
||||
path
|
||||
.as_ref()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.to_owned()
|
||||
.chars()
|
||||
.map(|c| if path::is_separator(c) { '/' } else { c })
|
||||
.collect()
|
||||
}
|
270
cli/BUILD.gn
Normal file
270
cli/BUILD.gn
Normal file
|
@ -0,0 +1,270 @@
|
|||
# Copyright 2018-2019 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("../deno.gni")
|
||||
|
||||
main_extern = [
|
||||
"../core:deno_core",
|
||||
|
||||
"$rust_build:ansi_term",
|
||||
"$rust_build:atty",
|
||||
"$rust_build:dirs",
|
||||
"$rust_build:flatbuffers",
|
||||
"$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:regex",
|
||||
"$rust_build:remove_dir_all",
|
||||
"$rust_build:ring",
|
||||
"$rust_build:rustyline",
|
||||
"$rust_build:serde_json",
|
||||
"$rust_build:source_map_mappings",
|
||||
"$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",
|
||||
]
|
||||
if (is_win) {
|
||||
main_extern += [ "$rust_build:winapi" ]
|
||||
}
|
||||
|
||||
ts_sources = [
|
||||
"../js/assets.ts",
|
||||
"../js/blob.ts",
|
||||
"../js/buffer.ts",
|
||||
"../js/build.ts",
|
||||
"../js/chmod.ts",
|
||||
"../js/console_table.ts",
|
||||
"../js/compiler.ts",
|
||||
"../js/console.ts",
|
||||
"../js/copy_file.ts",
|
||||
"../js/core.ts",
|
||||
"../js/custom_event.ts",
|
||||
"../js/deno.ts",
|
||||
"../js/dir.ts",
|
||||
"../js/dispatch.ts",
|
||||
"../js/dom_types.ts",
|
||||
"../js/errors.ts",
|
||||
"../js/event.ts",
|
||||
"../js/event_target.ts",
|
||||
"../js/fetch.ts",
|
||||
"../js/format_error.ts",
|
||||
"../js/dom_file.ts",
|
||||
"../js/file_info.ts",
|
||||
"../js/files.ts",
|
||||
"../js/flatbuffers.ts",
|
||||
"../js/form_data.ts",
|
||||
"../js/globals.ts",
|
||||
"../js/headers.ts",
|
||||
"../js/io.ts",
|
||||
"../js/lib.web_assembly.d.ts",
|
||||
"../js/location.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/permissions.ts",
|
||||
"../js/plugins.d.ts",
|
||||
"../js/process.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/stat.ts",
|
||||
"../js/symlink.ts",
|
||||
"../js/text_encoding.ts",
|
||||
"../js/timers.ts",
|
||||
"../js/truncate.ts",
|
||||
"../js/types.ts",
|
||||
"../js/url.ts",
|
||||
"../js/url_search_params.ts",
|
||||
"../js/util.ts",
|
||||
"../js/window.ts",
|
||||
"../js/workers.ts",
|
||||
"../js/write_file.ts",
|
||||
"../js/performance.ts",
|
||||
"../js/version.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",
|
||||
]
|
||||
|
||||
# When Cargo is driving the build, GN/Ninja are used to produce these non-Rust
|
||||
# targets. Cargo handles all Rust source files and the final linking step.
|
||||
group("deno_deps") {
|
||||
deps = [
|
||||
":msg_rs",
|
||||
":snapshot_compiler",
|
||||
":snapshot_deno",
|
||||
]
|
||||
}
|
||||
|
||||
# Optimized dependencies for cross compiled builds.
|
||||
# This can be removed once we get snapshots into cross compiled builds.
|
||||
group("deno_deps_cross") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":compiler_bundle",
|
||||
":main_bundle",
|
||||
":msg_rs",
|
||||
]
|
||||
}
|
||||
|
||||
# Reads the cargo info from Cargo.toml
|
||||
deno_cargo_info = exec_script(
|
||||
"../build_extra/rust/get_cargo_info.py",
|
||||
[ rebase_path("Cargo.toml", root_build_dir) ], "json")
|
||||
|
||||
rust_executable("deno") {
|
||||
source_root = "main.rs"
|
||||
extern = main_extern
|
||||
deps = [
|
||||
":deno_deps",
|
||||
]
|
||||
|
||||
# Extract version from Cargo.toml
|
||||
# TODO integrate this into rust.gni by allowing the rust_executable template
|
||||
# to specify a cargo.toml from which it will extract a version.
|
||||
crate_version = deno_cargo_info.version
|
||||
inputs = [
|
||||
"Cargo.toml",
|
||||
]
|
||||
}
|
||||
|
||||
rust_test("test_rs") {
|
||||
source_root = "main.rs"
|
||||
extern = main_extern
|
||||
deps = [
|
||||
":deno_deps",
|
||||
]
|
||||
|
||||
# Extract version from Cargo.toml
|
||||
crate_version = deno_cargo_info.version
|
||||
inputs = [
|
||||
"Cargo.toml",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# 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",
|
||||
]
|
||||
inputs = ts_sources + [
|
||||
"//tools/ts_library_builder/tsconfig.json",
|
||||
"//tools/ts_library_builder/main.ts",
|
||||
"//tools/ts_library_builder/build_library.ts",
|
||||
"//tools/ts_library_builder/ast_util.ts",
|
||||
]
|
||||
args = [
|
||||
rebase_path("//node_modules/ts-node/dist/bin.js", root_build_dir),
|
||||
"--project",
|
||||
rebase_path("//tools/ts_library_builder/tsconfig.json"),
|
||||
"--skip-ignore",
|
||||
rebase_path("//tools/ts_library_builder/main.ts", root_build_dir),
|
||||
"--basePath",
|
||||
rebase_path("//", root_build_dir),
|
||||
"--inline",
|
||||
rebase_path("//js/lib.web_assembly.d.ts", root_build_dir),
|
||||
"--buildPath",
|
||||
rebase_path(root_build_dir, root_build_dir),
|
||||
"--outFile",
|
||||
rebase_path(outputs[0], root_build_dir),
|
||||
"--silent",
|
||||
]
|
||||
if (is_debug) {
|
||||
args += [ "--debug" ]
|
||||
}
|
||||
}
|
||||
|
||||
bundle("main_bundle") {
|
||||
out_dir = "$target_gen_dir/bundle/"
|
||||
out_name = "main"
|
||||
deps = [
|
||||
":deno_runtime_declaration",
|
||||
":msg_ts",
|
||||
":write_gn_args",
|
||||
]
|
||||
data = [
|
||||
"$target_gen_dir/gn_args.txt",
|
||||
]
|
||||
}
|
||||
|
||||
bundle("compiler_bundle") {
|
||||
out_dir = "$target_gen_dir/bundle/"
|
||||
out_name = "compiler"
|
||||
deps = [
|
||||
":deno_runtime_declaration",
|
||||
":msg_ts",
|
||||
":write_gn_args",
|
||||
]
|
||||
data = [
|
||||
"$target_gen_dir/gn_args.txt",
|
||||
]
|
||||
}
|
||||
|
||||
ts_flatbuffer("msg_ts") {
|
||||
sources = [
|
||||
"msg.fbs",
|
||||
]
|
||||
}
|
||||
|
||||
rust_flatbuffer("msg_rs") {
|
||||
sources = [
|
||||
"msg.fbs",
|
||||
]
|
||||
}
|
||||
|
||||
# Generates $target_gen_dir/snapshot_deno.bin
|
||||
snapshot("snapshot_deno") {
|
||||
source_root = "$target_gen_dir/bundle/main.js"
|
||||
deps = [
|
||||
":main_bundle",
|
||||
]
|
||||
}
|
||||
|
||||
# Generates $target_gen_dir/snapshot_compiler.bin
|
||||
snapshot("snapshot_compiler") {
|
||||
source_root = "$target_gen_dir/bundle/compiler.js"
|
||||
deps = [
|
||||
":compiler_bundle",
|
||||
]
|
||||
}
|
||||
|
||||
action("write_gn_args") {
|
||||
script = "//tools/write_gn_args.py"
|
||||
outputs = [
|
||||
"$target_gen_dir/gn_args.txt",
|
||||
]
|
||||
args = [ rebase_path(outputs[0], root_build_dir) ]
|
||||
}
|
51
cli/Cargo.toml
Normal file
51
cli/Cargo.toml
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
# Dummy package info required by `cargo fetch`.
|
||||
# Use tools/sync_third_party.py to install deps after editing this file.
|
||||
# Deno does not build with cargo. Deno uses a build system called gn.
|
||||
# See build_extra/rust/BUILD.gn for the manually built configuration of rust
|
||||
# crates.
|
||||
|
||||
|
||||
[[bin]]
|
||||
name = "deno"
|
||||
path = "main.rs"
|
||||
|
||||
[package]
|
||||
name = "deno"
|
||||
version = "0.3.5"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
deno_core = { path = "../core" }
|
||||
|
||||
ansi_term = "0.11.0"
|
||||
atty = "0.2.11"
|
||||
dirs = "1.0.5"
|
||||
flatbuffers = "0.5.0"
|
||||
futures = "0.1.25"
|
||||
getopts = "0.2.18"
|
||||
http = "0.1.16"
|
||||
hyper = "0.12.25"
|
||||
hyper-rustls = "0.16.1"
|
||||
integer-atomics = "1.0.2"
|
||||
lazy_static = "1.3.0"
|
||||
libc = "0.2.51"
|
||||
log = "0.4.6"
|
||||
rand = "0.6.5"
|
||||
regex = "1.1.2"
|
||||
remove_dir_all = "0.5.1"
|
||||
ring = "0.14.6"
|
||||
rustyline = "3.0.0"
|
||||
serde_json = "1.0.39"
|
||||
source-map-mappings = "0.5.0"
|
||||
tempfile = "3.0.7"
|
||||
tokio = "0.1.18"
|
||||
tokio-executor = "0.1.7"
|
||||
tokio-fs = "0.1.6"
|
||||
tokio-io = "0.1.12"
|
||||
tokio-process = "0.2.3"
|
||||
tokio-threadpool = "0.1.13"
|
||||
url = "1.7.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3.6"
|
20
cli/build.rs
Normal file
20
cli/build.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
// Run "cargo build -vv" if you want to see gn output.
|
||||
mod gn {
|
||||
include!("../gn.rs");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let build = gn::Build::setup();
|
||||
|
||||
let gn_target = if build.check_only {
|
||||
// When RLS is running "cargo check" to analyze the source code, we're not
|
||||
// trying to build a working executable, rather we're just compiling all
|
||||
// rust code. Therefore, make ninja build only 'msg_generated.rs'.
|
||||
"cli:msg_rs"
|
||||
} else {
|
||||
"cli:deno_deps"
|
||||
};
|
||||
|
||||
build.run(gn_target);
|
||||
}
|
|
@ -64,9 +64,9 @@ impl<'a> fmt::Display for JSErrorColor<'a> {
|
|||
let e = self.0;
|
||||
if e.script_resource_name.is_some() {
|
||||
let script_resource_name = e.script_resource_name.as_ref().unwrap();
|
||||
// Avoid showing internal code from gen/bundle/main.js
|
||||
if script_resource_name != "gen/bundle/main.js"
|
||||
&& script_resource_name != "gen/bundle/compiler.js"
|
||||
// Avoid showing internal code from gen/cli/bundle/main.js
|
||||
if script_resource_name != "gen/cli/bundle/main.js"
|
||||
&& script_resource_name != "gen/cli/bundle/compiler.js"
|
||||
{
|
||||
if e.line_number.is_some() && e.start_column.is_some() {
|
||||
assert!(e.line_number.is_some());
|
||||
|
@ -216,14 +216,16 @@ fn builtin_source_map(_: &str) -> Option<Vec<u8>> {
|
|||
#[cfg(not(feature = "check-only"))]
|
||||
fn builtin_source_map(script_name: &str) -> Option<Vec<u8>> {
|
||||
match script_name {
|
||||
"gen/bundle/main.js" => Some(
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/bundle/main.js.map"))
|
||||
.to_vec(),
|
||||
),
|
||||
"gen/bundle/compiler.js" => Some(
|
||||
"gen/cli/bundle/main.js" => Some(
|
||||
include_bytes!(concat!(
|
||||
env!("GN_OUT_DIR"),
|
||||
"/gen/bundle/compiler.js.map"
|
||||
"/gen/cli/bundle/main.js.map"
|
||||
)).to_vec(),
|
||||
),
|
||||
"gen/cli/bundle/compiler.js" => Some(
|
||||
include_bytes!(concat!(
|
||||
env!("GN_OUT_DIR"),
|
||||
"/gen/cli/bundle/compiler.js.map"
|
||||
)).to_vec(),
|
||||
),
|
||||
_ => None,
|
||||
|
@ -381,7 +383,7 @@ mod tests {
|
|||
frames: vec![StackFrame {
|
||||
line: 11,
|
||||
column: 12,
|
||||
script_name: "gen/bundle/main.js".to_string(),
|
||||
script_name: "gen/cli/bundle/main.js".to_string(),
|
||||
function_name: "setLogDebug".to_string(),
|
||||
is_eval: false,
|
||||
is_constructor: false,
|
||||
|
|
|
@ -388,7 +388,7 @@ table OpenRes {
|
|||
|
||||
table Read {
|
||||
rid: uint32;
|
||||
// (ptr, len) is passed as second parameter to libdeno.send().
|
||||
// (ptr, len) is passed as second parameter to Deno.core.send().
|
||||
}
|
||||
|
||||
table ReadRes {
|
||||
|
|
|
@ -11,7 +11,7 @@ use std::sync::atomic::Ordering;
|
|||
|
||||
// GN_OUT_DIR is set either by build.rs (for the Cargo build), or by
|
||||
// build_extra/rust/run.py (for the GN+Ninja build).
|
||||
include!(concat!(env!("GN_OUT_DIR"), "/gen/msg_generated.rs"));
|
||||
include!(concat!(env!("GN_OUT_DIR"), "/gen/cli/msg_generated.rs"));
|
||||
|
||||
impl<'a> From<&'a isolate_state::Metrics> for MetricsResArgs {
|
||||
fn from(m: &'a isolate_state::Metrics) -> Self {
|
||||
|
|
|
@ -7,19 +7,19 @@ pub fn deno_isolate_init() -> StartupData {
|
|||
debug!("Deno isolate init without snapshots.");
|
||||
#[cfg(not(feature = "check-only"))]
|
||||
let source_bytes =
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/bundle/main.js"));
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/cli/bundle/main.js"));
|
||||
#[cfg(feature = "check-only")]
|
||||
let source_bytes = vec![];
|
||||
|
||||
StartupData::Script(Script {
|
||||
filename: "gen/bundle/main.js".to_string(),
|
||||
filename: "gen/cli/bundle/main.js".to_string(),
|
||||
source: std::str::from_utf8(&source_bytes[..]).unwrap().to_string(),
|
||||
})
|
||||
} else {
|
||||
debug!("Deno isolate init with snapshots.");
|
||||
#[cfg(not(any(feature = "check-only", feature = "no-snapshot-init")))]
|
||||
let data =
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_deno.bin"));
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/cli/snapshot_deno.bin"));
|
||||
#[cfg(any(feature = "check-only", feature = "no-snapshot-init"))]
|
||||
let data = vec![];
|
||||
|
||||
|
@ -33,20 +33,24 @@ pub fn compiler_isolate_init() -> StartupData {
|
|||
if cfg!(feature = "no-snapshot-init") {
|
||||
debug!("Deno isolate init without snapshots.");
|
||||
#[cfg(not(feature = "check-only"))]
|
||||
let source_bytes =
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/bundle/compiler.js"));
|
||||
let source_bytes = include_bytes!(concat!(
|
||||
env!("GN_OUT_DIR"),
|
||||
"/gen/cli/bundle/compiler.js"
|
||||
));
|
||||
#[cfg(feature = "check-only")]
|
||||
let source_bytes = vec![];
|
||||
|
||||
StartupData::Script(Script {
|
||||
filename: "gen/bundle/compiler.js".to_string(),
|
||||
filename: "gen/cli/bundle/compiler.js".to_string(),
|
||||
source: std::str::from_utf8(&source_bytes[..]).unwrap().to_string(),
|
||||
})
|
||||
} else {
|
||||
debug!("Deno isolate init with snapshots.");
|
||||
#[cfg(not(any(feature = "check-only", feature = "no-snapshot-init")))]
|
||||
let data =
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_compiler.bin"));
|
||||
let data = include_bytes!(concat!(
|
||||
env!("GN_OUT_DIR"),
|
||||
"/gen/cli/snapshot_compiler.bin"
|
||||
));
|
||||
#[cfg(any(feature = "check-only", feature = "no-snapshot-init"))]
|
||||
let data = vec![];
|
||||
|
||||
|
|
|
@ -3,16 +3,19 @@ import("//build_extra/rust/rust.gni")
|
|||
group("default") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":deno_core",
|
||||
":deno_core_http_bench",
|
||||
":deno_core_http_bench_test",
|
||||
":deno_core_test",
|
||||
]
|
||||
}
|
||||
|
||||
deno_core_deps = [
|
||||
"../libdeno:libdeno_static_lib",
|
||||
"../libdeno:v8",
|
||||
]
|
||||
group("deno_core_deps") {
|
||||
deps = [
|
||||
"libdeno:libdeno_static_lib",
|
||||
"libdeno:v8",
|
||||
]
|
||||
}
|
||||
|
||||
# deno_core does not depend on flatbuffers nor tokio.
|
||||
main_extern = [
|
||||
|
@ -24,13 +27,17 @@ main_extern = [
|
|||
|
||||
rust_crate("deno_core") {
|
||||
source_root = "lib.rs"
|
||||
deps = deno_core_deps
|
||||
deps = [
|
||||
":deno_core_deps",
|
||||
]
|
||||
extern = main_extern
|
||||
}
|
||||
|
||||
rust_test("deno_core_test") {
|
||||
source_root = "lib.rs"
|
||||
deps = deno_core_deps
|
||||
deps = [
|
||||
":deno_core_deps",
|
||||
]
|
||||
extern = main_extern
|
||||
}
|
||||
|
||||
|
@ -48,12 +55,16 @@ if (is_win) {
|
|||
|
||||
rust_executable("deno_core_http_bench") {
|
||||
source_root = "http_bench.rs"
|
||||
deps = deno_core_deps
|
||||
deps = [
|
||||
":deno_core_deps",
|
||||
]
|
||||
extern = http_bench_extern
|
||||
}
|
||||
|
||||
rust_test("deno_core_http_bench_test") {
|
||||
source_root = "http_bench.rs"
|
||||
deps = deno_core_deps
|
||||
deps = [
|
||||
":deno_core_deps",
|
||||
]
|
||||
extern = http_bench_extern
|
||||
}
|
||||
|
|
30
core/build.rs
Normal file
30
core/build.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
// Run "cargo build -vv" if you want to see gn output.
|
||||
mod gn {
|
||||
include!("../gn.rs");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let build = gn::Build::setup();
|
||||
|
||||
println!(
|
||||
"cargo:rustc-link-search=native={}/obj/core/libdeno",
|
||||
build.gn_out_dir
|
||||
);
|
||||
if cfg!(target_os = "windows") {
|
||||
println!("cargo:rustc-link-lib=static=libdeno");
|
||||
} else {
|
||||
println!("cargo:rustc-link-lib=static=deno");
|
||||
}
|
||||
|
||||
// Link the system libraries that libdeno and V8 depend on.
|
||||
if cfg!(any(target_os = "macos", target_os = "freebsd")) {
|
||||
println!("cargo:rustc-link-lib=dylib=c++");
|
||||
} else if cfg!(target_os = "windows") {
|
||||
for lib in vec!["dbghelp", "shlwapi", "winmm", "ws2_32"] {
|
||||
println!("cargo:rustc-link-lib={}", lib);
|
||||
}
|
||||
}
|
||||
|
||||
build.run("core:deno_core_deps");
|
||||
}
|
|
@ -125,7 +125,7 @@ impl<B: Behavior> Isolate<B> {
|
|||
None => libdeno::deno_buf::empty(),
|
||||
},
|
||||
shared: shared.as_deno_buf(),
|
||||
recv_cb: Self::predispatch,
|
||||
recv_cb: Self::pre_dispatch,
|
||||
};
|
||||
let libdeno_isolate = unsafe { libdeno::deno_new(config) };
|
||||
|
||||
|
@ -166,7 +166,7 @@ impl<B: Behavior> Isolate<B> {
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" fn predispatch(
|
||||
extern "C" fn pre_dispatch(
|
||||
user_data: *mut c_void,
|
||||
control_argv0: deno_buf,
|
||||
zero_copy_buf: deno_buf,
|
||||
|
@ -612,7 +612,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn testdispatch() {
|
||||
fn test_dispatch() {
|
||||
let mut isolate = TestBehavior::setup(TestBehaviorMode::AsyncImmediate);
|
||||
js_check(isolate.execute(
|
||||
"filename.js",
|
||||
|
@ -917,12 +917,12 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn overflow_res_multipledispatch_async() {
|
||||
fn overflow_res_multiple_dispatch_async() {
|
||||
// TODO(ry) This test is quite slow due to memcpy-ing 100MB into JS. We
|
||||
// should optimize this.
|
||||
let mut isolate = TestBehavior::setup(TestBehaviorMode::OverflowResAsync);
|
||||
js_check(isolate.execute(
|
||||
"overflow_res_multipledispatch_async.js",
|
||||
"overflow_res_multiple_dispatch_async.js",
|
||||
r#"
|
||||
let asyncRecv = 0;
|
||||
Deno.core.setAsyncHandler((buf) => {
|
||||
|
|
0
core/libdeno.rs
Executable file → Normal file
0
core/libdeno.rs
Executable file → Normal file
|
@ -1,6 +1,6 @@
|
|||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import("//deno.gni")
|
||||
import("//third_party/v8/gni/v8.gni")
|
||||
import("./deno.gni")
|
||||
|
||||
config("deno_config") {
|
||||
include_dirs = [ "//third_party/v8" ] # This allows us to v8/src/base/ libraries.
|
|
@ -23,8 +23,8 @@ typedef struct deno_s Deno;
|
|||
// A callback to receive a message from a libdeno.send() javascript call.
|
||||
// control_buf is valid for only for the lifetime of this callback.
|
||||
// data_buf is valid until deno_respond() is called.
|
||||
typedef void (*denorecv_cb)(void* user_data, deno_buf control_buf,
|
||||
deno_buf zerop_copy_buf);
|
||||
typedef void (*deno_recv_cb)(void* user_data, deno_buf control_buf,
|
||||
deno_buf zerop_copy_buf);
|
||||
|
||||
void deno_init();
|
||||
const char* deno_v8_version();
|
||||
|
@ -34,7 +34,7 @@ typedef struct {
|
|||
int will_snapshot; // Default 0. If calling deno_get_snapshot 1.
|
||||
deno_buf load_snapshot; // Optionally: A deno_buf from deno_get_snapshot.
|
||||
deno_buf shared; // Shared buffer to be mapped to libdeno.shared
|
||||
denorecv_cb recv_cb; // Maps to libdeno.send() calls.
|
||||
deno_recv_cb recv_cb; // Maps to libdeno.send() calls.
|
||||
} deno_config;
|
||||
|
||||
// Create a new deno isolate.
|
||||
|
@ -57,13 +57,13 @@ void deno_unlock(Deno* d);
|
|||
void deno_execute(Deno* d, void* user_data, const char* js_filename,
|
||||
const char* js_source);
|
||||
|
||||
// deno_respond sends up to one message back for every denorecv_cb made.
|
||||
// deno_respond sends up to one message back for every deno_recv_cb made.
|
||||
//
|
||||
// If this is called during denorecv_cb, the issuing libdeno.send() in
|
||||
// If this is called during deno_recv_cb, the issuing libdeno.send() in
|
||||
// javascript will synchronously return the specified buf as an ArrayBuffer (or
|
||||
// null if buf is empty).
|
||||
//
|
||||
// If this is called after denorecv_cb has returned, the deno_respond
|
||||
// If this is called after deno_recv_cb has returned, the deno_respond
|
||||
// will call into the JS callback specified by libdeno.recv().
|
||||
//
|
||||
// (Ideally, but not currently: After calling deno_respond(), the caller no
|
|
@ -104,7 +104,7 @@ class DenoIsolate {
|
|||
const v8::FunctionCallbackInfo<v8::Value>* current_args_;
|
||||
v8::SnapshotCreator* snapshot_creator_;
|
||||
void* global_import_buf_ptr_;
|
||||
denorecv_cb recv_cb_;
|
||||
deno_recv_cb recv_cb_;
|
||||
size_t next_zero_copy_id_;
|
||||
void* user_data_;
|
||||
|
||||
|
@ -170,7 +170,7 @@ static intptr_t external_references[] = {
|
|||
|
||||
static const deno_buf empty_buf = {nullptr, 0, nullptr, 0, 0};
|
||||
|
||||
Deno* NewFromSnapshot(void* user_data, denorecv_cb cb);
|
||||
Deno* NewFromSnapshot(void* user_data, deno_recv_cb cb);
|
||||
|
||||
void InitializeContext(v8::Isolate* isolate, v8::Local<v8::Context> context);
|
||||
|
|
@ -46,8 +46,8 @@ global.RecvReturnBar = () => {
|
|||
global.DoubleRecvFails = () => {
|
||||
// Deno.core.recv is an internal function and should only be called once from the
|
||||
// runtime.
|
||||
Deno.core.recv((channel, msg) => assert(false));
|
||||
Deno.core.recv((channel, msg) => assert(false));
|
||||
Deno.core.recv((_channel, _msg) => assert(false));
|
||||
Deno.core.recv((_channel, _msg) => assert(false));
|
||||
};
|
||||
|
||||
global.SendRecvSlice = () => {
|
|
@ -11,14 +11,14 @@ template("bundle") {
|
|||
out_dir + out_name + ".js.map",
|
||||
]
|
||||
inputs = [
|
||||
"js/" + out_name + ".ts",
|
||||
"rollup.config.js",
|
||||
"//js/" + out_name + ".ts",
|
||||
"//rollup.config.js",
|
||||
]
|
||||
depfile = out_dir + out_name + ".d"
|
||||
args = [
|
||||
rebase_path("third_party/node_modules/rollup/bin/rollup", root_build_dir),
|
||||
rebase_path("//third_party/node_modules/rollup/bin/rollup", root_build_dir),
|
||||
"-c",
|
||||
rebase_path("rollup.config.js", root_build_dir),
|
||||
rebase_path("//rollup.config.js", root_build_dir),
|
||||
"-i",
|
||||
rebase_path(inputs[0], root_build_dir),
|
||||
"-o",
|
||||
|
@ -45,7 +45,8 @@ template("snapshot") {
|
|||
"testonly",
|
||||
"deps",
|
||||
])
|
||||
tool = "//libdeno:snapshot_creator"
|
||||
# TODO(ry) Rewrite snapshot_creator in Rust.
|
||||
tool = "//core/libdeno:snapshot_creator"
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
snapshot_out_bin = "$target_gen_dir/$target_name.bin"
|
||||
inputs = [
|
110
gn.rs
Normal file
110
gn.rs
Normal file
|
@ -0,0 +1,110 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
// This is used in cli/build.rs and core/build.rs to interface with the GN build
|
||||
// system (which defines the deno build).
|
||||
|
||||
use std::env;
|
||||
use std::path::{self, Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
pub struct Build {
|
||||
gn_mode: String,
|
||||
pub gn_out_dir: String,
|
||||
pub gn_out_path: PathBuf,
|
||||
pub check_only: bool,
|
||||
}
|
||||
|
||||
impl Build {
|
||||
pub fn setup() -> Build {
|
||||
let gn_mode = if cfg!(target_os = "windows") {
|
||||
// On Windows, we need to link with a release build of libdeno, because
|
||||
// rust always uses the release CRT.
|
||||
// TODO(piscisaureus): make linking with debug libdeno possible.
|
||||
String::from("release")
|
||||
} else {
|
||||
// Cargo sets PROFILE to either "debug" or "release", which conveniently
|
||||
// matches the build modes we support.
|
||||
env::var("PROFILE").unwrap()
|
||||
};
|
||||
|
||||
// cd into workspace root.
|
||||
assert!(env::set_current_dir("..").is_ok());
|
||||
|
||||
let cwd = env::current_dir().unwrap();
|
||||
// If not using host default target the output folder will change
|
||||
// target/release will become target/$TARGET/release
|
||||
// Gn should also be using this output directory as well
|
||||
// most things will work with gn using the default
|
||||
// output directory but some tests depend on artifacts
|
||||
// being in a specific directory relative to the main build output
|
||||
let gn_out_path = cwd.join(format!("target/{}", gn_mode.clone()));
|
||||
let gn_out_dir = normalize_path(&gn_out_path);
|
||||
|
||||
// Tell Cargo when to re-run this file. We do this first, so these directives
|
||||
// can take effect even if something goes wrong later in the build process.
|
||||
println!("cargo:rerun-if-env-changed=DENO_BUILD_PATH");
|
||||
// TODO: this is obviously not appropriate here.
|
||||
println!("cargo:rerun-if-env-changed=APPVEYOR_REPO_COMMIT");
|
||||
|
||||
// This helps Rust source files locate the snapshot, source map etc.
|
||||
println!("cargo:rustc-env=GN_OUT_DIR={}", gn_out_dir);
|
||||
|
||||
// Detect if we're being invoked by the rust language server (RLS).
|
||||
// Unfortunately we can't detect whether we're being run by `cargo check`.
|
||||
let check_only = env::var_os("CARGO")
|
||||
.map(PathBuf::from)
|
||||
.as_ref()
|
||||
.and_then(|p| p.file_stem())
|
||||
.and_then(|f| f.to_str())
|
||||
.map(|s| s.starts_with("rls"))
|
||||
.unwrap_or(false);
|
||||
|
||||
if check_only {
|
||||
// Enable the 'check_only' feature, which enables some workarounds in the
|
||||
// rust source code to compile successfully without a bundle and snapshot
|
||||
println!("cargo:rustc-cfg=feature=\"check-only\"");
|
||||
}
|
||||
|
||||
Build {
|
||||
gn_out_dir,
|
||||
gn_out_path,
|
||||
check_only,
|
||||
gn_mode,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(&self, gn_target: &str) {
|
||||
if !self.gn_out_path.join("build.ninja").exists() {
|
||||
let status = Command::new("python")
|
||||
.env("DENO_BUILD_PATH", &self.gn_out_dir)
|
||||
.env("DENO_BUILD_MODE", &self.gn_mode)
|
||||
.arg("./tools/setup.py")
|
||||
.status()
|
||||
.expect("setup.py failed");
|
||||
assert!(status.success());
|
||||
}
|
||||
|
||||
// TODO(ry) call ninja directly here, not python.
|
||||
let status = Command::new("python")
|
||||
.env("DENO_BUILD_PATH", &self.gn_out_dir)
|
||||
.env("DENO_BUILD_MODE", &self.gn_mode)
|
||||
.arg("./tools/build.py")
|
||||
.arg(gn_target)
|
||||
.arg("-v")
|
||||
.status()
|
||||
.expect("build.py failed");
|
||||
assert!(status.success());
|
||||
}
|
||||
}
|
||||
|
||||
// Utility function to make a path absolute, normalizing it to use forward
|
||||
// slashes only. The returned value is an owned String, otherwise panics.
|
||||
fn normalize_path<T: AsRef<Path>>(path: T) -> String {
|
||||
path
|
||||
.as_ref()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.to_owned()
|
||||
.chars()
|
||||
.map(|c| if path::is_separator(c) { '/' } else { c })
|
||||
.collect()
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
// There is a rollup plugin that will inline any module ending with `!string`
|
||||
|
||||
// Generated default library
|
||||
import libDts from "gen/lib/lib.deno_runtime.d.ts!string";
|
||||
import libDts from "gen/cli/lib/lib.deno_runtime.d.ts!string";
|
||||
|
||||
// Static libraries
|
||||
import libEs2015Dts from "/third_party/node_modules/typescript/lib/lib.es2015.d.ts!string";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as ts from "typescript";
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import { window } from "./window";
|
||||
import { assetSourceCode } from "./assets";
|
||||
import { Console } from "./console";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import { assert } from "./util";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { sendSync } from "./dispatch";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { core } from "./core";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as errors from "./errors";
|
||||
import * as util from "./util";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { Base, ErrorKind } from "gen/msg_generated";
|
||||
export { ErrorKind } from "gen/msg_generated";
|
||||
import { Base, ErrorKind } from "gen/cli/msg_generated";
|
||||
export { ErrorKind } from "gen/cli/msg_generated";
|
||||
|
||||
/** A Deno specific error. The `kind` property is set to a specific error code
|
||||
* which can be used to in application logic.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { assert, createResolvable, notImplemented, isTypedArray } from "./util";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { sendAsync } from "./dispatch";
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as domTypes from "./dom_types";
|
||||
import { TextDecoder, TextEncoder } from "./text_encoding";
|
||||
import { DenoBlob, bytesSymbol as blobBytesSymbol } from "./blob";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
|
||||
/** A FileInfo describes a file and is returned by `stat`, `lstat`,
|
||||
* `statSync`, `lstatSync`.
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
SyncSeeker
|
||||
} from "./io";
|
||||
import * as dispatch from "./dispatch";
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import { assert } from "./util";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { sendSync } from "./dispatch";
|
||||
import { assert } from "./util";
|
||||
|
|
|
@ -16,7 +16,7 @@ import { setLocation } from "./location";
|
|||
import * as deno from "./deno";
|
||||
|
||||
// TODO(kitsonk) remove with `--types` below
|
||||
import libDts from "gen/lib/lib.deno_runtime.d.ts!string";
|
||||
import libDts from "gen/cli/lib/lib.deno_runtime.d.ts!string";
|
||||
|
||||
export default function denoMain(): void {
|
||||
const startResMsg = os.start();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
import { assert } from "./util";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { assert } from "./util";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { ReadResult, Reader, Writer, Closer } from "./io";
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import { assert, notImplemented } from "./util";
|
||||
import * as dispatch from "./dispatch";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
|
|
2
js/os.ts
2
js/os.ts
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import { core } from "./core";
|
||||
import { handleAsyncMsgFromRust, sendSync } from "./dispatch";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import { sendSync } from "./dispatch";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { assert } from "./util";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
import { assert } from "./util";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as dispatch from "./dispatch";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
|
||||
import { File, close } from "./files";
|
||||
import { ReadCloser, WriteCloser } from "./io";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
import { FileInfo, FileInfoImpl } from "./file_info";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { assert } from "./util";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { assert } from "./util";
|
||||
import { close } from "./files";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { assert } from "./util";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
import { assert } from "./util";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
import * as util from "./util";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { assert } from "./util";
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { sendAsync, sendSync } from "./dispatch";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import * as dispatch from "./dispatch";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as dispatch from "./dispatch";
|
||||
import * as msg from "gen/msg_generated";
|
||||
import * as msg from "gen/cli/msg_generated";
|
||||
import * as flatbuffers from "./flatbuffers";
|
||||
import { assert, log } from "./util";
|
||||
import { window } from "./window";
|
||||
|
|
|
@ -18,7 +18,7 @@ const typescriptPath = path.resolve(
|
|||
__dirname,
|
||||
"third_party/node_modules/typescript/lib/typescript.js"
|
||||
);
|
||||
const gnArgs = fs.readFileSync("gen/gn_args.txt", "utf-8").trim();
|
||||
const gnArgs = fs.readFileSync("gen/cli/gn_args.txt", "utf-8").trim();
|
||||
|
||||
// We will allow generated modules to be resolvable by TypeScript based on
|
||||
// the current build path
|
||||
|
@ -96,7 +96,7 @@ function resolveGenerated() {
|
|||
return {
|
||||
name: "resolve-msg-generated",
|
||||
resolveId(importee) {
|
||||
if (importee.startsWith("gen/msg_generated")) {
|
||||
if (importee.startsWith("gen/cli/msg_generated")) {
|
||||
return path.resolve(`${importee}.ts`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,17 +60,17 @@ def get_binary_sizes(build_dir):
|
|||
"deno":
|
||||
os.path.join(build_dir, "deno" + executable_suffix),
|
||||
"main.js":
|
||||
os.path.join(build_dir, "gen/bundle/main.js"),
|
||||
os.path.join(build_dir, "gen/cli/bundle/main.js"),
|
||||
"main.js.map":
|
||||
os.path.join(build_dir, "gen/bundle/main.js.map"),
|
||||
os.path.join(build_dir, "gen/cli/bundle/main.js.map"),
|
||||
"compiler.js":
|
||||
os.path.join(build_dir, "gen/bundle/compiler.js"),
|
||||
os.path.join(build_dir, "gen/cli/bundle/compiler.js"),
|
||||
"compiler.js.map":
|
||||
os.path.join(build_dir, "gen/bundle/compiler.js.map"),
|
||||
os.path.join(build_dir, "gen/cli/bundle/compiler.js.map"),
|
||||
"snapshot_deno.bin":
|
||||
os.path.join(build_dir, "gen/snapshot_deno.bin"),
|
||||
os.path.join(build_dir, "gen/cli/snapshot_deno.bin"),
|
||||
"snapshot_compiler.bin":
|
||||
os.path.join(build_dir, "gen/snapshot_compiler.bin")
|
||||
os.path.join(build_dir, "gen/cli/snapshot_compiler.bin")
|
||||
}
|
||||
sizes = {}
|
||||
for name, path in path_dict.items():
|
||||
|
|
|
@ -21,10 +21,10 @@ def qrun(cmd, env=None):
|
|||
|
||||
print "clang_format"
|
||||
qrun([clang_format_path, "-i", "-style", "Google"] +
|
||||
find_exts(["libdeno"], [".cc", ".h"]))
|
||||
find_exts(["core"], [".cc", ".h"]))
|
||||
|
||||
print "gn format"
|
||||
for fn in ["BUILD.gn", ".gn"] + find_exts(["build_extra", "libdeno"],
|
||||
for fn in ["BUILD.gn", ".gn"] + find_exts(["build_extra", "core"],
|
||||
[".gn", ".gni"]):
|
||||
qrun(["third_party/depot_tools/gn", "format", fn], env=google_env())
|
||||
|
||||
|
@ -43,6 +43,7 @@ qrun(["node", prettier, "--write", "--loglevel=error"] + ["rollup.config.js"] +
|
|||
|
||||
print "rustfmt"
|
||||
qrun([
|
||||
"third_party/rustfmt/" + platform() +
|
||||
"/rustfmt", "--config-path", rustfmt_config, "build.rs"
|
||||
"third_party/rustfmt/" + platform() + "/rustfmt",
|
||||
"--config-path",
|
||||
rustfmt_config,
|
||||
] + find_exts(["cli", "core"], [".rs"]))
|
||||
|
|
|
@ -16,7 +16,7 @@ eslint = os.path.join(third_party_path, "node_modules", "eslint", "bin",
|
|||
os.chdir(root_path)
|
||||
run([
|
||||
"python", cpplint, "--filter=-build/include_subdir",
|
||||
"--repository=libdeno", "--extensions=cc,h", "--recursive", "libdeno"
|
||||
"--repository=core/libdeno", "--extensions=cc,h", "--recursive", "core"
|
||||
])
|
||||
|
||||
run([
|
||||
|
|
|
@ -80,7 +80,7 @@ const libPreamble = `// Copyright 2018-2019 the Deno authors. All rights reserve
|
|||
`;
|
||||
|
||||
// The path to the msg_generated file relative to the build path
|
||||
const MSG_GENERATED_PATH = "/gen/msg_generated.ts";
|
||||
const MSG_GENERATED_PATH = "/gen/cli/msg_generated.ts";
|
||||
|
||||
// An array of enums we want to expose pub
|
||||
const MSG_GENERATED_ENUMS = ["ErrorKind"];
|
||||
|
|
|
@ -5,7 +5,7 @@ import { main as buildRuntimeLib } from "./build_library";
|
|||
// this is very simplistic argument parsing, just enough to integrate into
|
||||
// the build scripts, versus being very robust
|
||||
let basePath = process.cwd();
|
||||
let buildPath = path.join(basePath, "out", "debug");
|
||||
let buildPath = path.join(basePath, "target", "debug");
|
||||
let outFile = path.join(buildPath, "gen", "lib", "lib.d.ts");
|
||||
let inline: string[] = [];
|
||||
let debug = false;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
"files": [
|
||||
"js/lib.web_assembly.d.ts",
|
||||
"core/core.d.ts",
|
||||
"libdeno/libdeno.d.ts",
|
||||
"core/libdeno/libdeno.d.ts",
|
||||
"js/main.ts",
|
||||
"js/compiler.ts"
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue