cli: add --verbose flag to CMD_BUILD

This commit is contained in:
Jakub Konka 2024-12-30 22:52:07 +01:00
parent 3b3f79a5d2
commit 4764b23282
No known key found for this signature in database
GPG key ID: 3AEF55DD984C8344
4 changed files with 24 additions and 1 deletions

View file

@ -241,6 +241,13 @@ pub fn build_app() -> Command {
.action(ArgAction::SetTrue)
.required(false),
)
.arg(
Arg::new(FLAG_VERBOSE)
.long(FLAG_VERBOSE)
.help("Print detailed information while building")
.action(ArgAction::SetTrue)
.required(false)
)
.arg(
Arg::new(ROC_FILE)
.help("The .roc file to build")
@ -974,6 +981,7 @@ pub fn build(
};
let load_config = standard_load_config(target, build_ordering, threading);
let verbose = matches.get_flag(FLAG_VERBOSE);
let res_binary_path = roc_build::program::build_file(
&arena,
@ -989,6 +997,7 @@ pub fn build(
roc_cache_dir,
load_config,
out_path,
verbose,
);
match res_binary_path {

View file

@ -725,6 +725,7 @@ pub fn build_file<'a>(
roc_cache_dir: RocCacheDir<'_>,
load_config: LoadConfig,
out_path: Option<&Path>,
verbose: bool,
) -> Result<BuiltFile<'a>, BuildFileError<'a>> {
let compilation_start = Instant::now();
@ -751,6 +752,7 @@ pub fn build_file<'a>(
loaded,
compilation_start,
out_path,
verbose,
)
}
@ -827,6 +829,7 @@ fn build_loaded_file<'a>(
loaded: roc_load::MonomorphizedModule<'a>,
compilation_start: Instant,
out_path: Option<&Path>,
verbose: bool,
) -> Result<BuiltFile<'a>, BuildFileError<'a>> {
// get the platform path from the app header
let platform_main_roc_path = match &loaded.entry_point {
@ -956,6 +959,7 @@ fn build_loaded_file<'a>(
&roc_app_bytes,
&output_exe_path,
metadata_file,
verbose,
);
}
(LinkingStrategy::Additive, _) | (LinkingStrategy::Legacy, LinkType::None) => {
@ -1475,6 +1479,7 @@ pub fn build_str_test<'a>(
loaded,
compilation_start,
None,
false,
)
}

View file

@ -92,6 +92,7 @@ pub fn generate(
RocCacheDir::Persistent(cache::roc_cache_packages_dir().as_path()),
load_config,
Some(dylib_dir.path()),
false,
),
Err(_) => {
eprintln!("`roc glue` was unable to create a tempdir.");

View file

@ -55,8 +55,16 @@ pub fn link_preprocessed_host(
roc_app_bytes: &[u8],
binary_path: &Path,
metadata: PathBuf,
verbose: bool,
) {
surgery(roc_app_bytes, &metadata, binary_path, false, false, target)
surgery(
roc_app_bytes,
&metadata,
binary_path,
verbose,
false,
target,
)
}
pub fn generate_stub_lib_from_loaded(