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

fix: revert back to using native cp #569

Closed
Show file tree
Hide file tree
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
38 changes: 31 additions & 7 deletions packages/backend-embed/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use anyhow::*;
use fs_extra::dir::{copy, CopyOptions};
use merkle_hash::MerkleTree;
use std::fs;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -30,11 +29,33 @@ async fn main() -> Result<()> {
}

// 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()))?;
// TODO: This breaks deno check``
// 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()
// )
// })?;

let status = std::process::Command::new("cp")
.arg("-R")
.arg(&backend_path)
.arg(&out_backend_path)
.status()
.with_context(|| {
format!(
"failed to copy directory from {} to {}",
backend_path.display(),
out_backend_path.display()
)
})?;
if !status.success() {
return Err(anyhow!("cp command failed"));
}

// Install deno
let deno_dir = Path::new(&out_dir).join("deno");
Expand All @@ -61,7 +82,10 @@ async fn main() -> Result<()> {
.arg("task")
.arg("prepare")
// Deno runs out of memory on Windows
.env("DENO_V8_FLAGS", "--max-heap-size=8192,--max-old-space-size=8192")
.env(
"DENO_V8_FLAGS",
"--max-heap-size=8192,--max-old-space-size=8192",
)
.current_dir(&out_backend_path)
.status()?;
if !status.success() {
Expand Down
15 changes: 5 additions & 10 deletions packages/backend/deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@
"check": "deno check cli/**/*.ts toolchain/**/*.ts runtime/**/*.ts",

// Remove old vendored files in order to ensure a consistent cache.
//
// The deno.lock needs to be cleared to prevent from caching unused
// dependencies.
//
// strip_cross_platform removes files that are not cross-platform & deletes
// broken symlinks.
"cache": "deno task cache:purge && deno task cache:download",
"cache:purge": "rm -rf deno.lock vendor node_modules",
"cache:purge": "rm -rf vendor node_modules",
"cache:download": "deno cache cli/tasks/**/*.ts",

// Cache must be the last step in order to prevent unwanted extra cached
// files
"prepare": "deno task format && deno task check && deno task cache",
// Clear cache first in order to have as clean an environment as possible.
// Cache must be the last step in order to prevent unwanted extra cached
// files. Need to download cache before check in order to prevent error.
"prepare": "deno clean && deno task format && deno task check && deno task cache",

"lint": "deno lint cli/**/*.ts toolchain/**/*.ts runtime/**/*.ts",
"lint:fix": "deno lint cli/**/*.ts toolchain/**/*.ts runtime/**/*.ts",
Expand Down
49 changes: 48 additions & 1 deletion packages/backend/deno.lock

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

Loading
Loading