diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp index d28faf77c..1ffdd0dba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -312,7 +312,7 @@ enum BuildFlagKind { BuildFlag_Collection, BuildFlag_Define, BuildFlag_BuildMode, - BuildFlag_KeepTestExecutable, + BuildFlag_KeepExecutable, BuildFlag_Target, BuildFlag_Subtarget, BuildFlag_Debug, @@ -532,7 +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_KeepTestExecutable, str_lit("keep-test-executable"), BuildFlagParam_None, Command_test); + add_flag(&build_flags, BuildFlag_KeepExecutable, str_lit("keep-executable"), BuildFlagParam_None, Command__does_build | 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); @@ -1195,8 +1195,8 @@ gb_internal bool parse_build_flags(Array<String> args) { break; } - case BuildFlag_KeepTestExecutable: - build_context.keep_test_executable = true; + case BuildFlag_KeepExecutable: + build_context.keep_executable = true; break; case BuildFlag_Debug: @@ -2554,11 +2554,11 @@ gb_internal int print_show_help(String const arg0, String command, String option } } - if (test_only) { - if (print_flag("-keep-test-executable")) { - print_usage_line(2, "Keep the test executable after running it with `odin test`, instead of deleting it after the test completes."); - print_usage_line(2, "If you build your tests using `odin build <package> -build-mode:test`, the compiler does not execute"); - print_usage_line(2, "the resulting test program, and this option is not applicable."); + if (test_only || run_or_build) { + if (print_flag("-keep-executable")) { + print_usage_line(2, "Keep the executable generated by `odin test` or `odin run` after running it. We clean it up by default."); + print_usage_line(2, "If you build your program or test using `odin build`, the compiler does not automatically execute"); + print_usage_line(2, "the resulting program, and this option is not applicable."); } } @@ -3886,7 +3886,7 @@ end_of_code_gen:; system_must_exec_command_line_app("odin run", "\"%.*s\" %.*s", LIT(exe_name), LIT(run_args_string)); - if (build_context.command_kind == Command_test && !build_context.keep_test_executable) { + if (!build_context.keep_executable) { char const *filename = cast(char const *)exe_name.text; gb_file_remove(filename); } |