1 #ifndef SOURCEPACKAGE_H_
2 #define SOURCEPACKAGE_H_
9 #include "conditionalloader.h"
13 #include "toolchain.h"
18 class SourceArchiveComponent;
21 A package that can be built by Builder.
23 class SourcePackage: public Package
26 class Loader: public Msp::DataFile::DerivedObjectLoader<SourcePackage, Package::Loader>, public FeatureConditional
29 const Config::InputOptions *options;
32 Loader(SourcePackage &, const Config::InputOptions *);
34 void finish() override;
36 void feature(const std::string &, const std::string &);
38 void component(const std::string &);
39 template<typename C, typename A, A>
40 void component_arg(const std::string &);
42 void generate(const std::string &);
43 void interface_version(const std::string &);
44 void source_archive();
45 void tarball(const std::string &);
46 void version(const std::string &);
49 typedef std::list<Component *> ComponentList;
52 typedef std::list<Feature> FeatureList;
55 std::string interface_version;
56 std::string description;
58 FileTarget *build_file;
59 Msp::FS::Path source_dir;
60 const BuildType *build_type;
61 Toolchain local_tools;
64 ComponentList components;
65 SourceArchiveComponent *source_archive;
70 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
73 const std::string &get_version() const { return version; }
74 const std::string &get_interface_version() const { return interface_version; }
75 const std::string &get_description() const { return description; }
77 FileTarget &get_build_file() const { return *build_file; }
78 const Msp::FS::Path &get_source_directory() const { return source_dir; }
79 Msp::FS::Path get_temp_directory() const;
80 Msp::FS::Path get_output_directory() const;
82 const Toolchain &get_toolchain() const { return local_tools; }
83 const Component &get_component(const std::string &) const;
84 const Config &get_config() const { return config; }
85 bool match_feature(const std::string &, const std::string *) const;
86 void set_build_type(const BuildType &);
87 const BuildInfo &get_build_info() const { return build_info; }
89 void do_prepare() override;
92 Cache &get_cache() const { return cache; }
94 void save_caches() override;