diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/build.cpp | 21 | ||||
| -rw-r--r-- | src/build.h | 2 | ||||
| -rw-r--r-- | src/target.cpp | 19 | ||||
| -rw-r--r-- | src/target.h | 10 | ||||
| -rw-r--r-- | src/targetfile.cpp | 1 |
5 files changed, 42 insertions, 11 deletions
diff --git a/src/build.cpp b/src/build.cpp index c81c885..5121d1f 100644 --- a/src/build.cpp +++ b/src/build.cpp | |||
| @@ -86,16 +86,8 @@ void Build::execAction( const std::string &sWhat ) | |||
| 86 | ); | 86 | ); |
| 87 | Target *pTarget = mTarget[pAct->getWhat()]; | 87 | Target *pTarget = mTarget[pAct->getWhat()]; |
| 88 | pView->beginCommand( pAct->getAct(), pAct->getWhat() ); | 88 | pView->beginCommand( pAct->getAct(), pAct->getWhat() ); |
| 89 | switch( pAct->getAct() ) | 89 | if( !pTarget->wasRun() ) |
| 90 | { | 90 | pTarget->run( pAct->getAct(), *this ); |
| 91 | case Action::actCheck: | ||
| 92 | pTarget->check( *this ); | ||
| 93 | break; | ||
| 94 | |||
| 95 | case Action::actClean: | ||
| 96 | pTarget->clean( *this ); | ||
| 97 | break; | ||
| 98 | } | ||
| 99 | pView->endCommand(); | 91 | pView->endCommand(); |
| 100 | } | 92 | } |
| 101 | 93 | ||
| @@ -363,3 +355,12 @@ void Build::updateCache( const std::string &sID, FunctionList &lFunc, StringList | |||
| 363 | bCacheUpdated = true; | 355 | bCacheUpdated = true; |
| 364 | } | 356 | } |
| 365 | 357 | ||
| 358 | void Build::chainTarget( const std::string &sName ) | ||
| 359 | { | ||
| 360 | TargetMap::iterator i = mTarget.find(sName); | ||
| 361 | if( i == mTarget.end() ) return; | ||
| 362 | |||
| 363 | if( !(*i).second->wasRun() ) | ||
| 364 | (*i).second->run( Action::actCheck, *this ); | ||
| 365 | } | ||
| 366 | |||
diff --git a/src/build.h b/src/build.h index 9229617..6e98405 100644 --- a/src/build.h +++ b/src/build.h | |||
| @@ -74,6 +74,8 @@ public: | |||
| 74 | bool getCached( const std::string &sID, int nTime, StringList &lOut ); | 74 | bool getCached( const std::string &sID, int nTime, StringList &lOut ); |
| 75 | void updateCache( const std::string &sID, FunctionList &lFunc, StringList &lOut ); | 75 | void updateCache( const std::string &sID, FunctionList &lFunc, StringList &lOut ); |
| 76 | 76 | ||
| 77 | void chainTarget( const std::string &sName ); | ||
| 78 | |||
| 77 | private: | 79 | private: |
| 78 | TargetMap mTarget; | 80 | TargetMap mTarget; |
| 79 | ReqMap mRequires; | 81 | ReqMap mRequires; |
diff --git a/src/target.cpp b/src/target.cpp index 834dbaa..a26f76f 100644 --- a/src/target.cpp +++ b/src/target.cpp | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #include "target.h" | 1 | #include "target.h" |
| 2 | 2 | ||
| 3 | Target::Target() | 3 | Target::Target() : |
| 4 | bRun( false ) | ||
| 4 | { | 5 | { |
| 5 | } | 6 | } |
| 6 | 7 | ||
| @@ -8,3 +9,19 @@ Target::~Target() | |||
| 8 | { | 9 | { |
| 9 | } | 10 | } |
| 10 | 11 | ||
| 12 | void Target::run( Action::eAction nAct, Build &bld ) | ||
| 13 | { | ||
| 14 | bRun = true; | ||
| 15 | |||
| 16 | switch( nAct ) | ||
| 17 | { | ||
| 18 | case Action::actCheck: | ||
| 19 | check( bld ); | ||
| 20 | break; | ||
| 21 | |||
| 22 | case Action::actClean: | ||
| 23 | clean( bld ); | ||
| 24 | break; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
diff --git a/src/target.h b/src/target.h index 5325965..f51e0e0 100644 --- a/src/target.h +++ b/src/target.h | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | #include <string> | 6 | #include <string> |
| 7 | #include <list> | 7 | #include <list> |
| 8 | 8 | ||
| 9 | #include "action.h" | ||
| 10 | |||
| 9 | typedef std::list<std::string> StringList; | 11 | typedef std::list<std::string> StringList; |
| 10 | 12 | ||
| 11 | class Build; | 13 | class Build; |
| @@ -16,6 +18,7 @@ public: | |||
| 16 | Target(); | 18 | Target(); |
| 17 | virtual ~Target(); | 19 | virtual ~Target(); |
| 18 | 20 | ||
| 21 | void run( Action::eAction nAct, Build &bld ); | ||
| 19 | virtual void check( Build &bld ) = 0; | 22 | virtual void check( Build &bld ) = 0; |
| 20 | virtual void clean( Build &bld ) = 0; | 23 | virtual void clean( Build &bld ) = 0; |
| 21 | 24 | ||
| @@ -44,10 +47,17 @@ public: | |||
| 44 | return lInput; | 47 | return lInput; |
| 45 | } | 48 | } |
| 46 | 49 | ||
| 50 | bool wasRun() | ||
| 51 | { | ||
| 52 | return bRun; | ||
| 53 | } | ||
| 54 | |||
| 55 | |||
| 47 | private: | 56 | private: |
| 48 | std::string sName; | 57 | std::string sName; |
| 49 | std::string sRule; | 58 | std::string sRule; |
| 50 | StringList lInput; | 59 | StringList lInput; |
| 60 | bool bRun; | ||
| 51 | }; | 61 | }; |
| 52 | 62 | ||
| 53 | #endif | 63 | #endif |
diff --git a/src/targetfile.cpp b/src/targetfile.cpp index 6ea83d5..950fc7b 100644 --- a/src/targetfile.cpp +++ b/src/targetfile.cpp | |||
| @@ -32,6 +32,7 @@ void TargetFile::check( Build &bld ) | |||
| 32 | bool bExtras = false; | 32 | bool bExtras = false; |
| 33 | for( StringList::iterator j = reqs.begin(); j != reqs.end(); j++ ) | 33 | for( StringList::iterator j = reqs.begin(); j != reqs.end(); j++ ) |
| 34 | { | 34 | { |
| 35 | bld.chainTarget( *j ); | ||
| 35 | if( getTime( bld, *j ) > tTarget ) | 36 | if( getTime( bld, *j ) > tTarget ) |
| 36 | { | 37 | { |
| 37 | bld.getView()->beginPerform( *i ); | 38 | bld.getView()->beginPerform( *i ); |
