mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Fix regression on printing "Rebuilding platform…"
This commit is contained in:
parent
39792bf144
commit
2eb9531817
1 changed files with 20 additions and 9 deletions
|
@ -67,7 +67,7 @@ pub fn build_file<'a>(
|
||||||
emit_timings: bool,
|
emit_timings: bool,
|
||||||
link_type: LinkType,
|
link_type: LinkType,
|
||||||
linking_strategy: LinkingStrategy,
|
linking_strategy: LinkingStrategy,
|
||||||
prebuilt: bool,
|
prebuilt_requested: bool,
|
||||||
threading: Threading,
|
threading: Threading,
|
||||||
wasm_dev_stack_bytes: Option<u32>,
|
wasm_dev_stack_bytes: Option<u32>,
|
||||||
roc_cache_dir: RocCacheDir<'_>,
|
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) = {
|
let (app_extension, extension, host_filename) = {
|
||||||
use roc_target::OperatingSystem::*;
|
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.
|
// 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 !preprocessed_host_path.exists() {
|
||||||
eprintln!(
|
if prebuilt_requested {
|
||||||
"\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",
|
eprintln!(
|
||||||
preprocessed_host_path.to_string_lossy()
|
"\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);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -275,7 +285,8 @@ pub fn build_file<'a>(
|
||||||
let rebuild_duration = rebuild_thread
|
let rebuild_duration = rebuild_thread
|
||||||
.join()
|
.join()
|
||||||
.expect("Failed to (re)build platform.");
|
.expect("Failed to (re)build platform.");
|
||||||
if emit_timings && !prebuilt {
|
|
||||||
|
if emit_timings && !is_prebuilt {
|
||||||
println!(
|
println!(
|
||||||
"Finished rebuilding the platform in {} ms\n",
|
"Finished rebuilding the platform in {} ms\n",
|
||||||
rebuild_duration
|
rebuild_duration
|
||||||
|
@ -312,7 +323,6 @@ pub fn build_file<'a>(
|
||||||
);
|
);
|
||||||
|
|
||||||
let compilation_end = compilation_start.elapsed();
|
let compilation_end = compilation_start.elapsed();
|
||||||
|
|
||||||
let size = roc_app_bytes.len();
|
let size = roc_app_bytes.len();
|
||||||
|
|
||||||
if emit_timings {
|
if emit_timings {
|
||||||
|
@ -330,7 +340,8 @@ pub fn build_file<'a>(
|
||||||
|
|
||||||
if let Some(HostRebuildTiming::ConcurrentWithApp(thread)) = opt_rebuild_timing {
|
if let Some(HostRebuildTiming::ConcurrentWithApp(thread)) = opt_rebuild_timing {
|
||||||
let rebuild_duration = thread.join().expect("Failed to (re)build platform.");
|
let rebuild_duration = thread.join().expect("Failed to (re)build platform.");
|
||||||
if emit_timings && !prebuilt {
|
|
||||||
|
if emit_timings && !is_prebuilt {
|
||||||
println!(
|
println!(
|
||||||
"Finished rebuilding the platform in {} ms\n",
|
"Finished rebuilding the platform in {} ms\n",
|
||||||
rebuild_duration
|
rebuild_duration
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue