Loading tools/aapt/Bundle.h +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ typedef enum Command { kCommandPackage, kCommandCrunch, kCommandSingleCrunch, kCommandDaemon } Command; /* Loading tools/aapt/Command.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,10 @@ #include <errno.h> #include <fcntl.h> #include <iostream> #include <string> #include <sstream> using namespace android; #ifndef AAPT_VERSION Loading Loading @@ -2506,6 +2510,37 @@ int doSingleCrunch(Bundle* bundle) return NO_ERROR; } int runInDaemonMode(Bundle* bundle) { std::cout << "Ready" << std::endl; for (std::string line; std::getline(std::cin, line);) { if (line == "quit") { return NO_ERROR; } std::stringstream ss; ss << line; std::string s; std::string command, parameterOne, parameterTwo; std::getline(ss, command, ' '); std::getline(ss, parameterOne, ' '); std::getline(ss, parameterTwo, ' '); if (command[0] == 's') { bundle->setSingleCrunchInputFile(parameterOne.c_str()); bundle->setSingleCrunchOutputFile(parameterTwo.c_str()); std::cout << "Crunching " << parameterOne << std::endl; if (doSingleCrunch(bundle) != NO_ERROR) { std::cout << "Error" << std::endl; } std::cout << "Done" << std::endl; } else { // in case of invalid command, just bail out. std::cerr << "Unknown command" << std::endl; return -1; } } return -1; } char CONSOLE_DATA[2925] = { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 95, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, Loading tools/aapt/Main.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,7 @@ int handleCommand(Bundle* bundle) case kCommandPackage: return doPackage(bundle); case kCommandCrunch: return doCrunch(bundle); case kCommandSingleCrunch: return doSingleCrunch(bundle); case kCommandDaemon: return runInDaemonMode(bundle); default: fprintf(stderr, "%s: requested command not yet supported\n", gProgName); return 1; Loading Loading @@ -275,6 +276,8 @@ int main(int argc, char* const argv[]) bundle.setCommand(kCommandCrunch); else if (argv[1][0] == 's') bundle.setCommand(kCommandSingleCrunch); else if (argv[1][0] == 'm') bundle.setCommand(kCommandDaemon); else { fprintf(stderr, "ERROR: Unknown command '%s'\n", argv[1]); wantUsage = true; Loading tools/aapt/Main.h +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ extern int doRemove(Bundle* bundle); extern int doPackage(Bundle* bundle); extern int doCrunch(Bundle* bundle); extern int doSingleCrunch(Bundle* bundle); extern int runInDaemonMode(Bundle* bundle); extern int calcPercent(long uncompressedLen, long compressedLen); Loading Loading
tools/aapt/Bundle.h +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ typedef enum Command { kCommandPackage, kCommandCrunch, kCommandSingleCrunch, kCommandDaemon } Command; /* Loading
tools/aapt/Command.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,10 @@ #include <errno.h> #include <fcntl.h> #include <iostream> #include <string> #include <sstream> using namespace android; #ifndef AAPT_VERSION Loading Loading @@ -2506,6 +2510,37 @@ int doSingleCrunch(Bundle* bundle) return NO_ERROR; } int runInDaemonMode(Bundle* bundle) { std::cout << "Ready" << std::endl; for (std::string line; std::getline(std::cin, line);) { if (line == "quit") { return NO_ERROR; } std::stringstream ss; ss << line; std::string s; std::string command, parameterOne, parameterTwo; std::getline(ss, command, ' '); std::getline(ss, parameterOne, ' '); std::getline(ss, parameterTwo, ' '); if (command[0] == 's') { bundle->setSingleCrunchInputFile(parameterOne.c_str()); bundle->setSingleCrunchOutputFile(parameterTwo.c_str()); std::cout << "Crunching " << parameterOne << std::endl; if (doSingleCrunch(bundle) != NO_ERROR) { std::cout << "Error" << std::endl; } std::cout << "Done" << std::endl; } else { // in case of invalid command, just bail out. std::cerr << "Unknown command" << std::endl; return -1; } } return -1; } char CONSOLE_DATA[2925] = { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 95, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, Loading
tools/aapt/Main.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,7 @@ int handleCommand(Bundle* bundle) case kCommandPackage: return doPackage(bundle); case kCommandCrunch: return doCrunch(bundle); case kCommandSingleCrunch: return doSingleCrunch(bundle); case kCommandDaemon: return runInDaemonMode(bundle); default: fprintf(stderr, "%s: requested command not yet supported\n", gProgName); return 1; Loading Loading @@ -275,6 +276,8 @@ int main(int argc, char* const argv[]) bundle.setCommand(kCommandCrunch); else if (argv[1][0] == 's') bundle.setCommand(kCommandSingleCrunch); else if (argv[1][0] == 'm') bundle.setCommand(kCommandDaemon); else { fprintf(stderr, "ERROR: Unknown command '%s'\n", argv[1]); wantUsage = true; Loading
tools/aapt/Main.h +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ extern int doRemove(Bundle* bundle); extern int doPackage(Bundle* bundle); extern int doCrunch(Bundle* bundle); extern int doSingleCrunch(Bundle* bundle); extern int runInDaemonMode(Bundle* bundle); extern int calcPercent(long uncompressedLen, long compressedLen); Loading