]> git.tdb.fi Git - builder.git/commitdiff
A bunch of minor cleanups
authorMikko Rasa <tdb@tdb.fi>
Wed, 8 Oct 2014 22:42:04 +0000 (01:42 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 8 Oct 2014 22:42:04 +0000 (01:42 +0300)
Build
source/androidtools.cpp
source/file.h
source/gnucompiler.cpp
source/gnulinker.cpp
source/installcomponent.cpp
source/pkgconfigfile.h
source/sourcegenerator.cpp
source/sourcegenerator.h
source/sourcepackage.cpp

diff --git a/Build b/Build
index 5e50e8ffd56aeaf0ebcc37386ae0dad9dd7884c8..1abaa6c143eab9824b66bdb60333861898dd7189 100644 (file)
--- a/Build
+++ b/Build
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 package "builder"
 {
        version "2.0";
index b89af6e53d2c23cdc4a5de4c5626f20f7f9ffa07..c0fe6d1557e5f3b9beb92f510d60e7e9b86eaf28 100644 (file)
@@ -78,17 +78,11 @@ void AndroidNdk::find_toolchain_dir()
        list<string> tc_archs = list_files(toolchains_dir/use_toolchain/"prebuilt");
        string use_arch;
        for(list<string>::const_iterator i=tc_archs.begin(); i!=tc_archs.end(); ++i)
-       {
-               string tca = *i;
-               for(string::iterator j=tca.begin(); j!=tca.end(); ++j)
-                       if(*j=='_')
-                               *j = '-';
-               if(native_arch.match_name(tca))
+               if(native_arch.match_name(*i))
                {
                        use_arch = *i;
                        break;
                }
-       }
 
        if(use_arch.empty())
                throw runtime_error("No matching toolchain found");
index aa0035f47599cca906e4a6f4fedba142b14cb1fb..5a216a9655b6aa65f4661db814e1c9ab381c705e 100644 (file)
@@ -4,7 +4,7 @@
 #include "filetarget.h"
 
 /**
-Just an arbitary file.  No special meaning attached.
+Just an arbitrary file.  No special meaning attached.
 */
 class File: public FileTarget
 {
index 6daa99d81a565c482c05f6a49127986d0a457ead..2f6393ec1d718e97134d3a4a53bc002b0a9c3fc1 100644 (file)
@@ -92,7 +92,6 @@ void GnuCompiler::do_prepare()
 Task *GnuCompiler::run(const Target &target) const
 {
        const ObjectFile &object = dynamic_cast<const ObjectFile &>(target);
-       const Component &comp = *object.get_component();
 
        ExternalTask::Arguments argv;
        argv.push_back(executable->get_path().str());
@@ -190,7 +189,7 @@ Task *GnuCompiler::run(const Target &target) const
 
        FS::Path obj_path = object.get_path();
        FS::Path src_path = object.get_source().get_path();
-       FS::Path work_dir = comp.get_package().get_source_directory();
+       FS::Path work_dir = object.get_component()->get_package().get_source_directory();
 
        argv.push_back("-o");
        argv.push_back(relative(obj_path, work_dir).str());
index e266a8ea6123a53e59d4d06cc3666a04dbc7dc22..2ec4c048d613372205f0a48421c2dcc24d19eff4 100644 (file)
@@ -174,9 +174,7 @@ Task *GnuLinker::Linker::run(const Target &target) const
        vector<string> argv;
        argv.push_back(executable->get_path().str());
 
-       const Component &comp = *bin.get_component();
-
-       FS::Path work_dir = comp.get_package().get_source_directory();
+       FS::Path work_dir = bin.get_component()->get_package().get_source_directory();
 
        if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&bin))
        {
index 9584a515781ce0c351ffec498b194c9b3d31b563..ed3c191cd7769a1cb95ca77d5f2fb99adab9a41d 100644 (file)
@@ -19,11 +19,9 @@ void InstallComponent::create_targets() const
        SourceList source_filenames = collect_source_files();
        for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
        {
-               FileTarget *ft;
-               if(Target *tgt = builder.get_vfs().get_target(*i))
-                       ft = dynamic_cast<FileTarget *>(tgt);
-               else
-                       ft = new File(builder, package, *i);
-               inst->add_dependency(*copy.create_target(*ft, name));
+               Target *tgt = builder.get_vfs().get_target(*i);
+               if(!tgt)
+                       tgt = new File(builder, package, *i);
+               inst->add_dependency(*copy.create_target(*tgt, name));
        }
 }
index 1a31c38eec661c0886eed9b464ab116dc167e61a..5ec1aa4994c044fdfbae297cb4450c77556ddf08 100644 (file)
@@ -12,7 +12,7 @@ class PkgConfigFile: public FileTarget
 public:
        PkgConfigFile(Builder &, const SourcePackage &);
 
-       virtual const char *get_type() const { return "PkgConfig"; }
+       virtual const char *get_type() const { return "PkgConfigFile"; }
 };
 
 #endif
index c09e5c7d9527c3b60f17ce2bcef6069fac239144..4f757217958a7acf8eb9a3a981a985d579e60ac3 100644 (file)
@@ -49,14 +49,6 @@ Target *SourceGenerator::create_target(const list<Target *> &sources, const stri
        return primary;
 }
 
-void SourceGenerator::do_prepare()
-{
-       FS::Path exe_fn = package.get_source_directory()/command;
-       executable = builder.get_vfs().get_target(exe_fn);
-       if(!executable)
-               executable = new Executable(builder, exe_fn);
-}
-
 Task *SourceGenerator::run(const Target &target) const
 {
        const SourceFile &out_src = dynamic_cast<const SourceFile &>(target);
@@ -86,7 +78,7 @@ SourceGenerator::Loader::Loader(SourceGenerator &sg):
 
 void SourceGenerator::Loader::command(const string &c)
 {
-       obj.set_command(c);
+       obj.set_command((obj.package.get_source_directory()/c).str());
 }
 
 void SourceGenerator::Loader::in_suffix(const string &s)
index b3c00e4d5f3e8e372318b106815fb9654425c80e..28456ad6bdcc4a58b0a0ffd251c69e2b8d3d76fb 100644 (file)
@@ -29,10 +29,6 @@ public:
        virtual Target *create_source(const Component &, const Msp::FS::Path &) const;
        virtual Target *create_target(const std::list<Target *> &, const std::string &);
 
-private:
-       virtual void do_prepare();
-
-public:
        virtual Task *run(const Target &) const;
 };
 
index 9738146423de46bc9152b7bdfac60f6734a8b639..274230076599f9a78e890514126dbdedc9e5a3ce 100644 (file)
@@ -158,17 +158,17 @@ SourcePackage::Loader::Loader(SourcePackage &p, const Config::InputOptions &o):
 void SourcePackage::Loader::init(const Config::InputOptions *o)
 {
        options = o;
-       add("description", &SourcePackage::description);
        add("build_info",  &Loader::build_info);
+       add("datapack",    &Loader::component<DataPackComponent>);
+       add("description", &SourcePackage::description);
        add("feature",     &Loader::feature);
        add("generate",    &Loader::generate);
        add("if_feature",  &Loader::if_feature);
-       add("program",     &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::PROGRAM>);
-       add("library",     &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::LIBRARY>);
-       add("module",      &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::MODULE>);
        add("install",     &Loader::component<InstallComponent>);
        add("interface_version", &Loader::interface_version);
-       add("datapack",    &Loader::component<DataPackComponent>);
+       add("library",     &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::LIBRARY>);
+       add("module",      &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::MODULE>);
+       add("program",     &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::PROGRAM>);
        add("source_archive", &Loader::source_archive);
        add("source_tarball", &Loader::source_archive);
        add("tarball",     &Loader::tarball);