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 &);
37 template<typename C, typename... Args>
38 void component(Args..., const std::string &);
40 void generate(const std::string &);
41 void interface_version(const std::string &);
42 void source_archive();
43 void tarball(const std::string &);
44 void version(const std::string &);
49 std::string interface_version;
50 std::string description;
52 FileTarget *build_file;
53 Msp::FS::Path source_dir;
54 const BuildType *build_type = 0;
55 Toolchain local_tools;
56 std::vector<Feature> features;
58 std::vector<Component *> components;
59 SourceArchiveComponent *source_archive;
64 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
67 const std::string &get_version() const { return version; }
68 const std::string &get_interface_version() const { return interface_version; }
69 const std::string &get_description() const { return description; }
71 FileTarget &get_build_file() const { return *build_file; }
72 const Msp::FS::Path &get_source_directory() const { return source_dir; }
73 Msp::FS::Path get_temp_directory() const;
74 Msp::FS::Path get_output_directory() const;
76 const Toolchain &get_toolchain() const { return local_tools; }
77 const Component &get_component(const std::string &) const;
78 const Config &get_config() const { return config; }
79 bool match_feature(const std::string &, const std::string *) const;
80 void set_build_type(const BuildType &);
81 const BuildInfo &get_build_info() const { return build_info; }
83 void do_prepare() override;
86 Cache &get_cache() const { return cache; }
88 void save_caches() override;