]> git.tdb.fi Git - builder.git/commitdiff
Make BuildInfo able to handle chained dependencies
authorMikko Rasa <tdb@tdb.fi>
Fri, 27 Apr 2012 18:03:11 +0000 (21:03 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 21:08:49 +0000 (00:08 +0300)
source/buildinfo.cpp
source/buildinfo.h
source/component.cpp

index e9dcec0777e28f1201bc5a223f0853839b5d88f8..61e3162a2732b00cdec169bf2f0dcd75d7e41cef 100644 (file)
@@ -23,14 +23,17 @@ void unique(StringList &l)
 }
 
 
-void BuildInfo::update_from(const BuildInfo &bi)
+void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level)
 {
        cflags.insert(cflags.end(), bi.cflags.begin(), bi.cflags.end());
        defines.insert(defines.end(), bi.defines.begin(), bi.defines.end());
        incpath.insert(incpath.end(), bi.incpath.begin(), bi.incpath.end());
-       ldflags.insert(ldflags.end(), bi.ldflags.begin(), bi.ldflags.end());
-       libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end());
-       libs.insert(libs.end(), bi.libs.begin(), bi.libs.end());
+       if(level!=CHAINED)
+       {
+               ldflags.insert(ldflags.end(), bi.ldflags.begin(), bi.ldflags.end());
+               libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end());
+               libs.insert(libs.end(), bi.libs.begin(), bi.libs.end());
+       }
        warnings.insert(warnings.end(), bi.warnings.begin(), bi.warnings.end());
 }
 
index 0d7b64aeae4e8e82be35bfe9117cf26f7cd3c2e0..c7c89ac649e5a6089c0e8adf95b163f6d3e691c8 100644 (file)
@@ -27,6 +27,13 @@ public:
                void warning(const std::string &);
        };
        
+       enum UpdateLevel
+       {
+               LOCAL,
+               DEPENDENCY,
+               CHAINED
+       };
+
        StringList cflags;
        StringList defines;
        StringList incpath;
@@ -36,7 +43,7 @@ public:
        StringList warnings;
 
        /** Adds another BuildInfo to the end of this one. */
-       void update_from(const BuildInfo &);
+       void update_from(const BuildInfo &, UpdateLevel = LOCAL);
 
        /** Makes sure there are no duplicate entries in the lists.  For warnings,
        contradicting flags are eliminated and the last one stays in effect. */
index bb1efe41df6f055184dff6d2147dbec3eba3067a..7db9880c051b52633310b4bddfacf04b867283c7 100644 (file)
@@ -48,15 +48,10 @@ void Component::create_build_info()
        PackageList all_reqs = direct_reqs;
        for(PackageList::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i)
        {
+               BuildInfo::UpdateLevel level = BuildInfo::CHAINED;
                if(find(direct_reqs.begin(), direct_reqs.end(), *i)!=direct_reqs.end())
-                       build_info.update_from((*i)->get_exported_binfo());
-               else
-               {
-                       const BuildInfo &ebi = (*i)->get_exported_binfo();
-                       build_info.cflags.insert(build_info.cflags.end(), ebi.cflags.begin(), ebi.cflags.end());
-                       build_info.incpath.insert(build_info.incpath.end(), ebi.incpath.begin(), ebi.incpath.end());
-                       build_info.defines.insert(build_info.defines.end(), ebi.defines.begin(), ebi.defines.end());
-               }
+                       level = BuildInfo::DEPENDENCY;
+               build_info.update_from((*i)->get_exported_binfo(), level);
 
                const PackageList &reqs = (*i)->get_requires();
                for(PackageList::const_iterator j=reqs.begin(); j!=reqs.end(); ++j)