#include "buildgraph.h"
#include "buildtype.h"
#include "config.h"
+#include "libbuilder_api.h"
#include "logger.h"
#include "packagemanager.h"
#include "sourcepackage.h"
#include "toolchain.h"
#include "virtualfilesystem.h"
-class FileTarget;
class Package;
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<Builder>
LoadedPlugin() = default;
LoadedPlugin(LoadedPlugin &&);
+ LoadedPlugin &operator=(LoadedPlugin &&);
~LoadedPlugin();
};
~Builder();
void load_plugins();
+
+ template<typename... T>
+ void load_plugins();
+
+private:
+ void add_plugins(std::vector<LoadedPlugin> &);
+
+public:
PackageManager &get_package_manager() { return package_manager; }
SourcePackage::ComponentRegistry &get_component_registry() { return component_registry; }
const Logger &get_logger() const { return *logger; }
std::vector<std::string> collect_problems() const;
+private:
+ void collect_broken_packages(const Package &, std::vector<const Package *> &) 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. */
int do_create_makefile();
};
+template<typename... T>
+void Builder::load_plugins()
+{
+ Plugin *raw_plugins[] = { new T(*this)... };
+ std::vector<LoadedPlugin> pending_plugins;
+ for(Plugin *p: raw_plugins)
+ {
+ LoadedPlugin plugin;
+ plugin.plugin = p;
+ pending_plugins.emplace_back(std::move(plugin));
+ }
+ add_plugins(pending_plugins);
+}
+
template<typename F>
void Builder::call_plugins(F func) const
{