// 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<Target *> &sources, const string &)
+Target *ApkBuilder::create_target(const vector<Target *> &sources, const string &)
{
AndroidResourceBundle *resource_bundle = 0;
- list<FileTarget *> other_files;
- for(list<Target *>::const_iterator i=sources.begin(); i!=sources.end(); ++i)
+ vector<FileTarget *> other_files;
+ other_files.reserve(sources.size());
+ for(Target *s: sources)
{
- if(AndroidResourceBundle *r = dynamic_cast<AndroidResourceBundle *>(*i))
+ if(AndroidResourceBundle *r = dynamic_cast<AndroidResourceBundle *>(s))
resource_bundle = r;
- else if(FileTarget *f = dynamic_cast<FileTarget *>(*i))
+ else if(FileTarget *f = dynamic_cast<FileTarget *>(s))
other_files.push_back(f);
}
AndroidPackageFile *apk = new AndroidPackageFile(builder, *resource_bundle->get_component(), *resource_bundle, other_files);
argv.push_back(executable->get_path().str());
argv.push_back("u");
- const Target::Dependencies &depends = apk.get_dependencies();
FS::Path input_path;
- list<FS::Path> files;
- for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i)
+ vector<FS::Path> files;
+ files.reserve(apk.get_dependencies().size());
+ for(Target *d: apk.get_dependencies())
{
- FileTarget *file = dynamic_cast<FileTarget *>(*i);
- Target *real = (*i)->get_real_target();
+ FileTarget *file = dynamic_cast<FileTarget *>(d);
+ Target *real = d->get_real_target();
if(dynamic_cast<AndroidResourceBundle *>(real))
input_path = file->get_path();
FS::Path work_dir = FS::dirname(input_path);
- for(list<FS::Path>::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));