From: Mikko Rasa Date: Thu, 5 Jan 2023 23:00:48 +0000 (+0200) Subject: Allow source packages to specify exported build info X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=bcc6be0d72c9205ca9282fc08d1dba93230e9f2a;p=builder.git Allow source packages to specify exported build info --- diff --git a/source/lib/sourcepackage.cpp b/source/lib/sourcepackage.cpp index 1af2aa6..5c286dd 100644 --- a/source/lib/sourcepackage.cpp +++ b/source/lib/sourcepackage.cpp @@ -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); @@ -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(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); +} diff --git a/source/lib/sourcepackage.h b/source/lib/sourcepackage.h index 6644262..c6e308a 100644 --- a/source/lib/sourcepackage.h +++ b/source/lib/sourcepackage.h @@ -43,6 +43,7 @@ public: private: void finish() override; + void exported(); void feature(const std::string &, const std::string &); template void component(Args..., const std::string &); @@ -57,6 +58,15 @@ public: using ComponentRegistry = Msp::TypeRegistry; private: + class ExportLoader: public Msp::DataFile::ObjectLoader + { + public: + ExportLoader(SourcePackage &); + + private: + void build_info(); + }; + std::string version; std::string interface_version; std::string description;