//! has various flags to configure how it's run.
use std::path::PathBuf;
-use std::process;
use getopts::Options;
pub host: Option<Vec<TargetSelection>>,
pub target: Option<Vec<TargetSelection>>,
pub config: Option<PathBuf>,
+ pub build_dir: Option<PathBuf>,
pub jobs: Option<u32>,
pub cmd: Subcommand,
pub incremental: bool,
opts.optflagmulti("v", "verbose", "use verbose output (-vv for very verbose)");
opts.optflag("i", "incremental", "use incremental compilation");
opts.optopt("", "config", "TOML configuration file for build", "FILE");
+ opts.optopt(
+ "",
+ "build-dir",
+ "Build directory, overrides `build.build-dir` in `config.toml`",
+ "DIR",
+ );
opts.optopt("", "build", "build target of the stage0 compiler", "BUILD");
opts.optmulti("", "host", "host targets to build", "HOST");
opts.optmulti("", "target", "target targets to build", "TARGET");
// subcommand.
println!("{}\n", subcommand_help);
let exit_code = if args.is_empty() { 0 } else { 1 };
- process::exit(exit_code);
+ crate::detail_exit(exit_code);
}
};
} else if verbose {
panic!("No paths available for subcommand `{}`", subcommand.as_str());
}
- process::exit(exit_code);
+ crate::detail_exit(exit_code);
};
// Done specifying what options are possible, so do the getopts parsing
"Sorry, I couldn't figure out which subcommand you were trying to specify.\n\
You may need to move some options to after the subcommand.\n"
);
- process::exit(1);
+ crate::detail_exit(1);
}
// Extra help text for some commands
match subcommand {
eprintln!("error: {}", err);
eprintln!("help: the available profiles are:");
eprint!("{}", Profile::all_for_help("- "));
- std::process::exit(1);
+ crate::detail_exit(1);
})
} else {
t!(crate::setup::interactive_path())
|| matches.opt_str("keep-stage-std").is_some()
{
eprintln!("--keep-stage not yet supported for x.py check");
- process::exit(1);
+ crate::detail_exit(1);
}
}
None
},
config: matches.opt_str("config").map(PathBuf::from),
+ build_dir: matches.opt_str("build-dir").map(PathBuf::from),
jobs: matches.opt_str("jobs").map(|j| j.parse().expect("`jobs` should be a number")),
cmd,
incremental: matches.opt_present("incremental"),
Some("warn") => Some(false),
Some(value) => {
eprintln!(r#"invalid value for --warnings: {:?}, expected "warn" or "deny""#, value,);
- process::exit(1);
+ crate::detail_exit(1);
}
None => None,
}