using namespace Msp;
Analyzer::Analyzer(Builder &b):
- builder(b),
- mode(DEPS),
- max_depth(0),
- full_paths(false)
+ builder(b)
{ }
void Analyzer::analyze()
using TableRow = std::vector<std::string>;
Builder &builder;
- Mode mode;
+ Mode mode = DEPS;
std::vector<TableRow> table;
- unsigned max_depth;
- bool full_paths;
+ unsigned max_depth = 0;
+ bool full_paths = false;
std::map<const Target *, std::set<Target *> > rdepends;
public:
using namespace Msp;
AndroidManifestFile::AndroidManifestFile(Builder &b, const AndroidApplicationComponent &a):
- FileTarget(b, a.get_package(), a.get_package().get_temp_directory()/a.get_name()/"AndroidManifest.xml"),
- native_lib(0)
+ FileTarget(b, a.get_package(), a.get_package().get_temp_directory()/a.get_name()/"AndroidManifest.xml")
{
component = &a;
tool = &builder.get_toolchain().get_tool("AMG");
class AndroidManifestFile: public FileTarget
{
private:
- SharedLibrary *native_lib;
+ SharedLibrary *native_lib = 0;
std::vector<std::string> permissions;
std::string orientation;
// TODO Separate jar into its own tool and have this one just chain the two
ApkBuilder::ApkBuilder(Builder &b):
- Tool(b, "APK"),
- jarsigner(0)
+ Tool(b, "APK")
{
set_command("jar");
}
class ApkBuilder: public Tool
{
private:
- Tool *jarsigner;
+ Tool *jarsigner = 0;
public:
ApkBuilder(Builder &);
}
Architecture::Architecture(Builder &b, const string &spec):
- builder(b),
- bits(0),
- native(false)
+ builder(b)
{
if(spec.empty())
{
std::string cpu;
std::string fpu;
std::string system;
- unsigned bits;
+ unsigned bits = 0;
std::string toolchain;
std::string name;
- bool native;
+ bool native = false;
std::string cross_prefix;
std::map<std::string, std::vector<Pattern>> filename_patterns;
Builder::Builder():
package_manager(*this),
native_arch(*this, string()),
- current_arch(0),
- build_type(0),
vfs(*this),
build_graph(*this),
- logger(&default_logger),
- tempdir("temp"),
- top_loader(0)
+ logger(&default_logger)
{
set_architecture(string());
}
PackageManager package_manager;
Architecture native_arch;
- Architecture *current_arch;
+ Architecture *current_arch = 0;
std::map<std::string, BuildType> build_types;
- BuildType *build_type;
+ BuildType *build_type = 0;
Toolchain toolchain;
VirtualFileSystem vfs;
BuildGraph build_graph;
const Logger *logger;
Msp::FS::Path prefix;
- Msp::FS::Path tempdir;
+ Msp::FS::Path tempdir = "temp";
- Loader *top_loader;
+ Loader *top_loader = 0;
public:
Builder();
using namespace Msp;
BuilderCLI::BuilderCLI(int argc, char **argv):
- RegisteredApplication<BuilderCLI>("builder"),
- analyzer(0),
- build(false),
- clean(0),
- dry_run(false),
- help(false),
- show_progress(false),
- build_file("Build"),
- jobs(1),
- conf_all(false),
- conf_only(false),
- build_all(false),
- create_makefile(false)
+ RegisteredApplication<BuilderCLI>("builder")
{
string analyze_mode;
string work_dir;
Builder builder;
Logger logger;
- Analyzer *analyzer;
- bool build;
- unsigned clean;
- bool dry_run;
- bool help;
+ Analyzer *analyzer = 0;
+ bool build = false;
+ unsigned clean = 0;
+ bool dry_run = false;
+ bool help = false;
std::string helpmsg;
- bool show_progress;
- std::string build_file;
- unsigned jobs;
+ bool show_progress = false;
+ std::string build_file = "Build";
+ unsigned jobs = 1;
std::vector<std::string> what_if;
- bool conf_all;
- bool conf_only;
- bool build_all;
- bool create_makefile;
+ bool conf_all = false;
+ bool conf_only = false;
+ bool build_all = false;
+ bool create_makefile = false;
public:
BuilderCLI(int, char **);
}
-BuildInfo::BuildInfo():
- libmode(DYNAMIC),
- rpath_mode(NO_RPATH),
- threads(false),
- debug(false),
- optimize(0),
- strip(false),
- warning_level(0),
- fatal_warnings(false)
-{ }
-
BuildInfo::LibraryMode BuildInfo::get_libmode_for(const string &lib) const
{
auto i = libmodes.find(lib);
struct LanguageStandard
{
std::string type;
- unsigned year;
+ unsigned year = 0;
- LanguageStandard(): year(0) { }
+ LanguageStandard() = default;
LanguageStandard(const std::string &);
std::string str() const;
using LoadType = T;
private:
- T value;
- bool set;
+ T value{};
+ bool set = false;
public:
- Tracked(): value(T()), set(false) { }
- Tracked(T v): value(v), set(false) { }
- Tracked(const Tracked &t): value(t.value), set(t.set) { }
+ Tracked() = default;
+ Tracked(T v): value(v) { }
+ Tracked(const Tracked &t) = default;
Tracked &operator=(const Tracked &v) { if(v.set) { value = v.value; set = true; } return *this; }
Tracked &operator=(const T &v) { value = v; set = true; return *this; }
std::vector<Msp::FS::Path> local_incpath;
std::vector<Msp::FS::Path> libpath;
std::vector<std::string> libs;
- Tracked<LibraryMode> libmode;
- Tracked<RuntimePathMode> rpath_mode;
+ Tracked<LibraryMode> libmode = DYNAMIC;
+ Tracked<RuntimePathMode> rpath_mode = NO_RPATH;
std::map<std::string, LibraryMode> libmodes;
std::vector<std::string> keep_symbols;
std::map<std::string, LanguageStandard> standards;
- Tracked<bool> threads;
- Tracked<bool> debug;
- Tracked<int> optimize;
- Tracked<bool> strip;
- Tracked<unsigned> warning_level;
- Tracked<bool> fatal_warnings;
-
- BuildInfo();
+ Tracked<bool> threads = false;
+ Tracked<bool> debug = false;
+ Tracked<int> optimize = 0;
+ Tracked<bool> strip = false;
+ Tracked<unsigned> warning_level = 0;
+ Tracked<bool> fatal_warnings = false;
/** Returns the library mode for linking a particular library. If no mode
has been specified for that library, the the global library mode is
Cache::Cache(SourcePackage &p):
package(p),
- filename(package.get_temp_directory()/"../cache"),
- changed(false)
+ filename(package.get_temp_directory()/"../cache")
{ }
void Cache::set_value(const Target *tgt, const string &k, const string &v)
Msp::FS::Path filename;
std::map<Key, Values> data;
Msp::Time::TimeStamp mtime;
- mutable bool changed;
+ mutable bool changed = false;
public:
Cache(SourcePackage &p);
using namespace std;
using namespace Msp;
-ChainedTask::ChainedTask(Task *t):
- current(0),
- final_status(RUNNING)
+ChainedTask::ChainedTask(Task *t)
{
add_task(t);
}
{
private:
std::vector<Task *> tasks;
- unsigned current;
- Status final_status;
+ unsigned current = 0;
+ Status final_status = RUNNING;
public:
ChainedTask(Task *);
Component::Component(SourcePackage &p, const string &n):
package(p),
- name(n),
- install(false),
- deflt(true)
+ name(n)
{ }
void Component::prepare()
std::string name;
std::vector<Msp::FS::Path> sources;
std::vector<std::string> overlays;
- bool install;
+ bool install = false;
BuildInfo build_info;
Package::Requirements requires;
- bool deflt;
+ bool deflt = true;
InstallMap install_map;
std::vector<std::string> problems;
using namespace Msp;
Config::Config(SourcePackage &p):
- package(p),
- changed(false)
+ package(p)
{ }
const Config::Option &Config::add_option(const Feature &f)
std::map<std::string, Option> options;
InputOptions pending_options;
Msp::Time::TimeStamp mtime;
- mutable bool changed;
+ mutable bool changed = false;
public:
Config(SourcePackage &);
ExternalTask::ExternalTask(const Arguments &a, const FS::Path &wd):
argv(a),
- work_dir(wd),
- process(0),
- exit_code(-1),
- stdin_action(PASSTHROUGH),
- stdout_action(PASSTHROUGH),
- stderr_action(PASSTHROUGH),
- capture_pipe(0)
+ work_dir(wd)
{
if(argv.empty())
throw invalid_argument("ExternalTask::ExternalTask");
private:
Arguments argv;
Msp::FS::Path work_dir;
- Msp::Process *process;
- int exit_code;
- StreamAction stdin_action;
+ Msp::Process *process = 0;
+ int exit_code = -1;
+ StreamAction stdin_action = PASSTHROUGH;
Msp::FS::Path stdin_file;
- StreamAction stdout_action;
+ StreamAction stdout_action = PASSTHROUGH;
Msp::FS::Path stdout_file;
- StreamAction stderr_action;
- Msp::IO::Pipe *capture_pipe;
+ StreamAction stderr_action = PASSTHROUGH;
+ Msp::IO::Pipe *capture_pipe = 0;
std::string output;
public:
using namespace Msp;
Feature::Feature(const string &n):
- name(n),
- default_value("no"),
- exported(false)
+ name(n)
{ }
std::string name;
std::string description;
- std::string default_value;
+ std::string default_value = "no";
std::vector<std::string> choices;
- bool exported;
+ bool exported = false;
Feature(const std::string &);
};
using namespace Msp;
FileTarget::FileTarget(Builder &b, const FS::Path &a):
- Target(b, generate_name(b, 0, a)),
- path(a)
-{
- init(0);
-}
+ FileTarget(b, 0, a)
+{ }
FileTarget::FileTarget(Builder &b, const SourcePackage &p, const FS::Path &a):
- Target(b, generate_name(b, &p, a)),
- path(a)
-{
- init(&p);
-}
+ FileTarget(b, &p, a)
+{ }
-void FileTarget::init(const SourcePackage *p)
+FileTarget::FileTarget(Builder &b, const SourcePackage *p, const FS::Path &a):
+ Target(b, generate_name(b, p, a)),
+ path(a)
{
- size = 0;
package = p;
- nested_build_sig = false;
- arch_in_build_sig = false;
builder.get_vfs().register_path(path, this);
protected:
Msp::FS::Path path;
Msp::Time::TimeStamp mtime;
- unsigned size;
+ unsigned size = 0;
Msp::FS::Path install_location;
std::string install_filename;
- bool nested_build_sig;
- bool arch_in_build_sig;
+ bool nested_build_sig = false;
+ bool arch_in_build_sig = false;
FileTarget(Builder &, const Msp::FS::Path &);
FileTarget(Builder &, const SourcePackage &, const Msp::FS::Path &);
private:
- void init(const SourcePackage *);
+ FileTarget(Builder &, const SourcePackage *, const Msp::FS::Path &);
void stat();
static std::string generate_name(Builder &, const SourcePackage *, const Msp::FS::Path &);
Task *run(const Target &) const override;
};
- Linker *default_linker;
- Linker *cxx_linker;
+ Linker *default_linker = 0;
+ Linker *cxx_linker = 0;
public:
GnuLinker(Builder &, const Architecture &);
using namespace Msp;
ImportLibrary::ImportLibrary(Builder &b, const FS::Path &p):
- FileTarget(b, p),
- shared_lib(0)
+ FileTarget(b, p)
{ }
ImportLibrary::ImportLibrary(Builder &b, const Component &c, SharedLibrary &sl, ExportDefinitions &exp):
class ImportLibrary: public FileTarget
{
private:
- SharedLibrary *shared_lib;
+ SharedLibrary *shared_lib = 0;
public:
ImportLibrary(Builder &, const Msp::FS::Path &);
while((result = check())==RUNNING) ;
return result;
}
-
-
-InternalTask::Worker::Worker():
- status(Task::RUNNING)
-{ }
friend class InternalTask;
protected:
- volatile Status status;
+ volatile Status status = Task::RUNNING;
- Worker();
+ Worker() = default;
public:
Status get_status() const { return status; }
ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &s):
FileTarget(b, c.get_package(), generate_target_path(c, s.get_path())),
- source(s),
- used_in_shlib(false)
+ source(s)
{
component = &c;
add_dependency(source);
{
private:
SourceFile &source;
- bool used_in_shlib;
+ bool used_in_shlib = false;
public:
ObjectFile(Builder &, const Component &, SourceFile &);
Package::Package(Builder &b, const string &n):
builder(b),
name(n),
- label(string(1, toupper(n[0]))+n.substr(1)),
- prepared(false),
- use_pkgconfig(true)
+ label(string(1, toupper(n[0]))+n.substr(1))
{
builder.get_package_manager().add_package(this);
}
Requirements requires;
BuildInfo export_binfo;
- bool prepared;
+ bool prepared = false;
std::vector<std::string> problems;
- bool use_pkgconfig;
+ bool use_pkgconfig = true;
Package(Builder &, const std::string &);
public:
using namespace Msp;
PackageManager::PackageManager(Builder &b):
- builder(b),
- no_externals(false),
- main_pkg(0),
- env_set(false)
+ builder(b)
{ }
PackageManager::~PackageManager()
std::vector<Msp::FS::Path> pkg_dirs;
std::vector<Msp::FS::Path> binpkg_path;
std::vector<Msp::FS::Path> binpkg_files;
- bool no_externals;
+ bool no_externals = false;
std::map<std::string, Package *> packages;
- Package *main_pkg;
+ Package *main_pkg = 0;
std::set<std::string> not_found;
- bool env_set;
+ bool env_set = false;
public:
PackageManager(Builder &);
using namespace Msp;
SharedLibrary::SharedLibrary(Builder &b, const Msp::FS::Path &p):
- Binary(b, p),
- import_lib(0)
+ Binary(b, p)
{
libname = FS::basepart(FS::basename(path));
if(!libname.compare(0, 3, "lib"))
private:
std::string libname;
std::string soname;
- ImportLibrary *import_lib;
+ ImportLibrary *import_lib = 0;
public:
SharedLibrary(Builder &, const Msp::FS::Path &);
SourcePackage::SourcePackage(Builder &b, const string &n, const FS::Path &f):
Package(b, n),
source_dir(FS::dirname(f)),
- build_type(0),
config(*this),
cache(*this)
{
FileTarget *build_file;
Msp::FS::Path source_dir;
- const BuildType *build_type;
+ const BuildType *build_type = 0;
Toolchain local_tools;
std::vector<Feature> features;
BuildInfo build_info;
Target::Target(Builder &b, const string &n):
builder(b),
- package(0),
- component(0),
- name(n),
- tool(0),
- state(INIT),
- primary_target(0)
+ name(n)
{
builder.get_build_graph().add_target(this);
}
protected:
Builder &builder;
- const SourcePackage *package;
- const Component *component;
+ const SourcePackage *package = 0;
+ const Component *component = 0;
std::string name;
- Tool *tool;
- State state;
+ Tool *tool = 0;
+ State state = INIT;
std::string rebuild_reason;
std::vector<std::string> problems;
Dependencies depends;
Dependencies trans_depends;
Dependencies side_effects;
- Target *primary_target;
+ Target *primary_target = 0;
Target(Builder &, const std::string &);
public:
using namespace std;
using namespace Msp;
-Task::Task():
- unlink(false)
-{ }
-
void Task::add_file(const FS::Path &f)
{
files.push_back(f);
protected:
std::vector<Msp::FS::Path> files;
- bool unlink;
+ bool unlink = false;
- Task();
+ Task() = default;
public:
virtual ~Task() { }
using namespace Msp;
Tool::Tool(Builder &b, const string &t):
- builder(b),
- architecture(0),
- tag(t),
- executable(0),
- processing_unit(ONE_FILE),
- prepared(false)
+ Tool(b, 0, t)
{ }
Tool::Tool(Builder &b, const Architecture &a, const string &t):
+ Tool(b, &a, t)
+{ }
+
+Tool::Tool(Builder &b, const Architecture *a, const string &t):
builder(b),
- architecture(&a),
- tag(t),
- executable(0),
- processing_unit(ONE_FILE),
- prepared(false)
+ architecture(a),
+ tag(t)
{ }
void Tool::set_command(const string &cmd, bool cross)
protected:
Builder &builder;
- const Architecture *architecture;
+ const Architecture *architecture = 0;
std::string tag;
std::string command;
- FileTarget *executable;
+ FileTarget *executable = 0;
std::vector<std::string> input_suffixes;
std::vector<std::string> aux_suffixes;
- ProcessingUnit processing_unit;
+ ProcessingUnit processing_unit = ONE_FILE;
VirtualFileSystem::SearchPath system_path;
BuildInfo build_info;
- bool prepared;
+ bool prepared = false;
std::vector<std::string> problems;
Tool(Builder &, const std::string &);
Tool(Builder &, const Architecture &, const std::string &);
+private:
+ Tool(Builder &, const Architecture *, const std::string &);
public:
virtual ~Tool() { }
const std::string &get_tag() const { return tag; }
- /** Returns the architecture this tool build for. May return null if the
+ /** Returns the architecture this tool builds for. May return null if the
tool is architecture-agnostic. */
const Architecture *get_architecture() const { return architecture; }