From ff6852d416d73d07a85537b9c3674204865b6e68 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 25 Apr 2007 04:39:39 +0000 Subject: Groups are better integrated, and now they also auto-generate commands if there isn't already one with the same name. --- src/build.cpp | 5 +++++ src/build.h | 1 + src/buildparser.cpp | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/build.cpp b/src/build.cpp index a7421de..113f61f 100644 --- a/src/build.cpp +++ b/src/build.cpp @@ -429,3 +429,8 @@ void Build::addToGroup( const std::string &sGroup, Target *pTarget ) mGroup[sGroup].push_back( pTarget ); } +bool Build::hasAction( const std::string &str ) +{ + return mAction.find( str ) != mAction.end(); +} + diff --git a/src/build.h b/src/build.h index 768d211..0bbad0e 100644 --- a/src/build.h +++ b/src/build.h @@ -45,6 +45,7 @@ public: void addRequires( const std::string &who, const std::string &what ); void addRule( Rule *pRule ); void addAction( Action *pAction ); + bool hasAction( const std::string &str ); void addToGroup( const std::string &sGroup, Target *pTarget ); void set( const std::string &cont, const std::string &var, const std::string &val ); diff --git a/src/buildparser.cpp b/src/buildparser.cpp index 50fc0fc..a00bd73 100644 --- a/src/buildparser.cpp +++ b/src/buildparser.cpp @@ -590,6 +590,24 @@ Build *BuildParser::genBuild() bld->addAction( pAct ); } + // Now create an auto check-action for each group where there isn't already + // an action. + for( TargetTmpList::iterator i = lTargetTmp.begin(); + i != lTargetTmp.end(); i++ ) + { + for( StringList::iterator j = (*i).second.lGroups.begin(); + j != (*i).second.lGroups.end(); j++ ) + { + if( !bld->hasAction( (*j) ) ) + { + Action *pAct = new Action; + pAct->setName( *j ); + pAct->addCommand( Action::actCheck, *j, true ); + bld->addAction( pAct ); + } + } + } + return bld; } -- cgit v1.2.3