yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::cli::agent::tools::BuildTool Class Reference

Build tool for AI agents to compile and test the project. More...

#include <build_tool.h>

Collaboration diagram for yaze::cli::agent::tools::BuildTool:

Classes

struct  BuildConfig
 
struct  BuildResult
 
struct  BuildStatus
 

Public Member Functions

 BuildTool ()
 
 BuildTool (const BuildConfig &config)
 
 ~BuildTool ()
 
absl::StatusOr< BuildResultConfigure (const std::string &preset)
 Configure the build system with a CMake preset.
 
absl::StatusOr< BuildResultBuild (const std::string &target="", const std::string &config="")
 Build a specific target or all targets.
 
absl::StatusOr< BuildResultRunTests (const std::string &filter="", const std::string &rom_path="")
 Run tests with optional filter.
 
BuildStatus GetBuildStatus () const
 Get current build status.
 
absl::StatusOr< BuildResultClean ()
 Clean the build directory.
 
bool IsBuildDirectoryReady () const
 Check if a build directory exists and is configured.
 
std::vector< std::string > ListAvailablePresets () const
 List available CMake presets.
 
std::optional< BuildResultGetLastResult () const
 Get the last build result.
 
absl::Status CancelCurrentOperation ()
 Cancel the current build operation.
 

Private Member Functions

absl::StatusOr< BuildResultExecuteCommand (const std::string &command, const std::string &operation_name)
 
absl::StatusOr< BuildResultExecuteCommandInternal (const std::string &command, const std::chrono::seconds &timeout)
 
std::string GetProjectRoot () const
 
std::string GetCurrentPlatform () const
 
std::vector< std::string > ParsePresetsFile () const
 
bool IsPresetValid (const std::string &preset) const
 
void UpdateStatus (const std::string &operation, bool is_running)
 

Private Attributes

BuildConfig config_
 
std::mutex status_mutex_
 
std::atomic< bool > is_running_ {false}
 
std::string current_operation_
 
std::optional< BuildResultlast_result_
 
std::chrono::system_clock::time_point operation_start_time_
 
std::unique_ptr< std::thread > execution_thread_
 
std::atomic< bool > cancel_requested_ {false}
 

Detailed Description

Build tool for AI agents to compile and test the project.

This tool provides safe access to build operations with:

  • CMake configuration with presets
  • Building specific targets
  • Running tests with filters
  • Build status monitoring
  • Timeout protection
  • Output capture and streaming

Definition at line 32 of file build_tool.h.

Constructor & Destructor Documentation

◆ BuildTool() [1/2]

yaze::cli::agent::tools::BuildTool::BuildTool ( )
inline

Definition at line 64 of file build_tool.h.

◆ BuildTool() [2/2]

yaze::cli::agent::tools::BuildTool::BuildTool ( const BuildConfig & config)
explicit

Definition at line 39 of file build_tool.cc.

References yaze::cli::agent::tools::BuildTool::BuildConfig::build_directory, config_, and GetProjectRoot().

Here is the call graph for this function:

◆ ~BuildTool()

yaze::cli::agent::tools::BuildTool::~BuildTool ( )

Definition at line 53 of file build_tool.cc.

References CancelCurrentOperation(), execution_thread_, and is_running_.

Here is the call graph for this function:

Member Function Documentation

◆ Configure()

absl::StatusOr< BuildTool::BuildResult > yaze::cli::agent::tools::BuildTool::Configure ( const std::string & preset)

Configure the build system with a CMake preset.

Parameters
presetThe preset name (e.g., "mac-ai", "lin-dbg", "win-ai")
Returns
Build result with configuration output

Definition at line 69 of file build_tool.cc.

References yaze::cli::agent::tools::BuildTool::BuildConfig::build_directory, config_, ExecuteCommand(), IsPresetValid(), ListAvailablePresets(), and yaze::cli::agent::tools::BuildTool::BuildConfig::verbose.

Here is the call graph for this function:

◆ Build()

absl::StatusOr< BuildTool::BuildResult > yaze::cli::agent::tools::BuildTool::Build ( const std::string & target = "",
const std::string & config = "" )

Build a specific target or all targets.

Parameters
targetThe target name (empty for all, "yaze", "yaze_test", "z3ed")
configThe build configuration (Debug, Release, RelWithDebInfo)
Returns
Build result with compilation output

Definition at line 104 of file build_tool.cc.

References yaze::cli::agent::tools::BuildTool::BuildConfig::build_directory, config_, ExecuteCommand(), IsBuildDirectoryReady(), and yaze::cli::agent::tools::BuildTool::BuildConfig::verbose.

Here is the call graph for this function:

◆ RunTests()

absl::StatusOr< BuildTool::BuildResult > yaze::cli::agent::tools::BuildTool::RunTests ( const std::string & filter = "",
const std::string & rom_path = "" )

Run tests with optional filter.

Parameters
filterTest filter pattern (e.g., "*Canvas*", "unit", "integration")
rom_pathOptional ROM path for ROM-dependent tests
Returns
Test execution result

Definition at line 138 of file build_tool.cc.

References yaze::cli::agent::tools::BuildTool::BuildConfig::build_directory, config_, ExecuteCommand(), IsBuildDirectoryReady(), and yaze::cli::agent::tools::BuildTool::BuildConfig::verbose.

