X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcomponent.cpp;h=97fdacd66ac8f221871052be29e1727ba424b337;hb=74266a6e650f019063cdcd1c9a7bd26d8f99041b;hp=e0630e6cf8a69547ecb27f6c845f5daa6857f041;hpb=683301f94f4a3c5b7e2a7f21087f4185b07c4858;p=builder.git diff --git a/source/component.cpp b/source/component.cpp index e0630e6..97fdacd 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -10,9 +10,30 @@ Component::Component(Package &p, Type t, const string &n): install(false) { } +/** +Tries to resolve all references to packages. +*/ +void Component::resolve_refs() +{ + for(PkgRefList::iterator i=requires.begin(); i!=requires.end(); ++i) + i->resolve(); +} + +/** +Prepares the build information for building. +*/ void Component::create_build_info() { build_info.add(pkg.get_build_info()); + + for(PkgRefList::iterator i=requires.begin(); i!=requires.end(); ++i) + { + if(!i->get_package()) + continue; + i->get_package()->create_build_info(); + build_info.add(i->get_package()->get_exported_binfo()); + } + build_info.unique(); } @@ -23,6 +44,7 @@ Component::Loader::Loader(Component &c): add("install", &Component::install); add("install_headers", &Component::install_headers); add("build_info", &Loader::build_info); + add("require", &Loader::require); } void Component::Loader::source(const string &s) @@ -30,6 +52,11 @@ void Component::Loader::source(const string &s) comp.sources.push_back(comp.pkg.get_source()/s); } +void Component::Loader::require(const string &n) +{ + comp.requires.push_back(PackageRef(comp.pkg.get_builder(), n)); +} + void Component::Loader::build_info() { load_sub(comp.build_info);