2 * Copyright (C) 2015 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "androidfw/StringPiece.h"
24 // DO NOT UPDATE, this is more of a marketing version.
25 static const char* sMajorVersion = "2";
27 // Update minor version whenever a feature or flag is added.
28 static const char* sMinorVersion = "13";
31 std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "."
32 << sMinorVersion << std::endl;
36 extern int Compile(const std::vector<android::StringPiece>& args);
37 extern int Link(const std::vector<android::StringPiece>& args);
38 extern int Dump(const std::vector<android::StringPiece>& args);
39 extern int Diff(const std::vector<android::StringPiece>& args);
40 extern int Optimize(const std::vector<android::StringPiece>& args);
44 int main(int argc, char** argv) {
49 std::vector<android::StringPiece> args;
50 for (int i = 1; i < argc; i++) {
51 args.push_back(argv[i]);
54 android::StringPiece command(argv[0]);
55 if (command == "compile" || command == "c") {
56 return aapt::Compile(args);
57 } else if (command == "link" || command == "l") {
58 return aapt::Link(args);
59 } else if (command == "dump" || command == "d") {
60 return aapt::Dump(args);
61 } else if (command == "diff") {
62 return aapt::Diff(args);
63 } else if (command == "optimize") {
64 return aapt::Optimize(args);
65 } else if (command == "version") {
66 return aapt::PrintVersion();
68 std::cerr << "unknown command '" << command << "'\n";
70 std::cerr << "no command specified\n";
73 std::cerr << "\nusage: aapt2 [compile|link|dump|diff|optimize|version] ..."