cleaned up the command executor, only build & check should be working right now
This commit is contained in:
parent
7ab1c3defc
commit
162ab2001b
2 changed files with 62 additions and 2 deletions
BIN
src.bin
BIN
src.bin
Binary file not shown.
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue