aboutsummaryrefslogtreecommitdiff
path: root/src/profile.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-01-06 17:05:45 +0000
committerMike Buland <eichlan@xagasoft.com>2010-01-06 17:05:45 +0000
commit3c7e81d3baba06cb1bf37de84aeaa6cad277652a (patch)
tree166e9309a0be01e6b4e8591434372e4817a65d76 /src/profile.cpp
parente809677b1d5a02b93a0be7a9fce8a6b67d0d91be (diff)
downloadbuild-3c7e81d3baba06cb1bf37de84aeaa6cad277652a.tar.gz
build-3c7e81d3baba06cb1bf37de84aeaa6cad277652a.tar.bz2
build-3c7e81d3baba06cb1bf37de84aeaa6cad277652a.tar.xz
build-3c7e81d3baba06cb1bf37de84aeaa6cad277652a.zip
Wow, ok, well, I added some more error handling, that's positive, also switched
conditions and functions to a plugger system like views, and all of them now load builtin and external plugins flawlessly. It's actually a lot of fun. I also added the example/test plugin condition "random" it randomly builds targets...it's not really useful...
Diffstat (limited to '')
-rw-r--r--src/profile.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/profile.cpp b/src/profile.cpp
index 878a6e9..fd21097 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -4,9 +4,7 @@
4#include "astleaf.h" 4#include "astleaf.h"
5#include "condition.h" 5#include "condition.h"
6 6
7#include "conditionfiletime.h" 7#include "conditionplugger.h"
8#include "conditionalways.h"
9#include "conditionnever.h"
10 8
11#include <bu/sio.h> 9#include <bu/sio.h>
12using namespace Bu; 10using namespace Bu;
@@ -64,7 +62,7 @@ Profile *Profile::genDefaultClean()
64 pAst->openBranch(); 62 pAst->openBranch();
65 pAst->addNode( AstNode::typeString, "clean" ); 63 pAst->addNode( AstNode::typeString, "clean" );
66 pAst->openBranch(); 64 pAst->openBranch();
67 pAst->addNode( AstNode::typeCondition, "always" ); 65 pAst->addNode( AstNode::typeCondition, "fileExists" );
68 pAst->addNode( AstNode::typeFunction ); 66 pAst->addNode( AstNode::typeFunction );
69 pAst->openBranch(); 67 pAst->openBranch();
70 pAst->addNode( AstNode::typeString, "unlink" ); 68 pAst->addNode( AstNode::typeString, "unlink" );
@@ -89,28 +87,15 @@ void Profile::setCondition()
89 if( (*i)->getType() == AstNode::typeCondition ) 87 if( (*i)->getType() == AstNode::typeCondition )
90 { 88 {
91 Bu::FString sCond = dynamic_cast<const AstLeaf *>(*i)->getStrValue(); 89 Bu::FString sCond = dynamic_cast<const AstLeaf *>(*i)->getStrValue();
92 if( sCond == "filetime" ) 90 delete pCond;
93 { 91 pCond = ConditionPlugger::getInstance().instantiate( sCond );
94 delete pCond;
95 pCond = new ConditionFileTime();
96 }
97 else if( sCond == "always" )
98 {
99 delete pCond;
100 pCond = new ConditionAlways();
101 }
102 else if( sCond == "never" )
103 {
104 delete pCond;
105 pCond = new ConditionNever();
106 }
107 } 92 }
108 } 93 }
109 94
110 if( pCond == NULL ) 95 if( pCond == NULL )
111 { 96 {
112 // The default condition 97 // The default condition
113 pCond = new ConditionFileTime(); 98 pCond = ConditionPlugger::getInstance().instantiate("fileTime");
114 } 99 }
115} 100}
116 101