Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
fix(toolchain): fix backend-embed build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Oct 7, 2024
1 parent 1e7701a commit c76c8c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/backend-embed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tokio = { version = "1.40.0", default-features = false, features = ["fs", "rt-mu

[build-dependencies]
anyhow = "1.0"
fs_extra = "1.3.0"
merkle_hash = "3.7.0"
rivet-deno-embed = { path = "../deno-embed", features = ["ignore-override-target"] }
sha2 = "0.10.8"
Expand Down
19 changes: 9 additions & 10 deletions packages/backend-embed/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anyhow::*;
use fs_extra::dir::{copy, CopyOptions};
use merkle_hash::MerkleTree;
use std::fs;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -28,16 +29,12 @@ async fn main() -> Result<()> {
fs::remove_dir_all(&out_backend_path).context("fs::remove_dir_all")?;
}

// TODO: Use native copy dir
let status = std::process::Command::new("cp")
.arg("-R")
.arg(&backend_path)
.arg(&out_backend_path)
.status()
.context("Failed to execute cp command")?;
if !status.success() {
return Err(anyhow!("cp command failed"));
}
// Copy backend directory to out_dir
let mut copy_options = CopyOptions::new();
copy_options.overwrite = true;
copy_options.copy_inside = true;
copy(&backend_path, &out_backend_path, &copy_options)
.with_context(|| format!("failed to copy directory from {} to {}", backend_path.display(), out_backend_path.display()))?;

// Install deno
let deno_dir = Path::new(&out_dir).join("deno");
Expand All @@ -63,6 +60,8 @@ async fn main() -> Result<()> {
let status = Command::new(&deno_exec.executable_path)
.arg("task")
.arg("prepare")
// Deno runs out of memory on Windows
.env("DENO_V8_FLAGS", "--max-heap-size=8192,--max-old-space-size=8192")
.current_dir(&out_backend_path)
.status()?;
if !status.success() {
Expand Down

0 comments on commit c76c8c8

Please sign in to comment.