1 #ifndef SOURCEPACKAGE_H_
2 #define SOURCEPACKAGE_H_
17 class bad_expansion: public std::runtime_error
20 bad_expansion(const std::string &w): std::runtime_error(w) { }
21 virtual ~bad_expansion() throw() { }
25 A package that can be built by Builder.
27 class SourcePackage: public Package
30 class Loader: public Msp::DataFile::DerivedObjectLoader<SourcePackage, Package::Loader>
33 const Config::InputOptions *options;
36 Loader(SourcePackage &);
37 Loader(SourcePackage &, const Config::InputOptions &);
39 void init(const Config::InputOptions *);
40 virtual void finish();
41 void feature(const std::string &, const std::string &);
42 template<Component::Type>
43 void component(const std::string &);
45 void if_feature(const std::string &);
46 void interface_version(const std::string &);
47 void source_tarball();
48 void tarball(const std::string &);
49 void version(const std::string &);
52 typedef std::list<Component> ComponentList;
55 typedef std::list<Feature> FeatureList;
58 std::string interface_version;
59 std::string description;
61 FileTarget *build_file;
62 Msp::FS::Path source_dir;
63 const BuildType *build_type;
66 ComponentList components;
67 Component *source_tarball;
72 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
74 const std::string &get_version() const { return version; }
75 const std::string &get_interface_version() const { return interface_version; }
76 const std::string &get_description() const { return description; }
78 FileTarget &get_build_file() const { return *build_file; }
79 const Msp::FS::Path &get_source_directory() const { return source_dir; }
80 Msp::FS::Path get_temp_directory() const;
81 Msp::FS::Path get_output_directory() const;
83 const ComponentList &get_components() const { return components; }
84 const Config &get_config() const { return config; }
85 bool match_feature(const std::string &) const;
86 void set_build_type(const BuildType &);
87 const BuildInfo &get_build_info() const { return build_info; }
89 virtual void do_prepare();
92 Cache &get_cache() const { return cache; }
94 virtual void save_caches();