]> git.tdb.fi Git - builder.git/blob - source/jarsigner.cpp
Refactor the use of external tasks in tools
[builder.git] / source / jarsigner.cpp
1 #include <msp/core/environ.h>
2 #include <msp/fs/utils.h>
3 #include "component.h"
4 #include "filetarget.h"
5 #include "jarsigner.h"
6 #include "sourcepackage.h"
7
8 using namespace std;
9 using namespace Msp;
10
11 JarSigner::JarSigner(Builder &b):
12         Tool(b, "JSGN")
13 {
14         set_command("jarsigner");
15         set_run_external(_run);
16 }
17
18 Target *JarSigner::create_target(const vector<Target *> &, const string &)
19 {
20         throw logic_error("not implemented");
21 }
22
23 ExternalTask::Arguments JarSigner::_run(const FileTarget &file, FS::Path &work_dir)
24 {
25         const Tool &tool = *file.get_tool();
26
27         ExternalTask::Arguments argv;
28         argv.push_back(tool.get_executable()->get_path().str());
29
30         // TODO Make this generic
31         FS::Path home_dir = Msp::getenv("HOME");
32         argv.push_back("-keystore");
33         argv.push_back((home_dir/".android"/"debug.keystore").str());
34         argv.push_back("-storepass");
35         argv.push_back("android");
36
37         argv.push_back(FS::relative(file.get_path(), work_dir).str());
38         argv.push_back("androiddebugkey");
39
40         return argv;
41 }