mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 15:59:20 +03:00
Fix regression on printing "Rebuilding platform…"
This commit is contained in:
parent
39792bf144
commit
2eb9531817
@ -67,7 +67,7 @@ pub fn build_file<'a>(
|
||||
emit_timings: bool,
|
||||
link_type: LinkType,
|
||||
linking_strategy: LinkingStrategy,
|
||||
prebuilt: bool,
|
||||
prebuilt_requested: bool,
|
||||
threading: Threading,
|
||||
wasm_dev_stack_bytes: Option<u32>,
|
||||
roc_cache_dir: RocCacheDir<'_>,
|
||||
@ -112,6 +112,9 @@ pub fn build_file<'a>(
|
||||
}
|
||||
};
|
||||
|
||||
// For example, if we're loading the platform from a URL, it's automatically prebuilt
|
||||
// even if the --prebuilt-platform=true CLI flag wasn't set.
|
||||
let is_prebuilt = prebuilt_requested || loaded.uses_prebuilt_platform;
|
||||
let (app_extension, extension, host_filename) = {
|
||||
use roc_target::OperatingSystem::*;
|
||||
|
||||
@ -183,12 +186,19 @@ pub fn build_file<'a>(
|
||||
};
|
||||
|
||||
// We don't need to spawn a rebuild thread when using a prebuilt host.
|
||||
let rebuild_thread = if prebuilt {
|
||||
let rebuild_thread = if is_prebuilt {
|
||||
if !preprocessed_host_path.exists() {
|
||||
if prebuilt_requested {
|
||||
eprintln!(
|
||||
"\nBecause I was run with --prebuilt-platform=true, I was expecting this file to exist:\n\n {}\n\nHowever, it was not there!\n\nIf you have the platform's source code locally, you may be able to regenerate it by re-running this command with --prebuilt-platform=false\n",
|
||||
"\nBecause I was run with --prebuilt-platform=true, I was expecting this file to exist:\n\n {}\n\nHowever, it was not there!\n\nIf you have the platform's source code locally, you may be able to generate it by re-running this command with --prebuilt-platform=false\n",
|
||||
preprocessed_host_path.to_string_lossy()
|
||||
);
|
||||
} else {
|
||||
eprintln!(
|
||||
"\nI was expecting this file to exist:\n\n {}\n\nHowever, it was not there!\n\nIf you have the platform's source code locally, you may be able to generate it by re-running this command with --prebuilt-platform=false\n",
|
||||
preprocessed_host_path.to_string_lossy()
|
||||
);
|
||||
}
|
||||
|
||||
std::process::exit(1);
|
||||
}
|
||||
@ -275,7 +285,8 @@ pub fn build_file<'a>(
|
||||
let rebuild_duration = rebuild_thread
|
||||
.join()
|
||||
.expect("Failed to (re)build platform.");
|
||||
if emit_timings && !prebuilt {
|
||||
|
||||
if emit_timings && !is_prebuilt {
|
||||
println!(
|
||||
"Finished rebuilding the platform in {} ms\n",
|
||||
rebuild_duration
|
||||
@ -312,7 +323,6 @@ pub fn build_file<'a>(
|
||||
);
|
||||
|
||||
let compilation_end = compilation_start.elapsed();
|
||||
|
||||
let size = roc_app_bytes.len();
|
||||
|
||||
if emit_timings {
|
||||
@ -330,7 +340,8 @@ pub fn build_file<'a>(
|
||||
|
||||
if let Some(HostRebuildTiming::ConcurrentWithApp(thread)) = opt_rebuild_timing {
|
||||
let rebuild_duration = thread.join().expect("Failed to (re)build platform.");
|
||||
if emit_timings && !prebuilt {
|
||||
|
||||
if emit_timings && !is_prebuilt {
|
||||
println!(
|
||||
"Finished rebuilding the platform in {} ms\n",
|
||||
rebuild_duration
|
||||
|
Loading…
Reference in New Issue
Block a user