From: Kevin Day Date: Fri, 9 Jun 2023 04:17:26 +0000 (-0500) Subject: Bugfix: Use arguments passed to fake when processing build with the custom build... X-Git-Tag: 0.6.6~25 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=449d949fc86a086dfa83c2cbcde2eca73e4cabf2;p=fll Bugfix: Use arguments passed to fake when processing build with the custom build arguments. The custom build arguments are passed when the make mode is being used to call the build mode. The mode arguments passed to the fake program, these should be propagated into the custom build arguments for the build mode. Move the print message to after the build modes are processed so that an accurate message is printed. --- diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index 7f603f7..b267109 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -86,15 +86,33 @@ extern "C" { // Strip the build settings name from the build arguments to generate a list of modes. f_string_statics_t modes_custom = f_string_statics_t_initialize; - modes_custom.used = build_arguments && build_arguments->used > 1 ? build_arguments->used - 1 : 0; - modes_custom.size = 0; + + if (build_arguments) { + if (build_arguments->used > 1) { + modes_custom.used = build_arguments->used - 1; + } + else if (setting->modes.used) { + modes_custom.used = setting->modes.used; + } + } f_string_static_t modes_custom_array[modes_custom.used]; modes_custom.array = modes_custom_array; - for (f_array_length_t i = 0; i < modes_custom.used; ++i) { - modes_custom.array[i] = build_arguments->array[i + 1]; - } // for + if (build_arguments) { + f_array_length_t i = 0; + + if (build_arguments->used > 1) { + for (; i < modes_custom.used; ++i) { + modes_custom.array[i] = build_arguments->array[i + 1]; + } // for + } + else if (setting->modes.used) { + for (; i < setting->modes.used; ++i) { + modes_custom.array[i] = setting->modes.array[i]; + } // for + } + } f_string_static_t path_file = f_string_static_t_initialize; diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 9767843..350755f 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -841,33 +841,51 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static if (F_status_is_fine(status)) { if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { - flockfile(data->main->output.to.stream); - - fl_print_format("%r%[Building%] ", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important); - fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, data_build.setting.build_name, data->main->context.set.notable); - fl_print_format("%[ using '%]", data->main->output.to.stream, data->main->context.set.important, data->main->context.set.important); - fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, build_arguments && build_arguments->used ? build_arguments->array[0] : data->settings, data->main->context.set.notable); - - fl_print_format("%[' with modes '%]", data->main->output.to.stream, data->main->context.set.important, data->main->context.set.important); - f_string_statics_t modes_custom = f_string_statics_t_initialize; - modes_custom.used = build_arguments && build_arguments->used > 1 ? build_arguments->used - 1 : 0; - modes_custom.size = 0; + + if (build_arguments) { + if (build_arguments->used > 1) { + modes_custom.used = build_arguments->used - 1; + } + else if (data_build.setting.modes.used) { + modes_custom.used = data_build.setting.modes.used; + } + } f_string_static_t modes_custom_array[modes_custom.used]; modes_custom.array = modes_custom_array; - for (f_array_length_t i = 0; i < modes_custom.used; ++i) { - modes_custom.array[i] = build_arguments->array[i + 1]; - } // for + if (build_arguments) { + f_array_length_t i = 0; - // Custom modes are always used if provided, otherwise if any mode is specified, the entire defaults is replaced. + if (build_arguments->used > 1) { + for (; i < modes_custom.used; ++i) { + modes_custom.array[i] = build_arguments->array[i + 1]; + } // for + } + else if (data_build.setting.modes.used) { + for (; i < data_build.setting.modes.used; ++i) { + modes_custom.array[i] = data_build.setting.modes.array[i]; + } // for + } + } + + // Custom modes are always used if provided, otherwise fallback to the passed modes or the default modes. const f_string_statics_t * const modes = modes_custom.used ? &modes_custom : data->mode.used ? &data->mode : &data_build.setting.modes_default; + flockfile(data->main->output.to.stream); + + fl_print_format("%r%[Building%] ", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important); + fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, data_build.setting.build_name, data->main->context.set.notable); + fl_print_format("%[ using '%]", data->main->output.to.stream, data->main->context.set.important, data->main->context.set.important); + fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, build_arguments && build_arguments->used ? build_arguments->array[0] : data->settings, data->main->context.set.notable); + + fl_print_format("%[' with modes '%]", data->main->output.to.stream, data->main->context.set.important, data->main->context.set.important); + for (f_array_length_t i = 0; i < modes->used; ) { fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, modes->array[i], data->main->context.set.notable);