};
private:
- typedef std::vector<std::string> TableRow;
- typedef std::list<TableRow> Table;
+ using TableRow = std::vector<std::string>;
Builder &builder;
Mode mode;
- Table table;
+ std::list<TableRow> table;
unsigned max_depth;
bool full_paths;
std::map<const Target *, std::set<Target *> > rdepends;
Loader(Architecture &);
};
- typedef std::list<Pattern> PatternList;
-
private:
Builder &builder;
std::string type;
std::string name;
bool native;
std::string cross_prefix;
- std::map<std::string, PatternList> filename_patterns;
+ std::map<std::string, std::list<Pattern>> filename_patterns;
public:
Architecture(Builder &b, const std::string &spec);
const std::string &get_cross_prefix() const { return cross_prefix; }
template<typename T>
- const PatternList &get_patterns() const;
+ const std::list<Pattern> &get_patterns() const;
template<typename T>
std::string create_filename(const std::string &) const;
};
template<typename T>
-inline const Architecture::PatternList &Architecture::get_patterns() const
+inline const std::list<Pattern> &Architecture::get_patterns() const
{
auto i = filename_patterns.find(typeid(T).name());
if(i!=filename_patterns.end())
return i->second;
- static PatternList empty;
+ static std::list<Pattern> empty;
return empty;
}
template<typename T>
inline std::string Architecture::create_filename(const std::string &base) const
{
- const PatternList &patterns = get_patterns<T>();
+ const std::list<Pattern> &patterns = get_patterns<T>();
return patterns.empty() ? base : patterns.front().apply(base);
}
const Toolchain &pkg_tools = package.get_toolchain();
list<Target *> objs;
- SourceList source_filenames = collect_source_files();
+ list<FS::Path> source_filenames = collect_source_files();
for(auto i=source_filenames.begin(); i!=source_filenames.end(); ++i)
{
string ext = FS::extpart(FS::basename(*i));
};
private:
- typedef std::list<const Component *> UseList;
-
Type type;
- UseList uses;
+ std::list<const Component *> uses;
public:
BinaryComponent(SourcePackage &, const std::string &, Type);
prefix /= arch.get_cross_prefix();
}
- BuildInfo::PathList libpath = export_binfo.libpath;
+ VirtualFileSystem::SearchPath libpath = export_binfo.libpath;
if(!system && libpath.empty())
libpath.push_back("lib");
for(FS::Path &p: libpath)
for(const string &l: export_binfo.libs)
all_found &= (builder.get_vfs().find_library(l, libpath, export_binfo.libmode, system)!=0);
- BuildInfo::PathList incpath = export_binfo.incpath;
+ VirtualFileSystem::SearchPath incpath = export_binfo.incpath;
if(!system && incpath.empty())
incpath.push_back("include");
for(FS::Path &p: incpath)
if(!static_binfo.libs.empty())
{
- BuildInfo::PathList combined_libpath = static_binfo.libpath;
+ VirtualFileSystem::SearchPath combined_libpath = static_binfo.libpath;
combined_libpath.insert(combined_libpath.end(), export_binfo.libpath.begin(), export_binfo.libpath.end());
for(const string &l: export_binfo.libs)
void header(const std::string &);
};
- typedef std::vector<std::string> Flags;
+ using Flags = std::vector<std::string>;
private:
- typedef std::list<std::string> HeaderList;
-
Msp::FS::Path base_path;
- HeaderList headers;
+ std::list<std::string> headers;
BuildInfo static_binfo;
public:
};
private:
- typedef std::map<std::string, BuildType> BuildTypeMap;
-
PackageManager package_manager;
Architecture native_arch;
Architecture *current_arch;
- BuildTypeMap build_types;
+ std::map<std::string, BuildType> build_types;
BuildType *build_type;
Toolchain toolchain;
VirtualFileSystem vfs;
SourcePackage &main_pkg = dynamic_cast<SourcePackage &>(package_manager.get_main_package());
const Config &config = main_pkg.get_config();
- const Config::OptionMap &options = config.get_options();
+ const auto &options = config.get_options();
const Package::Requirements &requires = main_pkg.get_required_packages();
if(!requires.empty() || !options.empty())
class BuilderCLI: public Msp::RegisteredApplication<BuilderCLI>
{
private:
- typedef std::list<std::string> NameList;
-
- NameList cmdline_targets;
+ std::list<std::string> cmdline_targets;
Config::InputOptions cmdline_options;
Msp::FS::Path cwd;
bool show_progress;
std::string build_file;
unsigned jobs;
- NameList what_if;
+ std::list<std::string> what_if;
bool conf_all;
bool conf_only;
bool build_all;
*/
class BuildGraph
{
-public:
- typedef std::map<std::string, Target *> TargetMap;
-
private:
Builder &builder;
- TargetMap targets;
+ std::map<std::string, Target *> targets;
Target *goals;
public:
/** Looks up a target by name. Returns 0 if no such target exists. */
Target *get_target(const std::string &) const;
- const TargetMap &get_targets() const { return targets; }
+ const std::map<std::string, Target *> &get_targets() const { return targets; }
/** Adds a target. It can later be retrieved by name. Called from Target
constructor. */
class Tracked
{
public:
- typedef T LoadType;
+ using LoadType = T;
private:
T value;
operator const T &() const { return value; }
};
- typedef std::map<std::string, std::string> DefineMap;
- typedef std::list<Msp::FS::Path> PathList;
- typedef std::list<std::string> WordList;
- typedef std::map<std::string, LibraryMode> LibModeMap;
- typedef std::map<std::string, LanguageStandard> StandardMap;
-
Tracked<Msp::FS::Path> sysroot;
- DefineMap defines;
- PathList incpath;
- PathList local_incpath;
- PathList libpath;
- WordList libs;
+ std::map<std::string, std::string> defines;
+ std::list<Msp::FS::Path> incpath;
+ std::list<Msp::FS::Path> local_incpath;
+ std::list<Msp::FS::Path> libpath;
+ std::list<std::string> libs;
Tracked<LibraryMode> libmode;
Tracked<RuntimePathMode> rpath_mode;
- LibModeMap libmodes;
- WordList keep_symbols;
- StandardMap standards;
+ std::map<std::string, LibraryMode> libmodes;
+ std::list<std::string> keep_symbols;
+ std::map<std::string, LanguageStandard> standards;
Tracked<bool> threads;
Tracked<bool> debug;
Tracked<int> optimize;
void Cache::set_value(const Target *tgt, const string &k, const string &v)
{
- ValueList vl;
+ Values vl;
vl.push_back(v);
set_values(tgt, k, vl);
}
Key key(tgt->get_name(), k);
auto i = data.find(key);
if(i==data.end())
- i = data.insert({ key, ValueList() }).first;
+ i = data.insert({ key, Values() }).first;
i->second.push_back(v);
changed = true;
package.get_builder().get_logger().log("cache", format("Updated key %s %s+ %s", tgt->get_name(), k, v));
}
-void Cache::set_values(const Target *tgt, const string &k, const ValueList &v)
+void Cache::set_values(const Target *tgt, const string &k, const Values &v)
{
data[Key(tgt->get_name(), k)] = v;
changed = true;
const string &Cache::get_value(const Target *tgt, const string &k)
{
- const ValueList &values = get_values(tgt, k);
+ const Values &values = get_values(tgt, k);
if(values.empty())
throw logic_error("values.empty()");
return values.front();
}
-const Cache::ValueList &Cache::get_values(const Target *tgt, const string &k)
+const Cache::Values &Cache::get_values(const Target *tgt, const string &k)
{
return get_item(data, Key(tgt->get_name(), k));
}
key.second = read_string(in);
if(key.first.empty() || key.second.empty())
break;
- ValueList &values = data[key];
+ Values &values = data[key];
for(unsigned count = read_count(in); count; --count)
values.push_back(read_string(in));
package.get_builder().get_logger().log("cache", format("Loaded key %s %s: %s", key.first, key.second, join(values.begin(), values.end())));
class Cache
{
public:
- typedef std::list<std::string> ValueList;
+ using Values = std::list<std::string>;
private:
- typedef std::pair<std::string, std::string> Key;
- typedef std::map<Key, ValueList> DataMap;
+ using Key = std::pair<std::string, std::string>;
SourcePackage &package;
Msp::FS::Path filename;
- DataMap data;
+ std::map<Key, Values> data;
Msp::Time::TimeStamp mtime;
mutable bool changed;
void append_value(const Target *, const std::string &, const std::string &);
/// Sets a key to a list of values, replacing any existing values.
- void set_values(const Target *, const std::string &, const ValueList &);
+ void set_values(const Target *, const std::string &, const Values &);
/** Returns the first value from a key. The key must exist and be
non-empty. */
const std::string &get_value(const Target *, const std::string &);
/// Returns the values from a key. The key must exist.
- const ValueList &get_values(const Target *, const std::string &);
+ const Values &get_values(const Target *, const std::string &);
/// Indicates whether a key exists.
bool has_key(const Target *, const std::string &);
return binfo;
}
-Component::SourceList Component::collect_source_files() const
+list<FS::Path> Component::collect_source_files() const
{
- SourceList files;
+ list<FS::Path> files;
for(const FS::Path &p: sources)
{
if(FS::is_dir(p))
{
- SourceList dirs;
+ list<FS::Path> dirs;
dirs.push_back(p);
for(const string &o: overlays)
{
void source(const std::string &);
};
- typedef std::list<Msp::FS::Path> SourceList;
- typedef std::list<std::string> OverlayList;
-
protected:
SourcePackage &package;
std::string name;
- SourceList sources;
- OverlayList overlays;
+ std::list<Msp::FS::Path> sources;
+ std::list<std::string> overlays;
bool install;
BuildInfo build_info;
Package::Requirements requires;
/** Returns a list of sources for the component. They may refer to
directories or individual files. */
- const SourceList &get_sources() const { return sources; }
+ const std::list<Msp::FS::Path> &get_sources() const { return sources; }
- const OverlayList &get_overlays() const { return overlays; }
+ const std::list<std::string> &get_overlays() const { return overlays; }
protected:
/** Returns a list of all source files for the component. */
- SourceList collect_source_files() const;
+ std::list<Msp::FS::Path> collect_source_files() const;
public:
bool get_install() const { return install; }
Option(const Feature &);
};
- typedef std::map<std::string, Option> OptionMap;
- typedef std::map<std::string, std::string> InputOptions;
+ using InputOptions = std::map<std::string, std::string>;
private:
class Loader: public Msp::DataFile::ObjectLoader<Config>
};
SourcePackage &package;
- OptionMap options;
+ std::map<std::string, Option> options;
InputOptions pending_options;
Msp::Time::TimeStamp mtime;
mutable bool changed;
/** Gets a configuration option by name. */
const Option &get_option(const std::string &) const;
- const OptionMap &get_options() const { return options; }
+ const std::map<std::string, Option> &get_options() const { return options; }
const Msp::Time::TimeStamp &get_mtime() const { return mtime; }
void load();
}
const BuildInfo &build_info = component->get_build_info_for_path(path);
- const BuildInfo::PathList &incpath = build_info.incpath;
- BuildInfo::PathList local_incpath = incpath;
+ const auto &incpath = build_info.incpath;
+ VirtualFileSystem::SearchPath local_incpath = incpath;
local_incpath.insert(local_incpath.begin(), build_info.local_incpath.begin(), build_info.local_incpath.end());
local_incpath.push_front(FS::dirname(path).str());
*/
class CSourceFile: public SourceFile
{
-public:
- typedef std::list<std::string> IncludeList;
-
protected:
- IncludeList includes;
+ std::list<std::string> includes;
public:
CSourceFile(Builder &, const Msp::FS::Path &);
CSourceFile(Builder &, const Component &, const Msp::FS::Path &);
const char *get_type() const override { return "CSourceFile"; }
- const IncludeList &get_includes() const { return includes; }
+ const std::list<std::string> &get_includes() const { return includes; }
protected:
virtual void parse_includes(Msp::IO::Base &);
void find_dependencies() override;
class DataPack: public FileTarget
{
-public:
- typedef std::list<FileTarget *> FileList;
private:
- FileList files;
+ std::list<FileTarget *> files;
public:
DataPack(Builder &, const Component &, const std::list<FileTarget *> &);
public:
const char *get_type() const override { return "DataPack"; }
- const FileList &get_files() const { return files; }
+ const std::list<FileTarget *> &get_files() const { return files; }
};
#endif
IGNORE //< Redirect the stream to oblivion
};
- typedef Msp::Process::Arguments Arguments;
+ using Arguments = Msp::Process::Arguments;
private:
Arguments argv;
{
const Binary &bin = dynamic_cast<const Binary &>(target);
- vector<string> argv;
+ ExternalTask::Arguments argv;
argv.push_back(executable->get_path().str());
FS::Path work_dir = bin.get_component()->get_package().get_source_directory();
void require(const std::string &);
};
- typedef std::list<Package *> Requirements;
+ using Requirements = std::list<Package *>;
protected:
Builder &builder;
*/
class PackageManager
{
-public:
- typedef std::map<std::string, Package *> PackageMap;
-
private:
- typedef std::list<Msp::FS::Path> SearchPath;
-
Builder &builder;
- SearchPath pkg_path;
- SearchPath pkg_dirs;
- SearchPath binpkg_path;
- SearchPath binpkg_files;
+ std::list<Msp::FS::Path> pkg_path;
+ std::list<Msp::FS::Path> pkg_dirs;
+ std::list<Msp::FS::Path> binpkg_path;
+ std::list<Msp::FS::Path> binpkg_files;
bool no_externals;
- PackageMap packages;
+ std::map<std::string, Package *> packages;
Package *main_pkg;
std::set<std::string> not_found;
bool env_set;
the primary build target. */
Package &get_main_package() const;
- const PackageMap &get_packages() const { return packages; }
+ const std::map<std::string, Package *> &get_packages() const { return packages; }
/** Locates a package and loads it if necessary. */
Package *find_package(const std::string &);
void version(const std::string &);
};
- typedef std::list<Component *> ComponentList;
-
private:
- typedef std::list<Feature> FeatureList;
-
std::string version;
std::string interface_version;
std::string description;
Msp::FS::Path source_dir;
const BuildType *build_type;
Toolchain local_tools;
- FeatureList features;
+ std::list<Feature> features;
BuildInfo build_info;
- ComponentList components;
+ std::list<Component *> components;
SourceArchiveComponent *source_archive;
Config config;
mutable Cache cache;
class Target
{
public:
- typedef std::list<Target *> Dependencies;
+ using Dependencies = std::list<Target *>;
protected:
enum State
#include <string>
#include <msp/fs/path.h>
#include "buildinfo.h"
+#include "virtualfilesystem.h"
class Architecture;
class Builder;
COMPONENT
};
- typedef std::list<Msp::FS::Path> SearchPath;
- typedef std::list<std::string> SuffixList;
-
protected:
Builder &builder;
const Architecture *architecture;
std::string tag;
std::string command;
FileTarget *executable;
- SuffixList input_suffixes;
- SuffixList aux_suffixes;
+ std::list<std::string> input_suffixes;
+ std::list<std::string> aux_suffixes;
ProcessingUnit processing_unit;
- SearchPath system_path;
+ VirtualFileSystem::SearchPath system_path;
BuildInfo build_info;
bool prepared;
std::list<std::string> problems;
FileTarget *get_executable() const { return executable; }
/// Returns a list of suffixes that can be processed with this tool.
- const SuffixList &get_input_suffixes() const { return input_suffixes; }
+ const std::list<std::string> &get_input_suffixes() const { return input_suffixes; }
/** Returns a list of suffixes that are associated with this tool, but can't
be processed directly. For example C and C++ headers. */
- const SuffixList &get_auxiliary_suffixes() const { return aux_suffixes; }
+ const std::list<std::string> &get_auxiliary_suffixes() const { return aux_suffixes; }
/** Indicates whether the tool can accept a suffix. If aux is true,
auxiliary suffixes are considered as well */
ProcessingUnit get_processing_unit() const { return processing_unit; }
/// Returns the systemwide search path for source files.
- const SearchPath &get_system_path() const { return system_path; }
+ const VirtualFileSystem::SearchPath &get_system_path() const { return system_path; }
/** Returns tool-specific build info. This can be used by other tools down
the chain. */
class Toolchain
{
private:
- typedef std::map<std::string, Tool *> ToolMap;
- typedef std::list<Toolchain *> ToolchainList;
-
- ToolMap tools;
- ToolchainList chains;
+ std::map<std::string, Tool *> tools;
+ std::list<Toolchain *> chains;
public:
~Toolchain();
tool->prepare();
- list<FS::Path> combined_path(path.begin(), path.end());
+ SearchPath combined_path = path;
if(use_syspath)
{
- const Tool::SearchPath &syspath = tool->get_system_path();
+ const SearchPath &syspath = tool->get_system_path();
combined_path.insert(combined_path.end(), syspath.begin(), syspath.end());
}
FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath &path, BuildInfo::LibraryMode mode, bool use_syspath)
{
- list<FS::Path> combined_path(path.begin(), path.end());
+ SearchPath combined_path = path;
if(use_syspath)
{
Tool &linker = builder.get_toolchain().get_tool("LINK");
linker.prepare();
- const Tool::SearchPath &syspath = linker.get_system_path();
+ const SearchPath &syspath = linker.get_system_path();
combined_path.insert(combined_path.end(), syspath.begin(), syspath.end());
}
class Builder;
class FileTarget;
class Pattern;
+class Tool;
/**
Provides access to the filesystem in a way that takes known targets into
class VirtualFileSystem
{
public:
- typedef std::list<Msp::FS::Path> SearchPath;
+ using SearchPath = std::list<Msp::FS::Path>;
private:
- typedef std::map<Msp::FS::Path, FileTarget *> TargetMap;
-
Builder &builder;
- TargetMap targets;
+ std::map<Msp::FS::Path, FileTarget *> targets;
std::set<Msp::FS::Path> nonexistent;
public: