From d19ada0aa88aba1c7b439035c0028440ac860ec3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 12 Sep 2006 00:22:33 +0000 Subject: Build now builds, it has viewers, and dependancy checking, and everything works. Now we have to add cleaning, caching, and more viewer hooks / viewers. --- src/build.cpp | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'src/build.cpp') diff --git a/src/build.cpp b/src/build.cpp index 255cbd3..5c0b721 100644 --- a/src/build.cpp +++ b/src/build.cpp @@ -1,10 +1,14 @@ #include "build.h" +#include "function.h" +#include "viewerfactory.h" subExceptionDef( BuildException ); Build::Build() : - pStrProc( NULL ) + pStrProc( NULL ), + pView( NULL ) { + pView = ViewerFactory::getInstance().instantiate("plain"); } Build::~Build() @@ -46,6 +50,7 @@ void Build::execAction( const std::string &sWhat ) sWhat.c_str() ); Target *pTarget = mTarget[pAct->getWhat()]; + pView->beginCommand( pAct->getAct(), pAct->getWhat(), 0 ); switch( pAct->getAct() ) { case Action::actCheck: @@ -56,6 +61,7 @@ void Build::execAction( const std::string &sWhat ) pTarget->clean( *this ); break; } + pView->endCommand(); } return; @@ -234,3 +240,34 @@ void Build::debugDump() } } +RuleList Build::findChainRules( Rule *pHead ) +{ + RuleList lOut; + FunctionList &lMatches = pHead->getMatchesList(); + + for( RuleMap::iterator i = mRule.begin(); i != mRule.end(); i++ ) + { + if( (*i).second == pHead ) + continue; + + for( FunctionList::iterator j = lMatches.begin(); + j != lMatches.end(); j++ ) + { + StringList lTmp; + (*j)->execute( NULL, (*i).second->getProducesList(), lTmp ); + if( !lTmp.empty() ) + { + lOut.push_back( (*i).second ); + break; + } + } + } + + return lOut; +} + +StringList &Build::getRequires( std::string sName ) +{ + return mRequires[sName]; +} + -- cgit v1.2.3