summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml6
-rw-r--r--.travis.yml24
-rw-r--r--BUILD.gn277
-rw-r--r--Cargo.toml53
-rw-r--r--build.rs152
-rw-r--r--cli/BUILD.gn270
-rw-r--r--cli/Cargo.toml51
-rw-r--r--cli/build.rs20
-rw-r--r--cli/js_errors.rs20
-rw-r--r--cli/msg.fbs2
-rw-r--r--cli/msg.rs2
-rw-r--r--cli/startup_data.rs20
-rw-r--r--core/BUILD.gn27
-rw-r--r--core/build.rs30
-rw-r--r--core/isolate.rs10
-rw-r--r--[-rwxr-xr-x]core/libdeno.rs0
-rw-r--r--core/libdeno/BUILD.gn (renamed from libdeno/BUILD.gn)2
-rw-r--r--core/libdeno/api.cc (renamed from libdeno/api.cc)0
-rw-r--r--core/libdeno/binding.cc (renamed from libdeno/binding.cc)0
-rw-r--r--core/libdeno/deno.h (renamed from libdeno/deno.h)12
-rw-r--r--core/libdeno/exceptions.cc (renamed from libdeno/exceptions.cc)0
-rw-r--r--core/libdeno/exceptions.h (renamed from libdeno/exceptions.h)0
-rw-r--r--core/libdeno/file_util.cc (renamed from libdeno/file_util.cc)0
-rw-r--r--core/libdeno/file_util.h (renamed from libdeno/file_util.h)0
-rw-r--r--core/libdeno/file_util_test.cc (renamed from libdeno/file_util_test.cc)0
-rw-r--r--core/libdeno/internal.h (renamed from libdeno/internal.h)4
-rw-r--r--core/libdeno/libdeno.d.ts (renamed from libdeno/libdeno.d.ts)0
-rw-r--r--core/libdeno/libdeno_test.cc (renamed from libdeno/libdeno_test.cc)0
-rw-r--r--core/libdeno/libdeno_test.js (renamed from libdeno/libdeno_test.js)4
-rw-r--r--core/libdeno/modules.cc (renamed from libdeno/modules.cc)0
-rw-r--r--core/libdeno/modules_test.cc (renamed from libdeno/modules_test.cc)0
-rw-r--r--core/libdeno/snapshot_creator.cc (renamed from libdeno/snapshot_creator.cc)0
-rw-r--r--core/libdeno/test.cc (renamed from libdeno/test.cc)0
-rw-r--r--core/libdeno/test.h (renamed from libdeno/test.h)0
-rw-r--r--deno.gni (renamed from libdeno/deno.gni)11
-rw-r--r--gn.rs110
-rw-r--r--js/assets.ts2
-rw-r--r--js/chmod.ts2
-rw-r--r--js/compiler.ts2
-rw-r--r--js/copy_file.ts2
-rw-r--r--js/dir.ts2
-rw-r--r--js/dispatch.ts2
-rw-r--r--js/errors.ts4
-rw-r--r--js/fetch.ts2
-rw-r--r--js/file_info.ts2
-rw-r--r--js/files.ts2
-rw-r--r--js/format_error.ts2
-rw-r--r--js/main.ts2
-rw-r--r--js/make_temp_dir.ts2
-rw-r--r--js/metrics.ts2
-rw-r--r--js/mkdir.ts2
-rw-r--r--js/net.ts2
-rw-r--r--js/os.ts2
-rw-r--r--js/performance.ts2
-rw-r--r--js/permissions.ts2
-rw-r--r--js/process.ts2
-rw-r--r--js/read_dir.ts2
-rw-r--r--js/read_link.ts2
-rw-r--r--js/remove.ts2
-rw-r--r--js/rename.ts2
-rw-r--r--js/repl.ts2
-rw-r--r--js/resources.ts2
-rw-r--r--js/stat.ts2
-rw-r--r--js/symlink.ts2
-rw-r--r--js/timers.ts2
-rw-r--r--js/truncate.ts2
-rw-r--r--js/workers.ts2
-rw-r--r--rollup.config.js4
-rwxr-xr-xtools/benchmark.py12
-rwxr-xr-xtools/format.py9
-rwxr-xr-xtools/lint.py2
-rw-r--r--tools/ts_library_builder/build_library.ts2
-rw-r--r--tools/ts_library_builder/main.ts2
-rw-r--r--tsconfig.json2
74 files changed, 603 insertions, 601 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 70d26f773..60f1490fd 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -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.
diff --git a/.travis.yml b/.travis.yml
index 2e5991d93..8f23f11ba 100644
--- a/.travis.yml
+++ b/.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
diff --git a/BUILD.gn b/BUILD.gn
index bde36a7f2..204d88372 100644
--- a/BUILD.gn
+++ b/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) ]
-}
diff --git a/Cargo.toml b/Cargo.toml
index 7a0046bbc..cbd245a50 100644
--- a/Cargo.toml
+++ b/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"
diff --git a/build.rs b/build.rs
deleted file mode 100644
index 8dbbf0955..000000000
--- a/build.rs
+++ /dev/null
@@ -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()
-}
diff --git a/cli/BUILD.gn b/cli/BUILD.gn
new file mode 100644
index 000000000..f6000a08f
--- /dev/null
+++ b/cli/BUILD.gn
@@ -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) ]
+}
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
new file mode 100644
index 000000000..c58558887
--- /dev/null
+++ b/cli/Cargo.toml
@@ -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"
diff --git a/cli/build.rs b/cli/build.rs
new file mode 100644
index 000000000..4d50d8a5f
--- /dev/null
+++ b/cli/build.rs
@@ -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);
+}
diff --git a/cli/js_errors.rs b/cli/js_errors.rs
index 1cb9cb3a1..b478849d2 100644
--- a/cli/js_errors.rs
+++ b/cli/js_errors.rs
@@ -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/cli/bundle/main.js" => Some(
+ include_bytes!(concat!(
+ env!("GN_OUT_DIR"),
+ "/gen/cli/bundle/main.js.map"
+ )).to_vec(),
),
- "gen/bundle/compiler.js" => Some(
+ "gen/cli/bundle/compiler.js" => Some(
include_bytes!(concat!(
env!("GN_OUT_DIR"),
- "/gen/bundle/compiler.js.map"
+ "/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,
diff --git a/cli/msg.fbs b/cli/msg.fbs
index e6b860908..45f940f7d 100644
--- a/cli/msg.fbs
+++ b/cli/msg.fbs
@@ -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 {
diff --git a/cli/msg.rs b/cli/msg.rs
index 080f39de8..d4f62604c 100644
--- a/cli/msg.rs
+++ b/cli/msg.rs
@@ -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 {
diff --git a/cli/startup_data.rs b/cli/startup_data.rs
index 6e636e579..747e8b11d 100644
--- a/cli/startup_data.rs
+++ b/cli/startup_data.rs
@@ -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![];
diff --git a/core/BUILD.gn b/core/BUILD.gn
index c14820637..3439fa25d 100644
--- a/core/BUILD.gn
+++ b/core/BUILD.gn
@@ -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
}
diff --git a/core/build.rs b/core/build.rs
new file mode 100644
index 000000000..0cb775e5c
--- /dev/null
+++ b/core/build.rs
@@ -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");
+}
diff --git a/core/isolate.rs b/core/isolate.rs
index f8ada23d4..a8ee22d47 100644
--- a/core/isolate.rs
+++ b/core/isolate.rs
@@ -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) => {
diff --git a/core/libdeno.rs b/core/libdeno.rs
index 72003a372..72003a372 100755..100644
--- a/core/libdeno.rs
+++ b/core/libdeno.rs
diff --git a/libdeno/BUILD.gn b/core/libdeno/BUILD.gn
index 6cea30b2a..eeec14eb5 100644
--- a/libdeno/BUILD.gn
+++ b/core/libdeno/BUILD.gn
@@ -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.
diff --git a/libdeno/api.cc b/core/libdeno/api.cc
index fa1fe92f9..fa1fe92f9 100644
--- a/libdeno/api.cc
+++ b/core/libdeno/api.cc
diff --git a/libdeno/binding.cc b/core/libdeno/binding.cc
index ab633f46d..ab633f46d 100644
--- a/libdeno/binding.cc
+++ b/core/libdeno/binding.cc
diff --git a/libdeno/deno.h b/core/libdeno/deno.h
index 37a302cad..f3902985e 100644
--- a/libdeno/deno.h
+++ b/core/libdeno/deno.h
@@ -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
diff --git a/libdeno/exceptions.cc b/core/libdeno/exceptions.cc
index 85f0ca340..85f0ca340 100644
--- a/libdeno/exceptions.cc
+++ b/core/libdeno/exceptions.cc
diff --git a/libdeno/exceptions.h b/core/libdeno/exceptions.h
index e07ff183a..e07ff183a 100644
--- a/libdeno/exceptions.h
+++ b/core/libdeno/exceptions.h
diff --git a/libdeno/file_util.cc b/core/libdeno/file_util.cc
index 256f4f257..256f4f257 100644
--- a/libdeno/file_util.cc
+++ b/core/libdeno/file_util.cc
diff --git a/libdeno/file_util.h b/core/libdeno/file_util.h
index 0177f2c94..0177f2c94 100644
--- a/libdeno/file_util.h
+++ b/core/libdeno/file_util.h
diff --git a/libdeno/file_util_test.cc b/core/libdeno/file_util_test.cc
index 80c878044..80c878044 100644
--- a/libdeno/file_util_test.cc
+++ b/core/libdeno/file_util_test.cc
diff --git a/libdeno/internal.h b/core/libdeno/internal.h
index 54e845965..71cf731b6 100644
--- a/libdeno/internal.h
+++ b/core/libdeno/internal.h
@@ -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);
diff --git a/libdeno/libdeno.d.ts b/core/libdeno/libdeno.d.ts
index 1bc7367d9..1bc7367d9 100644
--- a/libdeno/libdeno.d.ts
+++ b/core/libdeno/libdeno.d.ts
diff --git a/libdeno/libdeno_test.cc b/core/libdeno/libdeno_test.cc
index 8949e7f4a..8949e7f4a 100644
--- a/libdeno/libdeno_test.cc
+++ b/core/libdeno/libdeno_test.cc
diff --git a/libdeno/libdeno_test.js b/core/libdeno/libdeno_test.js
index b0040025d..156af1e47 100644
--- a/libdeno/libdeno_test.js
+++ b/core/libdeno/libdeno_test.js
@@ -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 = () => {
diff --git a/libdeno/modules.cc b/core/libdeno/modules.cc
index 0b408aec8..0b408aec8 100644
--- a/libdeno/modules.cc
+++ b/core/libdeno/modules.cc
diff --git a/libdeno/modules_test.cc b/core/libdeno/modules_test.cc
index 9f9228430..9f9228430 100644
--- a/libdeno/modules_test.cc
+++ b/core/libdeno/modules_test.cc
diff --git a/libdeno/snapshot_creator.cc b/core/libdeno/snapshot_creator.cc
index 19098392d..19098392d 100644
--- a/libdeno/snapshot_creator.cc
+++ b/core/libdeno/snapshot_creator.cc
diff --git a/libdeno/test.cc b/core/libdeno/test.cc
index 1340fe8c3..1340fe8c3 100644
--- a/libdeno/test.cc
+++ b/core/libdeno/test.cc
diff --git a/libdeno/test.h b/core/libdeno/test.h
index 2f7c32384..2f7c32384 100644
--- a/libdeno/test.h
+++ b/core/libdeno/test.h
diff --git a/libdeno/deno.gni b/deno.gni
index 90d61240b..a260edd11 100644
--- a/libdeno/deno.gni
+++ b/deno.gni
@@ -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 = [
diff --git a/gn.rs b/gn.rs
new file mode 100644
index 000000000..5d27b8bb0
--- /dev/null
+++ b/gn.rs
@@ -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()
+}
diff --git a/js/assets.ts b/js/assets.ts
index 5f1790646..6e576c2d1 100644
--- a/js/assets.ts
+++ b/js/assets.ts
@@ -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";
diff --git a/js/chmod.ts b/js/chmod.ts
index 3b14ef5bc..b26f78528 100644
--- a/js/chmod.ts
+++ b/js/chmod.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
diff --git a/js/compiler.ts b/js/compiler.ts
index 8be78935f..0f7070fd2 100644
--- a/js/compiler.ts
+++ b/js/compiler.ts
@@ -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";
diff --git a/js/copy_file.ts b/js/copy_file.ts
index a7792d588..a6ff9439e 100644
--- a/js/copy_file.ts
+++ b/js/copy_file.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
diff --git a/js/dir.ts b/js/dir.ts
index 8da72c16f..ccbbd2458 100644
--- a/js/dir.ts
+++ b/js/dir.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 { assert } from "./util";
import * as flatbuffers from "./flatbuffers";
import { sendSync } from "./dispatch";
diff --git a/js/dispatch.ts b/js/dispatch.ts
index 3ca0cd799..528cf320c 100644
--- a/js/dispatch.ts
+++ b/js/dispatch.ts
@@ -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";
diff --git a/js/errors.ts b/js/errors.ts
index cefa4a863..42cff60db 100644
--- a/js/errors.ts
+++ b/js/errors.ts
@@ -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.
diff --git a/js/fetch.ts b/js/fetch.ts
index 355535dfe..e4262ea0a 100644
--- a/js/fetch.ts
+++ b/js/fetch.ts
@@ -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";
diff --git a/js/file_info.ts b/js/file_info.ts
index deaafe5ea..0026d22c8 100644
--- a/js/file_info.ts
+++ b/js/file_info.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";
/** A FileInfo describes a file and is returned by `stat`, `lstat`,
* `statSync`, `lstatSync`.
diff --git a/js/files.ts b/js/files.ts
index 9da9fbe0a..3a0297566 100644
--- a/js/files.ts
+++ b/js/files.ts
@@ -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";
diff --git a/js/format_error.ts b/js/format_error.ts
index ebc579355..7cdbd72c3 100644
--- a/js/format_error.ts
+++ b/js/format_error.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 * as flatbuffers from "./flatbuffers";
import { sendSync } from "./dispatch";
import { assert } from "./util";
diff --git a/js/main.ts b/js/main.ts
index 887d6b3c2..e7f7e284e 100644
--- a/js/main.ts
+++ b/js/main.ts
@@ -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();
diff --git a/js/make_temp_dir.ts b/js/make_temp_dir.ts
index dc04522ee..ff754a3a8 100644
--- a/js/make_temp_dir.ts
+++ b/js/make_temp_dir.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
import { assert } from "./util";
diff --git a/js/metrics.ts b/js/metrics.ts
index c4ba14c7d..f00c1308d 100644
--- a/js/metrics.ts
+++ b/js/metrics.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 * as flatbuffers from "./flatbuffers";
import { assert } from "./util";
import * as dispatch from "./dispatch";
diff --git a/js/mkdir.ts b/js/mkdir.ts
index 784d891f9..36a2b6622 100644
--- a/js/mkdir.ts
+++ b/js/mkdir.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
diff --git a/js/net.ts b/js/net.ts
index 0b56a4c30..e982d9455 100644
--- a/js/net.ts
+++ b/js/net.ts
@@ -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";
diff --git a/js/os.ts b/js/os.ts
index 0ad107bf1..3ef75c003 100644
--- a/js/os.ts
+++ b/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";
diff --git a/js/performance.ts b/js/performance.ts
index 73378b15c..b4d0fa43b 100644
--- a/js/performance.ts
+++ b/js/performance.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 { sendSync } from "./dispatch";
import * as flatbuffers from "./flatbuffers";
import { assert } from "./util";
diff --git a/js/permissions.ts b/js/permissions.ts
index f4fe6826f..ded8ac305 100644
--- a/js/permissions.ts
+++ b/js/permissions.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
import { assert } from "./util";
diff --git a/js/process.ts b/js/process.ts
index 8ce83477a..7e31a1361 100644
--- a/js/process.ts
+++ b/js/process.ts
@@ -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";
diff --git a/js/read_dir.ts b/js/read_dir.ts
index 2515a61c6..9aa7c3375 100644
--- a/js/read_dir.ts
+++ b/js/read_dir.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
import { FileInfo, FileInfoImpl } from "./file_info";
diff --git a/js/read_link.ts b/js/read_link.ts
index b63fdd841..0e1a950f3 100644
--- a/js/read_link.ts
+++ b/js/read_link.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 * as flatbuffers from "./flatbuffers";
import { assert } from "./util";
import * as dispatch from "./dispatch";
diff --git a/js/remove.ts b/js/remove.ts
index 1c9df6830..0bbfd913b 100644
--- a/js/remove.ts
+++ b/js/remove.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
diff --git a/js/rename.ts b/js/rename.ts
index 9d475f7e9..2bb83e966 100644
--- a/js/rename.ts
+++ b/js/rename.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
diff --git a/js/repl.ts b/js/repl.ts
index 068501873..350aff867 100644
--- a/js/repl.ts
+++ b/js/repl.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 * as flatbuffers from "./flatbuffers";
import { assert } from "./util";
import { close } from "./files";
diff --git a/js/resources.ts b/js/resources.ts
index 2cabd26dc..f78fd0360 100644
--- a/js/resources.ts
+++ b/js/resources.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 * as flatbuffers from "./flatbuffers";
import { assert } from "./util";
import * as dispatch from "./dispatch";
diff --git a/js/stat.ts b/js/stat.ts
index 9f99ab441..ed3e17d19 100644
--- a/js/stat.ts
+++ b/js/stat.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
import { assert } from "./util";
diff --git a/js/symlink.ts b/js/symlink.ts
index 74c1f74fe..f260620d6 100644
--- a/js/symlink.ts
+++ b/js/symlink.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
import * as util from "./util";
diff --git a/js/timers.ts b/js/timers.ts
index 4089d5f8b..e372f88c2 100644
--- a/js/timers.ts
+++ b/js/timers.ts
@@ -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";
diff --git a/js/truncate.ts b/js/truncate.ts
index 2d700ab5d..c721404a1 100644
--- a/js/truncate.ts
+++ b/js/truncate.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 * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
diff --git a/js/workers.ts b/js/workers.ts
index b2f4231c4..bdfbed640 100644
--- a/js/workers.ts
+++ b/js/workers.ts
@@ -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";
diff --git a/rollup.config.js b/rollup.config.js
index ad3d9059b..0907ba737 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -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`);
}
}
diff --git a/tools/benchmark.py b/tools/benchmark.py
index cf2bc4ff7..772e35d40 100755
--- a/tools/benchmark.py
+++ b/tools/benchmark.py
@@ -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():
diff --git a/tools/format.py b/tools/format.py
index bc6a3b532..b0d3bc5e4 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -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"]))
diff --git a/tools/lint.py b/tools/lint.py
index 4ce7900d1..6f6ba8dfe 100755
--- a/tools/lint.py
+++ b/tools/lint.py
@@ -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([
diff --git a/tools/ts_library_builder/build_library.ts b/tools/ts_library_builder/build_library.ts
index c2d0ef109..b0d438531 100644
--- a/tools/ts_library_builder/build_library.ts
+++ b/tools/ts_library_builder/build_library.ts
@@ -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"];
diff --git a/tools/ts_library_builder/main.ts b/tools/ts_library_builder/main.ts
index ed692d03a..54a659d01 100644
--- a/tools/ts_library_builder/main.ts
+++ b/tools/ts_library_builder/main.ts
@@ -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;
diff --git a/tsconfig.json b/tsconfig.json
index e79023de3..500b0fcd0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -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"
]