simplify build code

This commit is contained in:
Garux
2024-01-24 17:09:04 +06:00
parent ecdad801b9
commit 9a13f9ed55
13 changed files with 40 additions and 95 deletions

View File

@@ -468,7 +468,7 @@ void project_verify( Project& project, Tools& tools ){
#endif
}
void build_run( size_t buildIdx, CommandListener& listener ){
std::vector<CopiedString> build_construct_commands( size_t buildIdx ){
for ( const auto& [ name, tool ] : g_build_tools )
{
StringBuffer output;
@@ -476,6 +476,8 @@ void build_run( size_t buildIdx, CommandListener& listener ){
build_set_variable( name.c_str(), output.c_str() );
}
std::vector<CopiedString> commands;
if ( const auto buildIt = Project_find( g_build_project, buildIdx ); buildIt != g_build_project.end() )
{
g_lastExecutedBuild = buildIt;
@@ -484,13 +486,15 @@ void build_run( size_t buildIdx, CommandListener& listener ){
StringBuffer output;
command.evaluate( output );
if ( !output.empty() )
listener.execute( output.c_str() );
commands.emplace_back( output.c_str() );
}
}
else
{
globalErrorStream() << "build #" << buildIdx << " not defined";
}
return commands;
}