From: Mikko Rasa Date: Wed, 13 May 2009 20:15:38 +0000 (+0000) Subject: Miscellaneous minor code cleanups X-Git-Tag: 1.0~12 X-Git-Url: http://git.tdb.fi/?p=builder.git;a=commitdiff_plain;h=83d2a8a39e0a09733ffc666d7f885fc328b831f2 Miscellaneous minor code cleanups --- diff --git a/source/analyzer.cpp b/source/analyzer.cpp index 7d12079..37c8911 100644 --- a/source/analyzer.cpp +++ b/source/analyzer.cpp @@ -27,6 +27,8 @@ Analyzer::Analyzer(Builder &b): void Analyzer::analyze() { + table.clear(); + TableRow row; row.push_back("Name"); row.push_back("Package"); diff --git a/source/binarypackage.cpp b/source/binarypackage.cpp index 8cfc874..cc15888 100644 --- a/source/binarypackage.cpp +++ b/source/binarypackage.cpp @@ -20,7 +20,7 @@ BinaryPackage::BinaryPackage(Builder &b, const string &n): use_pkgconfig=false; } -void BinaryPackage::set_path(const Msp::FS::Path &p) +void BinaryPackage::set_path(const FS::Path &p) { path=builder.get_cwd()/p; } diff --git a/source/builder.cpp b/source/builder.cpp index 9db904a..7135a8d 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -660,7 +660,7 @@ int Builder::create_targets() return 0; } -Target *Builder::get_header(const Msp::FS::Path &fn) +Target *Builder::get_header(const FS::Path &fn) { Target *tgt=get_target(fn.str()); if(tgt) return tgt; @@ -805,7 +805,7 @@ int Builder::do_clean() Target *tgt=queue.front(); queue.erase(queue.begin()); - if(tgt->get_buildable() && (tgt->get_package()==main_pkg || clean>=2)) + if(tgt->is_buildable() && (tgt->get_package()==main_pkg || clean>=2)) clean_tgts.insert(tgt); const TargetList &deps=tgt->get_depends(); diff --git a/source/component.cpp b/source/component.cpp index cb81f84..5f6237e 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -101,7 +101,7 @@ void Component::create_targets() const { const TargetMap &targets=builder.get_targets(); for(TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i) - if(i->second->get_package()==&pkg && !i->second->get_buildable()) + if(i->second->get_package()==&pkg && !i->second->is_buildable()) result->add_depend(i->second); files.push_back(pkg.get_source()/"Build"); } @@ -235,7 +235,7 @@ void Component::Loader::require(const string &n) void Component::Loader::modular() { if(comp.type!=PROGRAM) - throw Msp::Exception("Only programs can be modular"); + throw Exception("Only programs can be modular"); comp.modular=true; } @@ -245,13 +245,13 @@ void Component::Loader::host(const string &n) for(ComponentList::const_iterator i=comps.begin(); i!=comps.end(); ++i) if(i->get_name()==n) { - if(i->get_type()!=PROGRAM || !i->get_modular()) - throw Msp::Exception("Module host must be a modular program"); + if(i->get_type()!=PROGRAM || !i->is_modular()) + throw Exception("Module host must be a modular program"); comp.module_host=&*i; return; } - throw Msp::Exception("Unknown component"); + throw KeyError("Unknown component", n); } void Component::Loader::install_headers(const string &p) diff --git a/source/component.h b/source/component.h index b1b6aea..c7ffce3 100644 --- a/source/component.h +++ b/source/component.h @@ -74,9 +74,9 @@ public: const PathList &get_sources() const { return sources; } const BuildInfo &get_build_info() const { return build_info; } bool get_install() const { return install; } - bool get_modular() const { return modular; } + bool is_modular() const { return modular; } const PackageList &get_requires() const { return requires; } - bool get_default() const { return deflt; } + bool is_default() const { return deflt; } /** Prepares the build information for building. Pulls build info from the parent and dependency packages, and adds any component-specific flags. */ diff --git a/source/config.cpp b/source/config.cpp index d4f9384..4c06c83 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -34,7 +34,7 @@ const Config::Option &Config::get_option(const string &name) const { OptionMap::const_iterator i=options.find(name); if(i==options.end()) - throw Exception("Tried to access nonexistent option "+name); + throw KeyError("Unknown option", name); return i->second; } diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index 6f3db4d..751f1b2 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -33,12 +33,12 @@ SourcePackage::SourcePackage(Builder &b, const string &n, const FS::Path &s): components.push_back(Component(*this, Component::TARBALL, "@src")); } -Msp::FS::Path SourcePackage::get_temp_dir() const +FS::Path SourcePackage::get_temp_dir() const { return source/config.get_option("tempdir").value/builder.get_current_arch().get_name()/config.get_option("profile").value; } -Msp::FS::Path SourcePackage::get_out_dir() const +FS::Path SourcePackage::get_out_dir() const { const Architecture &arch=builder.get_current_arch(); if(arch.is_native()) diff --git a/source/systemlibrary.cpp b/source/systemlibrary.cpp index 2bfc04b..58eaea7 100644 --- a/source/systemlibrary.cpp +++ b/source/systemlibrary.cpp @@ -12,12 +12,12 @@ Distributed under the LGPL using namespace std; using namespace Msp; -SystemLibrary::SystemLibrary(Builder &b, const Msp::FS::Path &p): +SystemLibrary::SystemLibrary(Builder &b, const FS::Path &p): FileTarget(b, 0, p), Library(b, 0, p, extract_libname(p)) { } -string SystemLibrary::extract_libname(const Msp::FS::Path &p) +string SystemLibrary::extract_libname(const FS::Path &p) { string result=FS::basepart(FS::basename(p)); if(!result.compare(0, 3, "lib")) diff --git a/source/target.h b/source/target.h index 5deb234..263a404 100644 --- a/source/target.h +++ b/source/target.h @@ -60,7 +60,7 @@ public: */ Target *get_buildable_target(); - bool get_buildable() const { return buildable; } + bool is_buildable() const { return buildable; } bool get_rebuild() const { return rebuild; } const std::string &get_rebuild_reason() const { return rebuild_reason; } void add_depend(Target *);