Allow --precompiled-host=false

This commit is contained in:
Richard Feldman 2022-04-14 20:36:11 -04:00
parent 6b213be997
commit 1f93973dbf
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798

View file

@ -126,7 +126,9 @@ pub fn build_app<'a>() -> App<'a> {
.arg( .arg(
Arg::new(FLAG_PRECOMPILED) Arg::new(FLAG_PRECOMPILED)
.long(FLAG_PRECOMPILED) .long(FLAG_PRECOMPILED)
.about("Assumes the host has been precompiled and skips recompiling the host.") .about("Assumes the host has been precompiled and skips recompiling the host. (Enabled by default when using a --target other than `--target host`)")
.possible_values(["true", "false"])
.default_value("true")
.required(false), .required(false),
) )
.arg( .arg(
@ -230,7 +232,9 @@ pub fn build_app<'a>() -> App<'a> {
.arg( .arg(
Arg::new(FLAG_PRECOMPILED) Arg::new(FLAG_PRECOMPILED)
.long(FLAG_PRECOMPILED) .long(FLAG_PRECOMPILED)
.about("Assumes the host has been precompiled and skips recompiling the host. (Enabled by default when using --target other than --target host)") .about("Assumes the host has been precompiled and skips recompiling the host. (Enabled by default when using a --target other than `--target host`)")
.possible_values(["true", "false"])
.default_value("true")
.required(false), .required(false),
) )
.arg( .arg(
@ -338,9 +342,13 @@ pub fn build(matches: &ArgMatches, config: BuildConfig) -> io::Result<i32> {
roc_linker::supported(&link_type, &triple) roc_linker::supported(&link_type, &triple)
}; };
// When compiling for a different target, we assume a precompiled host. let precompiled = if matches.is_present(FLAG_PRECOMPILED) {
// Otherwise compilation would most likely fail! matches.value_of(FLAG_PRECOMPILED) == Some("true")
let precompiled = target != Target::Host || matches.is_present(FLAG_PRECOMPILED); } else {
// When compiling for a different target, default to assuming a precompiled host.
// Otherwise compilation would most likely fail!
target != Target::Host
};
let path = Path::new(filename); let path = Path::new(filename);
// Spawn the root task // Spawn the root task