summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-12-13 19:45:53 +0100
committerGitHub <noreply@github.com>2020-12-13 19:45:53 +0100
commit2e74f164b6dcf0ecbf8dd38fba9fae550d784bd0 (patch)
tree61abe8e09d5331ace5d9de529f0e2737a8e05dbb /cli/build.rs
parent84ef9bd21fb48fb6b5fbc8dafc3de9f361bade3b (diff)
refactor: deno_runtime crate (#8640)
This commit moves Deno JS runtime, ops, permissions and inspector implementation to new "deno_runtime" crate located in "runtime/" directory. Details in "runtime/README.md". Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs17
1 files changed, 2 insertions, 15 deletions
diff --git a/cli/build.rs b/cli/build.rs
index b0088a9d8..4be71bb9e 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -13,14 +13,13 @@ use std::env;
use std::path::Path;
use std::path::PathBuf;
+// TODO(bartlomieju): this module contains a lot of duplicated
+// logic with `runtime/build.rs`, factor out to `deno_core`.
fn create_snapshot(
mut js_runtime: JsRuntime,
snapshot_path: &Path,
files: Vec<PathBuf>,
) {
- deno_web::init(&mut js_runtime);
- deno_fetch::init(&mut js_runtime);
- deno_crypto::init(&mut js_runtime);
// TODO(nayeemrmn): https://github.com/rust-lang/cargo/issues/3946 to get the
// workspace root.
let display_root = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap();
@@ -43,14 +42,6 @@ fn create_snapshot(
println!("Snapshot written to: {} ", snapshot_path.display());
}
-fn create_runtime_snapshot(snapshot_path: &Path, files: Vec<PathBuf>) {
- let js_runtime = JsRuntime::new(RuntimeOptions {
- will_snapshot: true,
- ..Default::default()
- });
- create_snapshot(js_runtime, snapshot_path, files);
-}
-
#[derive(Debug, Deserialize)]
struct LoadArgs {
/// The fully qualified specifier that should be loaded.
@@ -265,12 +256,8 @@ fn main() {
let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());
// Main snapshot
- let runtime_snapshot_path = o.join("CLI_SNAPSHOT.bin");
let compiler_snapshot_path = o.join("COMPILER_SNAPSHOT.bin");
- let js_files = get_js_files("rt");
- create_runtime_snapshot(&runtime_snapshot_path, js_files);
-
let js_files = get_js_files("tsc");
create_compiler_snapshot(&compiler_snapshot_path, js_files, &c);