#include <map>
#include <string>
+#include <msp/core/module.h>
#include <msp/datafile/loader.h>
#include <msp/fs/path.h>
#include "architecture.h"
#include "buildgraph.h"
#include "buildtype.h"
#include "config.h"
+#include "libbuilder_api.h"
#include "logger.h"
#include "packagemanager.h"
+#include "sourcepackage.h"
#include "target.h"
#include "toolchain.h"
#include "virtualfilesystem.h"
-class FileTarget;
class Package;
-class SourcePackage;
+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>
};
private:
+ struct LoadedPlugin
+ {
+ Msp::FS::Path path;
+ Msp::Module *module = nullptr;
+ Plugin *plugin = nullptr;
+
+ LoadedPlugin() = default;
+ LoadedPlugin(LoadedPlugin &&);
+ LoadedPlugin &operator=(LoadedPlugin &&);
+ ~LoadedPlugin();
+ };
+
+ std::vector<LoadedPlugin> plugins;
PackageManager package_manager;
+ SourcePackage::ComponentRegistry component_registry;
Architecture native_arch;
Architecture *current_arch = 0;
Builder();
~Builder();
+ void load_plugins();
PackageManager &get_package_manager() { return package_manager; }
+ SourcePackage::ComponentRegistry &get_component_registry() { return component_registry; }
+
+ template<typename F>
+ void call_plugins(F) const;
void set_architecture(const std::string &);
const Architecture &get_current_arch() const { return *current_arch; }
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 F>
+void Builder::call_plugins(F func) const
+{
+ for(const LoadedPlugin &p: plugins)
+ func(*p.plugin);
+}
+
#endif