Here is the call graph for this function:

◆ GetBuildStatus()

◆ Clean()

◆ IsBuildDirectoryReady()

bool yaze::cli::agent::tools::BuildTool::IsBuildDirectoryReady ( ) const

Check if a build directory exists and is configured.

Returns
true if build directory is ready

Definition at line 235 of file build_tool.cc.

References yaze::cli::agent::tools::BuildTool::BuildConfig::build_directory, and config_.

Referenced by Build(), Clean(), and RunTests().

◆ ListAvailablePresets()

std::vector< std::string > yaze::cli::agent::tools::BuildTool::ListAvailablePresets ( ) const

List available CMake presets.

Returns
Vector of preset names available for current platform

Definition at line 243 of file build_tool.cc.

References ParsePresetsFile().

Referenced by Configure(), and IsPresetValid().

Here is the call graph for this function:

◆ GetLastResult()

std::optional< BuildTool::BuildResult > yaze::cli::agent::tools::BuildTool::GetLastResult ( ) const

Get the last build result.

Returns
The most recent build operation result

Definition at line 247 of file build_tool.cc.

References last_result_, and status_mutex_.

◆ CancelCurrentOperation()

absl::Status yaze::cli::agent::tools::BuildTool::CancelCurrentOperation ( )

Cancel the current build operation.

Returns
Status of cancellation attempt

Definition at line 252 of file build_tool.cc.

References cancel_requested_, and execution_thread_.

Referenced by ~BuildTool().

◆ ExecuteCommand()

absl::StatusOr< BuildTool::BuildResult > yaze::cli::agent::tools::BuildTool::ExecuteCommand ( const std::string & command,
const std::string & operation_name )
private

Definition at line 266 of file build_tool.cc.

References config_, ExecuteCommandInternal(), is_running_, last_result_, status_mutex_, yaze::cli::agent::tools::BuildTool::BuildConfig::timeout, and UpdateStatus().

Referenced by Build(), Clean(), Configure(), and RunTests().

Here is the call graph for this function:

◆ ExecuteCommandInternal()

◆ GetProjectRoot()

std::string yaze::cli::agent::tools::BuildTool::GetProjectRoot ( ) const
private

Definition at line 439 of file build_tool.cc.

Referenced by BuildTool(), ExecuteCommandInternal(), and ParsePresetsFile().

◆ GetCurrentPlatform()

std::string yaze::cli::agent::tools::BuildTool::GetCurrentPlatform ( ) const
private

Definition at line 467 of file build_tool.cc.

Referenced by ParsePresetsFile().

◆ ParsePresetsFile()

std::vector< std::string > yaze::cli::agent::tools::BuildTool::ParsePresetsFile ( ) const
private

Definition at line 479 of file build_tool.cc.

References GetCurrentPlatform(), and GetProjectRoot().

Referenced by ListAvailablePresets().

Here is the call graph for this function:

◆ IsPresetValid()

bool yaze::cli::agent::tools::BuildTool::IsPresetValid ( const std::string & preset) const
private

Definition at line 605 of file build_tool.cc.

References ListAvailablePresets().

Referenced by Configure().

Here is the call graph for this function:

◆ UpdateStatus()

void yaze::cli::agent::tools::BuildTool::UpdateStatus ( const std::string & operation,
bool is_running )
private

Definition at line 610 of file build_tool.cc.

References current_operation_, is_running_, operation_start_time_, and status_mutex_.

Referenced by ExecuteCommand().

Member Data Documentation

◆ config_

BuildConfig yaze::cli::agent::tools::BuildTool::config_
private

◆ status_mutex_

std::mutex yaze::cli::agent::tools::BuildTool::status_mutex_
mutableprivate

Definition at line 156 of file build_tool.h.

Referenced by ExecuteCommand(), GetBuildStatus(), GetLastResult(), and UpdateStatus().

◆ is_running_

std::atomic<bool> yaze::cli::agent::tools::BuildTool::is_running_ {false}
private

Definition at line 157 of file build_tool.h.

Referenced by ExecuteCommand(), GetBuildStatus(), UpdateStatus(), and ~BuildTool().

◆ current_operation_

std::string yaze::cli::agent::tools::BuildTool::current_operation_
private

Definition at line 158 of file build_tool.h.

Referenced by GetBuildStatus(), and UpdateStatus().

◆ last_result_

std::optional<BuildResult> yaze::cli::agent::tools::BuildTool::last_result_
private

Definition at line 159 of file build_tool.h.

Referenced by ExecuteCommand(), GetBuildStatus(), and GetLastResult().

◆ operation_start_time_

std::chrono::system_clock::time_point yaze::cli::agent::tools::BuildTool::operation_start_time_
private

Definition at line 160 of file build_tool.h.

Referenced by GetBuildStatus(), and UpdateStatus().

◆ execution_thread_

std::unique_ptr<std::thread> yaze::cli::agent::tools::BuildTool::execution_thread_
private

Definition at line 161 of file build_tool.h.

Referenced by CancelCurrentOperation(), and ~BuildTool().

◆ cancel_requested_

std::atomic<bool> yaze::cli::agent::tools::BuildTool::cancel_requested_ {false}
private

Definition at line 162 of file build_tool.h.

Referenced by CancelCurrentOperation(), and ExecuteCommandInternal().


The documentation for this class was generated from the following files: