diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-05-31 08:19:06 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 08:19:06 -0600 |
commit | 8e84dc0139055db8c84ad28723114d343982a8f7 (patch) | |
tree | 93238866035949af70c32769e651f0f3fae5cf83 /cli/build.rs | |
parent | d0efd040c79021958a1e83caa56572c0401ca1f2 (diff) |
chore(core): Split JsRuntimeForSnapshot from JsRuntime (#19308)
This cleans up `JsRuntime` a bit more:
* We no longer print cargo's rerun-if-changed messages in `JsRuntime` --
those are printed elsewhere
* We no longer special case the OwnedIsolate for snapshots. Instead we
make use of an inner object that has the `Drop` impl and allows us to
`std::mem::forget` it if we need to extract the isolate for a snapshot
* The `snapshot` method is only available on `JsRuntimeForSnapshot`, not
`JsRuntime`.
* `OpState` construction is slightly cleaner, though I'd still like to
extract more
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/build.rs')
-rw-r--r-- | cli/build.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/build.rs b/cli/build.rs index 72b8e7818..5ff86fa20 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -262,7 +262,7 @@ mod ts { ) .unwrap(); - create_snapshot(CreateSnapshotOptions { + let output = create_snapshot(CreateSnapshotOptions { cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), snapshot_path, startup_snapshot: None, @@ -289,6 +289,9 @@ mod ts { })), snapshot_module_load_cb: None, }); + for path in output.files_loaded_during_snapshot { + println!("cargo:rerun-if-changed={}", path.display()); + } } pub(crate) fn version() -> String { @@ -326,7 +329,8 @@ deno_core::extension!( } ); -fn create_cli_snapshot(snapshot_path: PathBuf) { +#[must_use = "The files listed by create_cli_snapshot should be printed as 'cargo:rerun-if-changed' lines"] +fn create_cli_snapshot(snapshot_path: PathBuf) -> CreateSnapshotOutput { // NOTE(bartlomieju): ordering is important here, keep it in sync with // `runtime/worker.rs`, `runtime/web_worker.rs` and `runtime/build.rs`! let fs = Arc::new(deno_fs::RealFs); @@ -481,7 +485,10 @@ fn main() { ts::create_compiler_snapshot(compiler_snapshot_path, &c); let cli_snapshot_path = o.join("CLI_SNAPSHOT.bin"); - create_cli_snapshot(cli_snapshot_path); + let output = create_cli_snapshot(cli_snapshot_path); + for path in output.files_loaded_during_snapshot { + println!("cargo:rerun-if-changed={}", path.display()) + } #[cfg(target_os = "windows")] { |