diff options
author | andy finch <andyfinch7@gmail.com> | 2019-03-05 17:26:59 -0500 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-05 17:26:59 -0500 |
commit | da004fb6c8213956cf6fa608e1d732f8f75da481 (patch) | |
tree | 07154a4882f6d75e3e9d693feb3310a797929a0d /src/isolate_init.rs | |
parent | ee29ed79a7539dbc821495106da9308e6c0ef295 (diff) |
fix snapshots in gn build (#1886)
Bug introduced in 75fe80d5a4992ddad89160c2e0113a1af8d3d24a
Diffstat (limited to 'src/isolate_init.rs')
-rw-r--r-- | src/isolate_init.rs | 104 |
1 files changed, 48 insertions, 56 deletions
diff --git a/src/isolate_init.rs b/src/isolate_init.rs index c77f0c998..f025d8405 100644 --- a/src/isolate_init.rs +++ b/src/isolate_init.rs @@ -12,75 +12,67 @@ pub struct IsolateInit { } pub fn deno_isolate_init() -> IsolateInit { - if cfg!(not(feature = "check-only")) { - if cfg!(feature = "use-snapshot-init") { - let data = - include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_deno.bin")); + 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/main.js")); + #[cfg(feature = "check-only")] + let source_bytes = vec![]; - unsafe { - IsolateInit { - snapshot: Some(deno_buf::from_raw_parts(data.as_ptr(), data.len())), - init_script: None, - } - } - } else { - #[cfg(not(feature = "check-only"))] - let source_bytes = - include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/bundle/main.js")); - - #[cfg(feature = "check-only")] - let source_bytes = vec![]; + IsolateInit { + snapshot: None, + init_script: Some(IsolateInitScript { + filename: "gen/bundle/main.js".to_string(), + source: std::str::from_utf8(source_bytes).unwrap().to_string(), + }), + } + } else { + debug!("Deno isolate init with snapshots."); + #[cfg(not(feature = "check-only"))] + let data = + include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_deno.bin")); + #[cfg(feature = "check-only")] + let data = vec![]; + unsafe { IsolateInit { - snapshot: None, - init_script: Some(IsolateInitScript { - filename: "gen/bundle/main.js".to_string(), - source: std::str::from_utf8(source_bytes).unwrap().to_string(), - }), + snapshot: Some(deno_buf::from_raw_parts(data.as_ptr(), data.len())), + init_script: None, } } - } else { - IsolateInit { - snapshot: None, - init_script: None, - } } } pub fn compiler_isolate_init() -> IsolateInit { - if cfg!(not(feature = "check-only")) { - if cfg!(feature = "use-snapshot-init") { - let data = include_bytes!(concat!( - env!("GN_OUT_DIR"), - "/gen/snapshot_compiler.bin" - )); + 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")); + #[cfg(feature = "check-only")] + let source_bytes = vec![]; - unsafe { - IsolateInit { - snapshot: Some(deno_buf::from_raw_parts(data.as_ptr(), data.len())), - init_script: None, - } - } - } else { - #[cfg(not(feature = "check-only"))] - let source_bytes = - include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/bundle/compiler.js")); - - #[cfg(feature = "check-only")] - let source_bytes = vec![]; + IsolateInit { + snapshot: None, + init_script: Some(IsolateInitScript { + filename: "gen/bundle/compiler.js".to_string(), + source: std::str::from_utf8(source_bytes).unwrap().to_string(), + }), + } + } else { + debug!("Deno isolate init with snapshots."); + #[cfg(not(feature = "check-only"))] + let data = + include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_compiler.bin")); + #[cfg(feature = "check-only")] + let data = vec![]; + unsafe { IsolateInit { - snapshot: None, - init_script: Some(IsolateInitScript { - filename: "gen/bundle/compiler.js".to_string(), - source: std::str::from_utf8(source_bytes).unwrap().to_string(), - }), + snapshot: Some(deno_buf::from_raw_parts(data.as_ptr(), data.len())), + init_script: None, } } - } else { - IsolateInit { - snapshot: None, - init_script: None, - } } } |