Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/hyperlight-js/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ fn bundle_runtime() {
// which normalises a relative path to absolute and requires the target file
// to already exist. An absolute path is recommended to avoid any ambiguity
// about the base directory.
let js_runtime_resource = match env::var("HYPERLIGHT_JS_RUNTIME_PATH") {
let selected_runtime = match env::var("HYPERLIGHT_JS_RUNTIME_PATH") {
Ok(path) if !path.trim().is_empty() => {
let canonical = PathBuf::from(&path)
.canonicalize()
Expand All @@ -237,6 +237,9 @@ fn bundle_runtime() {
};

let out_dir = env::var_os("OUT_DIR").unwrap();
let js_runtime_resource = Path::new(&out_dir).join("hyperlight-js-runtime");
fs::copy(&selected_runtime, &js_runtime_resource)
.expect("Failed to copy JS runtime to OUT_DIR");
let dest_path = Path::new(&out_dir).join("host_resource.rs");
let contents =
format!("pub (super) static JSRUNTIME: &[u8] = include_bytes!({js_runtime_resource:?});");
Expand Down
Loading