X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fapkbuilder.cpp;h=d232a6f927ee23827db9eaafacf7a5997e3f999d;hb=d1f9551e05c9d341149eb490e05b1465d3d6b711;hp=9cd1a16b5b45e878bf194509438e9a06dd26d52b;hpb=68f084e4ed817da0c25cefa1772cadf97b8cfe5e;p=builder.git diff --git a/source/apkbuilder.cpp b/source/apkbuilder.cpp index 9cd1a16..d232a6f 100644 --- a/source/apkbuilder.cpp +++ b/source/apkbuilder.cpp @@ -15,21 +15,21 @@ using namespace Msp; // 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"); } -Target *ApkBuilder::create_target(const list &sources, const string &) +Target *ApkBuilder::create_target(const vector &sources, const string &) { AndroidResourceBundle *resource_bundle = 0; - list other_files; - for(list::const_iterator i=sources.begin(); i!=sources.end(); ++i) + vector other_files; + other_files.reserve(sources.size()); + for(Target *s: sources) { - if(AndroidResourceBundle *r = dynamic_cast(*i)) + if(AndroidResourceBundle *r = dynamic_cast(s)) resource_bundle = r; - else if(FileTarget *f = dynamic_cast(*i)) + else if(FileTarget *f = dynamic_cast(s)) other_files.push_back(f); } AndroidPackageFile *apk = new AndroidPackageFile(builder, *resource_bundle->get_component(), *resource_bundle, other_files); @@ -51,13 +51,13 @@ Task *ApkBuilder::run(const Target &tgt) const argv.push_back(executable->get_path().str()); argv.push_back("u"); - const Target::Dependencies &depends = apk.get_dependencies(); FS::Path input_path; - list files; - for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i) + vector files; + files.reserve(apk.get_dependencies().size()); + for(Target *d: apk.get_dependencies()) { - FileTarget *file = dynamic_cast(*i); - Target *real = (*i)->get_real_target(); + FileTarget *file = dynamic_cast(d); + Target *real = d->get_real_target(); if(dynamic_cast(real)) input_path = file->get_path(); @@ -67,8 +67,8 @@ Task *ApkBuilder::run(const Target &tgt) const FS::Path work_dir = FS::dirname(input_path); - for(list::const_iterator i=files.begin(); i!=files.end(); ++i) - argv.push_back(FS::relative(*i, work_dir).str()); + for(const FS::Path &f: files) + argv.push_back(FS::relative(f, work_dir).str()); ExternalTask *task = new ExternalTask(argv, work_dir); task->set_stdin(FS::basename(input_path));