build: standardize build dir policy
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <future>
|
||||
@@ -39,8 +40,11 @@ namespace fs = std::filesystem;
|
||||
BuildTool::BuildTool(const BuildConfig& config)
|
||||
: config_(config) {
|
||||
// Ensure build directory is set with a default value
|
||||
if (config_.build_directory.empty()) {
|
||||
config_.build_directory = "build_ai";
|
||||
const char* env_build_dir = std::getenv("YAZE_BUILD_DIR");
|
||||
if (env_build_dir != nullptr && env_build_dir[0] != '\0') {
|
||||
config_.build_directory = env_build_dir;
|
||||
} else if (config_.build_directory.empty()) {
|
||||
config_.build_directory = "build";
|
||||
}
|
||||
|
||||
// Convert to absolute path if relative
|
||||
@@ -171,9 +175,13 @@ absl::StatusOr<BuildTool::BuildResult> BuildTool::RunTests(
|
||||
absl::StrFormat("ROM file not found: %s", rom_path));
|
||||
}
|
||||
#ifdef _WIN32
|
||||
env_setup = absl::StrFormat("set YAZE_TEST_ROM_PATH=\"%s\" && ", rom_path);
|
||||
env_setup = absl::StrFormat(
|
||||
"set YAZE_TEST_ROM_VANILLA=\"%s\" && set YAZE_TEST_ROM_PATH=\"%s\" && ",
|
||||
rom_path, rom_path);
|
||||
#else
|
||||
env_setup = absl::StrFormat("YAZE_TEST_ROM_PATH=\"%s\" ", rom_path);
|
||||
env_setup = absl::StrFormat(
|
||||
"YAZE_TEST_ROM_VANILLA=\"%s\" YAZE_TEST_ROM_PATH=\"%s\" ",
|
||||
rom_path, rom_path);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -919,4 +927,4 @@ absl::Status BuildStatusCommandHandler::Execute(
|
||||
} // namespace tools
|
||||
} // namespace agent
|
||||
} // namespace cli
|
||||
} // namespace yaze
|
||||
} // namespace yaze
|
||||
|
||||
@@ -33,26 +33,26 @@ class BuildTool {
|
||||
public:
|
||||
// Build operation results
|
||||
struct BuildResult {
|
||||
bool success;
|
||||
bool success = false;
|
||||
std::string output;
|
||||
std::string error_output;
|
||||
int exit_code;
|
||||
std::chrono::seconds duration;
|
||||
int exit_code = 0;
|
||||
std::chrono::seconds duration{0};
|
||||
std::string command_executed;
|
||||
};
|
||||
|
||||
// Build status information
|
||||
struct BuildStatus {
|
||||
bool is_running;
|
||||
bool is_running = false;
|
||||
std::string current_operation;
|
||||
std::string last_result_summary;
|
||||
std::chrono::system_clock::time_point start_time;
|
||||
int progress_percent; // -1 if unknown
|
||||
std::chrono::system_clock::time_point start_time{};
|
||||
int progress_percent = 0; // -1 if unknown
|
||||
};
|
||||
|
||||
// Build configuration
|
||||
struct BuildConfig {
|
||||
std::string build_directory = "build_ai"; // Default AI agent build dir
|
||||
std::string build_directory = "build"; // Override via YAZE_BUILD_DIR
|
||||
std::chrono::seconds timeout = std::chrono::seconds(600); // 10 min default
|
||||
bool capture_output = true;
|
||||
bool verbose = false;
|
||||
@@ -265,4 +265,4 @@ class BuildStatusCommandHandler : public resources::CommandHandler {
|
||||
} // namespace cli
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_SRC_CLI_SERVICE_AGENT_TOOLS_BUILD_TOOL_H_
|
||||
#endif // YAZE_SRC_CLI_SERVICE_AGENT_TOOLS_BUILD_TOOL_H_
|
||||
|
||||
Reference in New Issue
Block a user