mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-19 04:12:22 -07:00
Add -build-only for odin test command
This allows test executables to be only built, not run too.
This commit is contained in:
@@ -441,6 +441,7 @@ struct BuildContext {
|
||||
String extra_assembler_flags;
|
||||
String microarch;
|
||||
BuildModeKind build_mode;
|
||||
bool build_only;
|
||||
bool generate_docs;
|
||||
bool custom_optimization_level;
|
||||
i32 optimization_level;
|
||||
|
||||
+12
-1
@@ -312,6 +312,7 @@ enum BuildFlagKind {
|
||||
BuildFlag_Collection,
|
||||
BuildFlag_Define,
|
||||
BuildFlag_BuildMode,
|
||||
BuildFlag_BuildOnly,
|
||||
BuildFlag_Target,
|
||||
BuildFlag_Subtarget,
|
||||
BuildFlag_Debug,
|
||||
@@ -531,6 +532,7 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
||||
add_flag(&build_flags, BuildFlag_Collection, str_lit("collection"), BuildFlagParam_String, Command__does_check);
|
||||
add_flag(&build_flags, BuildFlag_Define, str_lit("define"), BuildFlagParam_String, Command__does_check, true);
|
||||
add_flag(&build_flags, BuildFlag_BuildMode, str_lit("build-mode"), BuildFlagParam_String, Command__does_build); // Commands_build is not used to allow for a better error message
|
||||
add_flag(&build_flags, BuildFlag_BuildOnly, str_lit("build-only"), BuildFlagParam_None, Command_test);
|
||||
add_flag(&build_flags, BuildFlag_Target, str_lit("target"), BuildFlagParam_String, Command__does_check);
|
||||
add_flag(&build_flags, BuildFlag_Subtarget, str_lit("subtarget"), BuildFlagParam_String, Command__does_check);
|
||||
add_flag(&build_flags, BuildFlag_Debug, str_lit("debug"), BuildFlagParam_None, Command__does_check);
|
||||
@@ -1193,6 +1195,9 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
||||
|
||||
break;
|
||||
}
|
||||
case BuildFlag_BuildOnly:
|
||||
build_context.build_only = true;
|
||||
break;
|
||||
|
||||
case BuildFlag_Debug:
|
||||
build_context.ODIN_DEBUG = true;
|
||||
@@ -2381,6 +2386,12 @@ gb_internal int print_show_help(String const arg0, String command, String option
|
||||
}
|
||||
}
|
||||
|
||||
if (test_only) {
|
||||
if (print_flag("-build-only")) {
|
||||
print_usage_line(2, "Only builds the test executable; does not automatically run it afterwards.");
|
||||
}
|
||||
}
|
||||
|
||||
if (check) {
|
||||
if (print_flag("-collection:<name>=<filepath>")) {
|
||||
print_usage_line(2, "Defines a library collection used for imports.");
|
||||
@@ -3861,7 +3872,7 @@ end_of_code_gen:;
|
||||
show_timings(checker, &global_timings);
|
||||
}
|
||||
|
||||
if (run_output) {
|
||||
if (!build_context.build_only && run_output) {
|
||||
String exe_name = path_to_string(heap_allocator(), build_context.build_paths[BuildPath_Output]);
|
||||
defer (gb_free(heap_allocator(), exe_name.text));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user