X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fconditionalloader.cpp;h=43e613b737d263b1e84469ccc7a0af8ed072d105;hb=HEAD;hp=731c5594c312a1d9cd18cd985c325f7806f1bc96;hpb=c5169863e1ec3060d3bdc3b8c0317710ce8c3ee3;p=builder.git diff --git a/source/conditionalloader.cpp b/source/conditionalloader.cpp deleted file mode 100644 index 731c559..0000000 --- a/source/conditionalloader.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include "booleanevaluator.h" -#include "builder.h" -#include "conditionalloader.h" -#include "sourcepackage.h" - -using namespace std; -using namespace Msp; - -ArchitectureConditional::ArchitectureConditional(const Builder &b, const string &l): - builder(b), - log_prefix(l) -{ - add("if_arch", &ArchitectureConditional::if_arch); -} - -void ArchitectureConditional::if_arch(const string &cond) -{ - const Architecture &arch = builder.get_current_arch(); - BooleanEvaluator eval([&arch](const string &value, const string *){ return arch.match_name(value); }, false); - bool match = eval.evaluate(cond); - builder.get_logger().log("configure", format("%s: arch %s %smatched", log_prefix, cond, (match ? "" : "not "))); - if(match) - load_sub_with(*this); -} - - -FeatureConditional::FeatureConditional(const SourcePackage &p, const string &l): - package(p), - log_prefix(l) -{ - add("if_feature", &FeatureConditional::if_feature); -} - -void FeatureConditional::if_feature(const string &cond) -{ - BooleanEvaluator eval([this](const string &feat, const string *value){ return package.match_feature(feat, value); }); - bool match = eval.evaluate(cond); - package.get_builder().get_logger().log("configure", format("%s: feature %s %smatched", log_prefix, cond, (match ? "" : "not "))); - if(match) - load_sub_with(*this); -} - - -ConditionalLoader::ConditionalLoader(const SourcePackage &p, const string &l): - ArchitectureConditional(p.get_builder(), l), - FeatureConditional(p, l) -{ }