X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flib%2Fbuilder.h;h=8ab0f941f8c482774d38d1f8aecd4b86b1234d43;hb=b4781796aa997368f46b87b73a907bcab955ca3d;hp=6dc29f098d2a22a714594c4dab1262de2a65df72;hpb=c26f1550706f1f674d3040ebb42d2b35d21952ff;p=builder.git diff --git a/source/lib/builder.h b/source/lib/builder.h index 6dc29f0..8ab0f94 100644 --- a/source/lib/builder.h +++ b/source/lib/builder.h @@ -10,6 +10,7 @@ #include "buildgraph.h" #include "buildtype.h" #include "config.h" +#include "libbuilder_api.h" #include "logger.h" #include "packagemanager.h" #include "sourcepackage.h" @@ -17,7 +18,6 @@ #include "toolchain.h" #include "virtualfilesystem.h" -class FileTarget; class Package; class Plugin; @@ -25,7 +25,7 @@ class Plugin; This class ties everything else together. It also contains code for loading build files and supervising the build process. */ -class Builder +class LIBBUILDER_API Builder { private: class Loader: public Msp::DataFile::ObjectLoader @@ -54,6 +54,7 @@ private: LoadedPlugin() = default; LoadedPlugin(LoadedPlugin &&); + LoadedPlugin &operator=(LoadedPlugin &&); ~LoadedPlugin(); }; @@ -82,6 +83,14 @@ public: ~Builder(); void load_plugins(); + + template + void load_plugins(); + +private: + void add_plugins(std::vector &); + +public: PackageManager &get_package_manager() { return package_manager; } SourcePackage::ComponentRegistry &get_component_registry() { return component_registry; } @@ -111,7 +120,10 @@ public: const Logger &get_logger() const { return *logger; } std::vector collect_problems() const; +private: + void collect_broken_packages(const Package &, std::vector &) const; +public: /** Loads a build file. If opts is not null, it is used to configure any packages loaded from this file. If all is true, external packages are also configured. */ @@ -130,6 +142,20 @@ public: int do_create_makefile(); }; +template +void Builder::load_plugins() +{ + Plugin *raw_plugins[] = { new T(*this)... }; + std::vector pending_plugins; + for(Plugin *p: raw_plugins) + { + LoadedPlugin plugin; + plugin.plugin = p; + pending_plugins.emplace_back(std::move(plugin)); + } + add_plugins(pending_plugins); +} + template void Builder::call_plugins(F func) const {