5 #include <msp/datafile/objectloader.h>
6 #include <msp/fs/path.h>
8 #include "installmap.h"
14 Components specify things to be built. Each component may build one binary (it
15 may also build none), as well as install a bunch of headers. Components inherit
16 dependencies and build info from the package they belong to, and may also add
22 class Loader: public Msp::DataFile::ObjectLoader<Component>
28 void if_arch(const std::string &);
29 void if_feature(const std::string &);
31 void overlay(const std::string &);
32 void require(const std::string &);
33 void source(const std::string &);
34 void use(const std::string &);
47 typedef std::list<Msp::FS::Path> SourceList;
48 typedef std::list<std::string> OverlayList;
49 typedef std::list<const Component *> UseList;
52 SourcePackage &package;
59 Package::Requirements requires;
62 InstallMap install_map;
63 std::list<std::string> problems;
66 Component(SourcePackage &, Type, const std::string &);
68 const SourcePackage &get_package() const { return package; }
69 Type get_type() const { return type; }
70 const std::string &get_name() const { return name; }
72 /** Returns a list of sources for the component. They may refer to
73 directories or individual files. */
74 const SourceList &get_sources() const { return sources; }
76 const OverlayList &get_overlays() const { return overlays; }
79 /** Returns a list of all source files for the component. */
80 SourceList collect_source_files() const;
83 bool get_install() const { return install; }
84 const InstallMap &get_install_map() const { return install_map; }
85 const Package::Requirements &get_required_packages() const { return requires; }
86 const UseList &get_used_components() const { return uses; }
87 bool is_default() const { return deflt; }
88 const std::list<std::string> &get_problems() const { return problems; }
90 /** Prepares any required packages. */
93 /** Prepares the build information for building. Pulls build info from the
94 parent and dependency packages, and adds any component-specific flags. */
95 void create_build_info();
97 const BuildInfo &get_build_info() const { return build_info; }
99 BuildInfo get_build_info_for_path(const Msp::FS::Path &) const;
101 void create_targets() const;