less verbose build debugging

This commit is contained in:
Anton-4 2024-02-28 13:50:48 +01:00
parent bb0df1ef0a
commit 9e05d21b3f
No known key found for this signature in database
GPG Key ID: 0971D718C0A9B937
3 changed files with 30 additions and 13 deletions

View File

@ -38,13 +38,21 @@ ROC_PRINT_UNDERIVABLE = "0"
ROC_TRACE_COMPACTION = "0" ROC_TRACE_COMPACTION = "0"
ROC_PRINT_UNIFICATIONS_DERIVED = "0" ROC_PRINT_UNIFICATIONS_DERIVED = "0"
ROC_PRINT_MISMATCHES = "0" ROC_PRINT_MISMATCHES = "0"
ROC_PRINT_FIXPOINT_FIXING = "0"
ROC_VERIFY_RIGID_LET_GENERALIZED = "0" ROC_VERIFY_RIGID_LET_GENERALIZED = "0"
ROC_VERIFY_OCCURS_ONE_RECURSION = "0"
ROC_CHECK_MONO_IR = "0" ROC_CHECK_MONO_IR = "0"
ROC_PRINT_IR_AFTER_SPECIALIZATION = "0" ROC_PRINT_IR_AFTER_SPECIALIZATION = "0"
ROC_PRINT_IR_AFTER_RESET_REUSE = "0" ROC_PRINT_IR_AFTER_RESET_REUSE = "0"
ROC_PRINT_IR_AFTER_DROP_SPECIALIZATION = "0"
ROC_PRINT_IR_AFTER_REFCOUNT = "0" ROC_PRINT_IR_AFTER_REFCOUNT = "0"
ROC_PRINT_RUNTIME_ERROR_GEN = "0" ROC_PRINT_IR_AFTER_TRMC = "0"
ROC_PRINT_IR_AFTER_DROP_SPECIALIZATION = "0"
ROC_DEBUG_ALIAS_ANALYSIS = "0" ROC_DEBUG_ALIAS_ANALYSIS = "0"
ROC_PRINT_RUNTIME_ERROR_GEN = "0"
ROC_PRINT_LLVM_FN_VERIFICATION = "0" ROC_PRINT_LLVM_FN_VERIFICATION = "0"
ROC_WRITE_FINAL_WASM = "0"
ROC_LOG_WASM_INTERP = "0"
ROC_PRINT_LOAD_LOG = "0" ROC_PRINT_LOAD_LOG = "0"
ROC_SKIP_SUBS_CACHE = "0"
ROC_PRINT_BUILD_COMMANDS = "0"
ROC_PRINT_BUILD_COMMANDS_WITH_ENV_VARS = "0"

View File

@ -1401,7 +1401,7 @@ pub fn preprocess_host_wasm32(host_input_path: &Path, preprocessed_host_path: &P
} }
fn run_build_command(mut command: Command, file_to_build: &str, flaky_fail_counter: usize) { fn run_build_command(mut command: Command, file_to_build: &str, flaky_fail_counter: usize) {
let command_string = stringify_command(&command); let command_string = stringify_command(&command, false);
let cmd_str = &command_string; let cmd_str = &command_string;
roc_debug_flags::dbg_do!(roc_debug_flags::ROC_PRINT_BUILD_COMMANDS, { roc_debug_flags::dbg_do!(roc_debug_flags::ROC_PRINT_BUILD_COMMANDS, {
print_command_str(cmd_str); print_command_str(cmd_str);
@ -1446,18 +1446,20 @@ fn run_build_command(mut command: Command, file_to_build: &str, flaky_fail_count
/// Stringify a command for printing /// Stringify a command for printing
/// e.g. `HOME=~ zig build-exe foo.zig -o foo` /// e.g. `HOME=~ zig build-exe foo.zig -o foo`
fn stringify_command(cmd: &Command) -> String { fn stringify_command(cmd: &Command, include_env_vars: bool) -> String {
let mut command_string = std::ffi::OsString::new(); let mut command_string = std::ffi::OsString::new();
for (name, opt_val) in cmd.get_envs() { if include_env_vars {
command_string.push(name); for (name, opt_val) in cmd.get_envs() {
command_string.push("="); command_string.push(name);
if let Some(val) = opt_val { command_string.push("=");
command_string.push(val); if let Some(val) = opt_val {
} else { command_string.push(val);
command_string.push("''"); } else {
command_string.push("''");
}
command_string.push(" ");
} }
command_string.push(" ");
} }
command_string.push(cmd.get_program()); command_string.push(cmd.get_program());
@ -1477,7 +1479,11 @@ fn print_command_str(s: &str) {
fn debug_print_command(_cmd: &Command) { fn debug_print_command(_cmd: &Command) {
// This debug macro is compiled out in release mode, so the argument is unused // This debug macro is compiled out in release mode, so the argument is unused
roc_debug_flags::dbg_do!(roc_debug_flags::ROC_PRINT_BUILD_COMMANDS_WITH_ENV_VARS, {
print_command_str(&stringify_command(_cmd, true));
});
roc_debug_flags::dbg_do!(roc_debug_flags::ROC_PRINT_BUILD_COMMANDS, { roc_debug_flags::dbg_do!(roc_debug_flags::ROC_PRINT_BUILD_COMMANDS, {
print_command_str(&stringify_command(_cmd)); print_command_str(&stringify_command(_cmd, false));
}); });
} }

View File

@ -176,4 +176,7 @@ flags! {
/// Print out shell commands used to buid the Roc and host code /// Print out shell commands used to buid the Roc and host code
ROC_PRINT_BUILD_COMMANDS ROC_PRINT_BUILD_COMMANDS
/// Print out shell commands used to buid the Roc and host code along with used env vars
ROC_PRINT_BUILD_COMMANDS_WITH_ENV_VARS
} }