]> git.tdb.fi Git - builder.git/commitdiff
Miscellaneous minor code cleanups
authorMikko Rasa <tdb@tdb.fi>
Wed, 13 May 2009 20:15:38 +0000 (20:15 +0000)
committerMikko Rasa <tdb@tdb.fi>
Wed, 13 May 2009 20:15:38 +0000 (20:15 +0000)
source/analyzer.cpp
source/binarypackage.cpp
source/builder.cpp
source/component.cpp
source/component.h
source/config.cpp
source/sourcepackage.cpp
source/systemlibrary.cpp
source/target.h

index 7d120792591b41b7695e5de93bdbbe34a844e5b7..37c8911c4bcb3e8562837eaae5634c8d9e961bcd 100644 (file)
@@ -27,6 +27,8 @@ Analyzer::Analyzer(Builder &b):
 
 void Analyzer::analyze()
 {
+       table.clear();
+
        TableRow row;
        row.push_back("Name");
        row.push_back("Package");
index 8cfc87404343cf4704e5dad4c4734e99f70a1a6e..cc15888d3db1d7760bea4682893b750d96eaceb4 100644 (file)
@@ -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;
 }
index 9db904a8d805af19a323f6d68ffe319b7343d819..7135a8d97b1a42a4e6aa24860ade31c32fa4f9b4 100644 (file)
@@ -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();
index cb81f8420429b78bd79b4d3f70c6021db04e4e81..5f6237e743f88f37d4f8929f59794e65e79e1c41 100644 (file)
@@ -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)
index b1b6aea994d3142ceb89f33dc3afb2c770c0790f..c7ffce3ca88bf583844a1c3dc7546fbad425b73f 100644 (file)
@@ -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. */
index d4f9384c5b1b05b7eb93becdcdf2a2e9a9995b18..4c06c836d40936b19fc2b3e81b9e66c228573c4b 100644 (file)
@@ -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;
 }
index 6f3db4d8e07e392451dbfe527397cbf3786394f6..751f1b2c4dcfa4d15a157d7f20b9fdd4c1845cdc 100644 (file)
@@ -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())
index 2bfc04bb6f870e30cc6f890cff86ac1510d6058e..58eaea7087a095246aba7e2a7e496a2177158b56 100644 (file)
@@ -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"))
index 5deb2344b3c00ed72d6253ad0d294d502ba25a89..263a404af6b8549b1aa2582fbd860fba634fdbf7 100644 (file)
@@ -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 *);