diff --git a/src.bin b/src.bin deleted file mode 100755 index 9885ffb..0000000 Binary files a/src.bin and /dev/null differ diff --git a/src/command_executor.odin b/src/command_executor.odin index 7c9c3f9..8a3c3ba 100644 --- a/src/command_executor.odin +++ b/src/command_executor.odin @@ -9,8 +9,7 @@ ExecutionError :: enum { None, ErrorDuringCommandExecution, } - -execute_command :: proc( +build_or_check :: proc( command: Command, target_name: TargetName, configuration: ConfigurationTargets, @@ -32,6 +31,7 @@ execute_command :: proc( strings.write_string(&sb, command_to_string(command)) strings.write_byte(&sb, ' ') + // Append the command if def_config, ok := configuration[DEFAULT_TARGET_NAME]; ok && !found_target_in_config { strings.write_string(&sb, string(def_config.source)) } else if found_target_in_config { @@ -69,6 +69,26 @@ execute_command :: proc( strings.write_string(&sb, flag) } } + // Append the output dir + if command == .BUILD { + output_dir: Path;binary_name: string + if def_config, ok := configuration[DEFAULT_TARGET_NAME]; ok { + if len(def_config.output_dir) != 0 && len(def_config.binary_name) != 0 { + output_dir = def_config.output_dir + binary_name = def_config.binary_name + } + } + if found_target_in_config { + output_dir = target_config.output_dir + binary_name = target_config.binary_name + } + + if len(output_dir) > 0 && len(binary_name) > 0 { + strings.write_string(&sb, " -out:") + strings.write_string(&sb, string(output_dir)) + strings.write_string(&sb, binary_name) + } + } compile_flags = strings.to_string(sb) @@ -78,3 +98,43 @@ execute_command :: proc( return } + +execute_command :: proc( + command: Command, + target_name: TargetName, + configuration: ConfigurationTargets, +) -> ( + error: ExecutionError, +) { + if command == .CHECK || command == .BUILD { + return build_or_check(command, target_name, configuration) + } + if command == .CLEAN { + return clean(command, target_name, configuration) + } + if command == .TEST { + return test(command, target_name, configuration) + } + + return +} + +clean :: proc( + command: Command, + target_name: TargetName, + configuration: ConfigurationTargets, +) -> ( + error: ExecutionError, +) { + return +} + +test :: proc( + command: Command, + target_name: TargetName, + configuration: ConfigurationTargets, +) -> ( + error: ExecutionError, +) { + return +}