The documentation mentions this to some extent.
Actually implement this and update the documentation.
}
if (F_status_is_not_error(status)) {
- status = fake_build_operate(*data);
+ f_string_static_t stub = f_string_static_t_initialize;
+
+ status = fake_build_operate(*data, stub);
}
}
else if (operations[i] == fake_operation_clean) {
#endif // _di_fake_build_load_environment_
#ifndef _di_fake_build_load_setting_
- void fake_build_load_setting(const fake_data_t data, fake_build_setting_t *setting, f_status_t *status) {
+ void fake_build_load_setting(const fake_data_t data, const f_string_static_t setting_file, fake_build_setting_t *setting, f_status_t *status) {
if (F_status_is_error(*status)) return;
+ char path_file[data.path_data_build.used + setting_file.used + 1];
+
{
f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
f_fss_objects_t objects = f_fss_objects_t_initialize;
f_fss_contents_t contents = f_fss_contents_t_initialize;
- *status = fake_file_buffer(data, data.file_data_build_settings.string, &buffer);
+ if (setting_file.used) {
+ memcpy(path_file, data.path_data_build.string, data.path_data_build.used);
+ memcpy(path_file + data.path_data_build.used, setting_file.string, setting_file.used);
+
+ path_file[data.path_data_build.used + setting_file.used] = 0;
+
+ *status = fake_file_buffer(data, path_file, &buffer);
+ }
+ else {
+ *status = fake_file_buffer(data, data.file_data_build_settings.string, &buffer);
+ }
+
if (F_status_is_error(*status)) return;
f_string_range_t range = f_macro_string_range_initialize(buffer.used);
fake_print_error_fss(data, *status, "fll_fss_extended_read", data.file_data_build_settings.string, range, F_true);
}
- fake_build_load_setting_process(data, data.file_data_build_settings.string, buffer, objects, contents, setting, status);
+ fake_build_load_setting_process(data, setting_file.used ? path_file : data.file_data_build_settings.string, buffer, objects, contents, setting, status);
f_macro_string_dynamic_t_delete_simple(buffer);
f_macro_fss_objects_t_delete_simple(objects);
fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: The setting '");
fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", names[i]);
fl_color_print(f_type_error, data.context.error, data.context.reset, "' is required but is not specified in the settings file '");
- fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", data.file_data_build_settings.string);
+ fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", setting_file.used ? path_file : data.file_data_build_settings.string);
fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'.");
failed = F_true;
#endif // _di_fake_build_objects_static_
#ifndef _di_fake_build_operate_
- f_return_status fake_build_operate(const fake_data_t data) {
+ f_return_status fake_build_operate(const fake_data_t data, const f_string_static_t setting_file) {
if (data.verbosity != fake_verbosity_quiet) {
printf("%c", f_string_eol[0]);
fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Building project.");
f_macro_mode_t_set_default_umask(mode, data.umask);
- fake_build_load_setting(data, &data_build.setting, &status);
+ fake_build_load_setting(data, setting_file, &data_build.setting, &status);
fake_build_load_stage(data, &stage, &status);
*
* @param data
* The program data.
+ * @param setting_file
+ * The name of the settings file to use.
+ * If setting_file.used is 0, then the default or program parameter supplied file is used.
* @param setting
* All build related setting data from the build setting file are loaded into this.
* These setting will have any specified mode property applied.
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_fake_build_load_setting_
- extern void fake_build_load_setting(const fake_data_t data, fake_build_setting_t *setting, f_status_t *status) f_gcc_attribute_visibility_internal;
+ extern void fake_build_load_setting(const fake_data_t data, const f_string_static_t setting_file, fake_build_setting_t *setting, f_status_t *status) f_gcc_attribute_visibility_internal;
#endif // _di_fake_build_load_setting_
/**
*
* @param data
* The program data.
+ * @param setting_file
+ * The name of the settings file to use.
+ * If setting_file.used is 0, then the default or program parameter supplied file is used.
*
* @return
* F_none on success.
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_fake_build_operate_
- extern f_return_status fake_build_operate(const fake_data_t data) f_gcc_attribute_visibility_internal;
+ extern f_return_status fake_build_operate(const fake_data_t data, const f_string_static_t setting_file) f_gcc_attribute_visibility_internal;
#endif // _di_fake_build_operate_
/**
}
if (data_make->setting_make.load_build) {
- fake_build_load_setting(data, &data_make->setting_build, status);
+ f_string_static_t stub = f_string_static_t_initialize;
+
+ fake_build_load_setting(data, stub, &data_make->setting_build, status);
if (F_status_is_error(*status)) {
fake_print_error(data, *status, "fake_build_load_setting", F_true);
}
if (operation == fake_make_operation_type_build) {
- *status = fake_build_operate(data);
+ f_string_static_t stub = f_string_static_t_initialize;
+
+ *status = fake_build_operate(data, arguments.used ? arguments.array[0] : stub);
fake_make_operate_process_return(data, 0, data_make, status);
return;
}
else if (arguments.used) {
if (arguments.array[0].used) {
- f_status_t status_file = f_file_is(arguments.array[0].string, f_file_type_regular);
+ char path_file[data.path_data_build.used + arguments.array[0].used + 1];
+
+ memcpy(path_file, data.path_data_build.string, data.path_data_build.used);
+ memcpy(path_file + data.path_data_build.used, arguments.array[0].string, arguments.array[0].used);
+
+ path_file[data.path_data_build.used + arguments.array[0].used] = 0;
+
+ f_status_t status_file = f_file_is(path_file, f_file_type_regular);
if (status_file == F_file_found_not) {
if (data.verbosity != fake_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
fl_color_print(data_make->print.to, data_make->print.context, data.context.reset, "%s: Failed to find file '", data_make->print.prefix);
- fl_color_print(data_make->print.to, data.context.notable, data.context.reset, "%s", arguments.array[0].string);
+ fl_color_print(data_make->print.to, data.context.notable, data.context.reset, "%s", path_file);
fl_color_print_line(data_make->print.to, data_make->print.context, data.context.reset, "'.");
}
*status = F_status_set_error(status_file);
}
else if (F_status_is_error(status_file)) {
- fake_print_message_file(data, *status, "f_file_is", data.file_data_build_fakefile.string, "find", F_true, F_true, data_make->print);
+ fake_print_message_file(data, *status, "f_file_is", path_file, "find", F_true, F_true, data_make->print);
*status = status_file;
}
else if (!status_file) {
if (data.verbosity != fake_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
fl_color_print(data_make->print.to, data_make->print.context, data.context.reset, "%s: The file '", data_make->print.prefix);
- fl_color_print(data_make->print.to, data.context.notable, data.context.reset, "%s", arguments.array[0].string);
+ fl_color_print(data_make->print.to, data.context.notable, data.context.reset, "%s", path_file);
fl_color_print_line(data_make->print.to, data_make->print.context, data.context.reset, "' must be a regular file.");
}
Run the fake build operation as if "fake build" was run instead of "fake make".
Command line arguments are automatically passed to the fake build operation.
- Accepts an optional Content that is a path to a build settings file to use instead of the default.
+ Accepts an optional Content that is a file name to a build settings file to use instead of the default.
+ This file name is relative to the data build directory (which can be changed by -D/--data parameter).
- break\:
Perform an exit from the current make operation.
The Section Operation Objects are\:
- archive: One or more Content.
- break: Zero or One Content. If specified, First content must be one of "success" or "failure".
- - build: Zero or One Content. First Content represents path to the settings file, relative to the project root.
+ - build: Zero or One Content. First Content represents file name of the settings file to use.
- clean: Zero Content.
- compile: One or more Content as parameters to compiler.
- define: Two or more Content.