Skip to content

Commit

Permalink
Update --prebuilt-platform usage in comments and error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlsmith committed May 15, 2023
1 parent e1e72a3 commit 1aa4524
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions crates/compiler/build/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ fn gen_from_mono_module_dev_wasm32<'a>(

let host_bytes = std::fs::read(preprocessed_host_path).unwrap_or_else(|_| {
internal_error!(
"Failed to read host object file {}! Try setting --prebuilt-platform=false",
"Failed to read host object file {}! Try omitting --prebuilt-platform",
preprocessed_host_path.display()
)
});
Expand Down Expand Up @@ -794,7 +794,7 @@ fn build_loaded_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.
// even if the --prebuilt-platform CLI flag wasn't set.
let is_platform_prebuilt = prebuilt_requested || loaded.uses_prebuilt_platform;

let cwd = app_module_path.parent().unwrap();
Expand Down Expand Up @@ -1036,9 +1036,10 @@ fn build_loaded_file<'a>(
}

fn invalid_prebuilt_platform(prebuilt_requested: bool, preprocessed_host_path: PathBuf) {
let prefix = match prebuilt_requested {
true => "Because I was run with --prebuilt-platform=true, ",
false => "",
let prefix = if prebuilt_requested {
"Because I was run with --prebuilt-platform, "
} else {
""
};

let preprocessed_host_path_str = preprocessed_host_path.to_string_lossy();
Expand All @@ -1057,7 +1058,7 @@ fn invalid_prebuilt_platform(prebuilt_requested: bool, preprocessed_host_path: P
However, it was not there!{}
If you have the platform's source code locally, you may be able to generate it by re-running this command with --prebuilt-platform=false
If you have the platform's source code locally, you may be able to generate it by re-running this command omitting --prebuilt-platform
"#
),
prefix,
Expand Down
2 changes: 1 addition & 1 deletion crates/packaging/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn nixos_error_if_dynamic(url: &str, dest_dir: &Path) {
You can:\n\n\t\
- Download the source of the platform and build it locally, like in this example:\n\t \
https://github.com/roc-lang/roc/blob/main/examples/platform-switching/rocLovesRust.roc.\n\t \
When building your roc application, you can use the flag `--prebuilt-platform=true` to prevent the platform from being rebuilt every time.\n\t \
When building your roc application, you can use the flag `--prebuilt-platform` to prevent the platform from being rebuilt every time.\n\t \
For some graphical platforms you may need to use https://github.com/guibou/nixGL.\n\n\t\
- Contact the author of the platform to ask them to statically link their platform.\n\t \
musl can be used to prevent a dynamic dependency on the systems' libc.\n\t \
Expand Down

0 comments on commit 1aa4524

Please sign in to comment.