]> git.tdb.fi Git - builder.git/commitdiff
Allow source packages to specify exported build info
authorMikko Rasa <tdb@tdb.fi>
Thu, 5 Jan 2023 23:00:48 +0000 (01:00 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 5 Jan 2023 23:00:48 +0000 (01:00 +0200)
source/lib/sourcepackage.cpp
source/lib/sourcepackage.h

index 1af2aa693e148831c09f72e327c349f82c0129af..5c286dda9ba39e880cc371cd797a69d7b7cb1341 100644 (file)
@@ -155,6 +155,7 @@ SourcePackage::Loader::Loader(SourcePackage &p, const Config::InputOptions *o):
 {
        add("build_info",  &Loader::build_info);
        add("description", &SourcePackage::description);
+       add("export",      &Loader::exported);
        add("feature",     &Loader::feature);
        add("generate",    &Loader::generate);
        add("install",     &Loader::component<InstallComponent>);
@@ -182,6 +183,12 @@ void SourcePackage::Loader::finish()
        }
 }
 
+void SourcePackage::Loader::exported()
+{
+       ExportLoader ldr(obj);
+       load_sub_with(ldr);
+}
+
 void SourcePackage::Loader::feature(const string &n, const string &d)
 {
        Feature feat(n);
@@ -237,3 +244,18 @@ void SourcePackage::Loader::version(const string &v)
                        break;
        obj.interface_version = obj.version.substr(0, i);
 }
+
+
+SourcePackage::ExportLoader::ExportLoader(SourcePackage &p):
+       ObjectLoader<SourcePackage>(p)
+{
+       add("build_info", &ExportLoader::build_info);
+}
+
+void SourcePackage::ExportLoader::build_info()
+{
+       BuildInfo bi;
+       load_sub(bi);
+       obj.build_info.update_from(bi);
+       obj.export_binfo.update_from(bi);
+}
index 6644262c2f710c15844e69b014c15cd018ca1359..c6e308a44c95e72696f7fc8e2b51c2a7229b242d 100644 (file)
@@ -43,6 +43,7 @@ public:
        private:
                void finish() override;
 
+               void exported();
                void feature(const std::string &, const std::string &);
                template<typename C, typename... Args>
                void component(Args..., const std::string &);
@@ -57,6 +58,15 @@ public:
        using ComponentRegistry = Msp::TypeRegistry<Loader::AddComponent, Loader &>;
 
 private:
+       class ExportLoader: public Msp::DataFile::ObjectLoader<SourcePackage>
+       {
+       public:
+               ExportLoader(SourcePackage &);
+
+       private:
+               void build_info();
+       };
+
        std::string version;
        std::string interface_version;
        std::string description;