mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Remove unused code
This commit is contained in:
parent
54e78e8fd4
commit
90f517712a
33 changed files with 24 additions and 1300 deletions
|
@ -4,7 +4,7 @@ extern crate roc_load;
|
|||
extern crate roc_module;
|
||||
extern crate tempfile;
|
||||
|
||||
use roc_command_utils::{cargo, root_dir};
|
||||
use roc_command_utils::root_dir;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
@ -36,60 +36,6 @@ pub fn path_to_binary(binary_name: &str) -> PathBuf {
|
|||
path
|
||||
}
|
||||
|
||||
// If we don't already have a /target/release/roc, build it!
|
||||
pub fn build_roc_bin_cached() -> PathBuf {
|
||||
let roc_binary_path = path_to_roc_binary();
|
||||
|
||||
if !roc_binary_path.exists() {
|
||||
build_roc_bin(&[]);
|
||||
}
|
||||
|
||||
roc_binary_path
|
||||
}
|
||||
|
||||
pub fn build_roc_bin(extra_args: &[&str]) -> PathBuf {
|
||||
let roc_binary_path = path_to_roc_binary();
|
||||
|
||||
// Remove the /target/release/roc part
|
||||
let root_project_dir = roc_binary_path
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap();
|
||||
|
||||
// cargo build --bin roc
|
||||
// (with --release iff the test is being built with --release)
|
||||
let mut args = if cfg!(debug_assertions) {
|
||||
vec!["build", "--bin", "roc"]
|
||||
} else {
|
||||
vec!["build", "--release", "--bin", "roc"]
|
||||
};
|
||||
|
||||
args.extend(extra_args);
|
||||
|
||||
let mut cargo_cmd = cargo();
|
||||
|
||||
cargo_cmd.current_dir(root_project_dir).args(&args);
|
||||
|
||||
let cargo_cmd_str = format!("{cargo_cmd:?}");
|
||||
|
||||
let cargo_output = cargo_cmd.output().unwrap();
|
||||
|
||||
if !cargo_output.status.success() {
|
||||
panic!(
|
||||
"The following cargo command failed:\n\n {}\n\n stdout was:\n\n {}\n\n stderr was:\n\n {}\n",
|
||||
cargo_cmd_str,
|
||||
String::from_utf8(cargo_output.stdout).unwrap(),
|
||||
String::from_utf8(cargo_output.stderr).unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
roc_binary_path
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn dir_from_root(dir_name: &str) -> PathBuf {
|
||||
let mut path = root_dir();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue