mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
clean up path usage
This commit is contained in:
parent
356875a851
commit
479caaf0a9
3 changed files with 36 additions and 46 deletions
|
@ -643,17 +643,17 @@ pub fn build_swift_host_native(
|
|||
pub fn rebuild_host(
|
||||
opt_level: OptLevel,
|
||||
target: &Triple,
|
||||
host_input_path: &Path,
|
||||
platform_main_roc: &Path,
|
||||
shared_lib_path: Option<&Path>,
|
||||
) -> PathBuf {
|
||||
let c_host_src = host_input_path.with_file_name("host.c");
|
||||
let c_host_dest = host_input_path.with_file_name("c_host.o");
|
||||
let zig_host_src = host_input_path.with_file_name("host.zig");
|
||||
let rust_host_src = host_input_path.with_file_name("host.rs");
|
||||
let rust_host_dest = host_input_path.with_file_name("rust_host.o");
|
||||
let cargo_host_src = host_input_path.with_file_name("Cargo.toml");
|
||||
let swift_host_src = host_input_path.with_file_name("host.swift");
|
||||
let swift_host_header_src = host_input_path.with_file_name("host.h");
|
||||
let c_host_src = platform_main_roc.with_file_name("host.c");
|
||||
let c_host_dest = platform_main_roc.with_file_name("c_host.o");
|
||||
let zig_host_src = platform_main_roc.with_file_name("host.zig");
|
||||
let rust_host_src = platform_main_roc.with_file_name("host.rs");
|
||||
let rust_host_dest = platform_main_roc.with_file_name("rust_host.o");
|
||||
let cargo_host_src = platform_main_roc.with_file_name("Cargo.toml");
|
||||
let swift_host_src = platform_main_roc.with_file_name("host.swift");
|
||||
let swift_host_header_src = platform_main_roc.with_file_name("host.h");
|
||||
|
||||
let os = roc_target::OperatingSystem::from(target.operating_system);
|
||||
let executable_extension = match os {
|
||||
|
@ -664,16 +664,16 @@ pub fn rebuild_host(
|
|||
|
||||
let host_dest = if matches!(target.architecture, Architecture::Wasm32) {
|
||||
if matches!(opt_level, OptLevel::Development) {
|
||||
host_input_path.with_extension("o")
|
||||
platform_main_roc.with_extension("o")
|
||||
} else {
|
||||
host_input_path.with_extension("bc")
|
||||
platform_main_roc.with_extension("bc")
|
||||
}
|
||||
} else if shared_lib_path.is_some() {
|
||||
host_input_path
|
||||
platform_main_roc
|
||||
.with_file_name("dynhost")
|
||||
.with_extension(executable_extension)
|
||||
} else {
|
||||
host_input_path.with_file_name(legacy_host_filename(target).unwrap())
|
||||
platform_main_roc.with_file_name(legacy_host_filename(target).unwrap())
|
||||
};
|
||||
|
||||
let env_path = env::var("PATH").unwrap_or_else(|_| "".to_string());
|
||||
|
@ -750,7 +750,7 @@ pub fn rebuild_host(
|
|||
run_build_command(zig_cmd, "host.zig", 0);
|
||||
} else if cargo_host_src.exists() {
|
||||
// Compile and link Cargo.toml, if it exists
|
||||
let cargo_dir = host_input_path.parent().unwrap();
|
||||
let cargo_dir = platform_main_roc.parent().unwrap();
|
||||
|
||||
let cargo_out_dir = cargo_dir.join("target").join(
|
||||
if matches!(opt_level, OptLevel::Optimize | OptLevel::Size) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue