X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuilder.h;h=eecbb984304225e1768f683c4ee154e80a33b74d;hb=93db1636eac4ded5d89555d4c7e06b2126c3e4b0;hp=e524864564cfee83b64d59acddea2709eb334b6e;hpb=c51884994862b02613c2c0ae75b1f8d39e0f1ee5;p=builder.git diff --git a/source/builder.h b/source/builder.h index e524864..eecbb98 100644 --- a/source/builder.h +++ b/source/builder.h @@ -8,6 +8,7 @@ #include #include #include "architecture.h" +#include "buildtype.h" #include "config.h" #include "logger.h" #include "misc.h" @@ -18,14 +19,13 @@ #include "virtualfilesystem.h" class Analyzer; -class Config; class FileTarget; class Package; class SourcePackage; -class VirtualTarget; /** -The main application class. Controls and owns everything. Rules the world. +The main application class. Handles command line options and supervises the +build process. */ class Builder: public Msp::RegisteredApplication { @@ -38,32 +38,21 @@ private: public: Loader(Builder &, const Msp::FS::Path &); private: + void architecture(const std::string &); void binpkg(const std::string &); - void cross_prefix(const std::string &, const std::string &); + void build_type(const std::string &); void profile(const std::string &); void package(const std::string &); }; - class ProfileLoader: public Msp::DataFile::Loader - { - private: - StringMap &profile; - - public: - ProfileLoader(StringMap &); - private: - void option(const std::string &, const std::string &); - }; - public: typedef std::map TargetMap; - typedef std::list TargetList; private: - typedef std::map ProfileTemplateMap; + typedef std::map BuildTypeMap; StringList cmdline_targets; - StringMap cmdline_options; + Config::InputOptions cmdline_options; Msp::FS::Path cwd; PackageManager package_manager; @@ -73,8 +62,8 @@ private: Architecture native_arch; Architecture *current_arch; - StringMap cross_prefixes; - ProfileTemplateMap profile_tmpl; + BuildTypeMap build_types; + BuildType *build_type; Toolchain toolchain; VirtualFileSystem vfs; Logger logger; @@ -94,6 +83,7 @@ private: bool build_all; bool create_makefile; Msp::FS::Path prefix; + Msp::FS::Path tempdir; StringList warnings; static std::string usagemsg; @@ -114,12 +104,12 @@ public: const TargetMap &get_targets() const { return targets; } - const Msp::FS::Path &get_cwd() const { return cwd; } + const Msp::FS::Path &get_work_directory() const { return cwd; } const Architecture &get_current_arch() const { return *current_arch; } const Architecture &get_native_arch() const { return native_arch; } const Msp::FS::Path &get_prefix() const { return prefix; } + const Msp::FS::Path &get_temp_directory() const { return tempdir; } const StringList &get_warnings() const { return warnings; } - void apply_profile_template(Config &, const std::string &) const; const Toolchain &get_toolchain() const { return toolchain; } VirtualFileSystem &get_vfs() { return vfs; } @@ -128,7 +118,6 @@ public: /** Adds a target to both the target map and the new target queue. Called from Target constructor. */ void add_target(Target *); - void register_path(const Msp::FS::Path &, FileTarget *); void problem(const std::string &, const std::string &); @@ -139,12 +128,12 @@ public: int load_build_file(const Msp::FS::Path &); private: - /** Creates targets for all packages and prepares them for building. - Returns 0 if everything went ok, -1 if something bad happened and a build - shouldn't be attempted. */ - int create_targets(); + /** Prepares packages and targets for building. Returns true if everything + went ok, or false if something bad happened and a build shouldn't be + attempted. */ + bool prepare_build(); - /** Supervises the build process, starting new actions when slots become + /** Supervises the build process, starting new tasks when slots become available. */ int do_build();