5 #include <msp/datafile/objectloader.h>
6 #include <msp/fs/path.h>
8 #include "conditionalloader.h"
9 #include "installmap.h"
15 Components specify things to be built. Each component may build one binary (it
16 may also build none), as well as install a bunch of headers. Components inherit
17 dependencies and build info from the package they belong to, and may also add
23 class Loader: public Msp::DataFile::ObjectLoader<Component>, public ConditionalLoader
30 void overlay(const std::string &);
31 void require(const std::string &);
32 void source(const std::string &);
36 SourcePackage &package;
38 std::list<Msp::FS::Path> sources;
39 std::list<std::string> overlays;
42 Package::Requirements requires;
44 InstallMap install_map;
45 std::list<std::string> problems;
47 Component(SourcePackage &, const std::string &);
49 virtual ~Component() { }
51 const SourcePackage &get_package() const { return package; }
52 const std::string &get_name() const { return name; }
54 /** Returns a list of sources for the component. They may refer to
55 directories or individual files. */
56 const std::list<Msp::FS::Path> &get_sources() const { return sources; }
58 const std::list<std::string> &get_overlays() const { return overlays; }
61 /** Returns a list of all source files for the component. */
62 std::list<Msp::FS::Path> collect_source_files() const;
65 bool get_install() const { return install; }
66 const InstallMap &get_install_map() const { return install_map; }
67 const Package::Requirements &get_required_packages() const { return requires; }
68 bool is_default() const { return deflt; }
69 const std::list<std::string> &get_problems() const { return problems; }
71 /** Prepares any required packages. */
74 /** Prepares the build information for building. Pulls build info from the
75 parent and dependency packages, and adds any component-specific flags. */
76 virtual void create_build_info();
78 virtual void update_exported_build_info(BuildInfo &) const { }
80 const BuildInfo &get_build_info() const { return build_info; }
82 BuildInfo get_build_info_for_path(const Msp::FS::Path &) const;
84 virtual void create_targets() const = 0;