]> git.saurik.com Git - android/aapt.git/blame - Bundle.h
Add --auto-add-overlay option to aapt. DO NOT MERGE
[android/aapt.git] / Bundle.h
CommitLineData
a534180c
TAOSP
1//
2// Copyright 2006 The Android Open Source Project
3//
4// State bundle. Used to pass around stuff like command-line args.
5//
6#ifndef __BUNDLE_H
7#define __BUNDLE_H
8
9#include <stdlib.h>
79e5d372
MA
10#include <utils/Log.h>
11#include <utils/threads.h>
12#include <utils/List.h>
13#include <utils/Errors.h>
a534180c
TAOSP
14#include <utils/String8.h>
15#include <utils/Vector.h>
16
17/*
18 * Things we can do.
19 */
20typedef enum Command {
21 kCommandUnknown = 0,
22 kCommandVersion,
23 kCommandList,
24 kCommandDump,
25 kCommandAdd,
26 kCommandRemove,
27 kCommandPackage,
28} Command;
29
30/*
31 * Bundle of goodies, including everything specified on the command line.
32 */
33class Bundle {
34public:
35 Bundle(void)
36 : mCmd(kCommandUnknown), mVerbose(false), mAndroidList(false),
37 mForce(false), mGrayscaleTolerance(0), mMakePackageDirs(false),
38 mUpdate(false), mExtending(false),
39 mRequireLocalization(false), mPseudolocalize(false),
7751daa4 40 mValues(false),
a534180c 41 mCompressionMethod(0), mOutputAPKFile(NULL),
18dbbc24 42 mAutoAddOverlay(false), mAssetSourceDir(NULL), mProguardFile(NULL),
a534180c
TAOSP
43 mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
44 mRClassDir(NULL), mResourceIntermediatesDir(NULL),
53288885 45 mMinSdkVersion(NULL), mTargetSdkVersion(NULL), mMaxSdkVersion(NULL),
fa19db5e 46 mVersionCode(NULL), mVersionName(NULL), mCustomPackage(NULL),
a534180c
TAOSP
47 mArgc(0), mArgv(NULL)
48 {}
49 ~Bundle(void) {}
50
51 /*
52 * Set the command value. Returns "false" if it was previously set.
53 */
54 Command getCommand(void) const { return mCmd; }
55 void setCommand(Command cmd) { mCmd = cmd; }
56
57 /*
58 * Command modifiers. Not all modifiers are appropriate for all
59 * commands.
60 */
61 bool getVerbose(void) const { return mVerbose; }
62 void setVerbose(bool val) { mVerbose = val; }
63 bool getAndroidList(void) const { return mAndroidList; }
64 void setAndroidList(bool val) { mAndroidList = val; }
65 bool getForce(void) const { return mForce; }
66 void setForce(bool val) { mForce = val; }
67 void setGrayscaleTolerance(int val) { mGrayscaleTolerance = val; }
68 int getGrayscaleTolerance() { return mGrayscaleTolerance; }
69 bool getMakePackageDirs(void) const { return mMakePackageDirs; }
70 void setMakePackageDirs(bool val) { mMakePackageDirs = val; }
71 bool getUpdate(void) const { return mUpdate; }
72 void setUpdate(bool val) { mUpdate = val; }
73 bool getExtending(void) const { return mExtending; }
74 void setExtending(bool val) { mExtending = val; }
75 bool getRequireLocalization(void) const { return mRequireLocalization; }
76 void setRequireLocalization(bool val) { mRequireLocalization = val; }
77 bool getPseudolocalize(void) const { return mPseudolocalize; }
78 void setPseudolocalize(bool val) { mPseudolocalize = val; }
7751daa4
DH
79 bool getValues(void) const { return mValues; }
80 void setValues(bool val) { mValues = val; }
a534180c
TAOSP
81 int getCompressionMethod(void) const { return mCompressionMethod; }
82 void setCompressionMethod(int val) { mCompressionMethod = val; }
5c71c5c3
DZ
83 bool getJunkPath(void) const { return mJunkPath; }
84 void setJunkPath(bool val) { mJunkPath = val; }
a534180c
TAOSP
85 const char* getOutputAPKFile() const { return mOutputAPKFile; }
86 void setOutputAPKFile(const char* val) { mOutputAPKFile = val; }
18dbbc24
XD
87 bool getAutoAddOverlay() { return mAutoAddOverlay; }
88 void setAutoAddOverlay(bool val) { mAutoAddOverlay = val; }
a534180c 89
5c71c5c3
DZ
90 /*
91 * Input options.
a534180c
TAOSP
92 */
93 const char* getAssetSourceDir() const { return mAssetSourceDir; }
94 void setAssetSourceDir(const char* dir) { mAssetSourceDir = dir; }
6648ff78
JO
95 const char* getProguardFile() const { return mProguardFile; }
96 void setProguardFile(const char* file) { mProguardFile = file; }
a534180c
TAOSP
97 const android::Vector<const char*>& getResourceSourceDirs() const { return mResourceSourceDirs; }
98 void addResourceSourceDir(const char* dir) { mResourceSourceDirs.insertAt(dir,0); }
99 const char* getAndroidManifestFile() const { return mAndroidManifestFile; }
100 void setAndroidManifestFile(const char* file) { mAndroidManifestFile = file; }
101 const char* getPublicOutputFile() const { return mPublicOutputFile; }
102 void setPublicOutputFile(const char* file) { mPublicOutputFile = file; }
103 const char* getRClassDir() const { return mRClassDir; }
104 void setRClassDir(const char* dir) { mRClassDir = dir; }
105 const char* getConfigurations() const { return mConfigurations.size() > 0 ? mConfigurations.string() : NULL; }
106 void addConfigurations(const char* val) { if (mConfigurations.size() > 0) { mConfigurations.append(","); mConfigurations.append(val); } else { mConfigurations = val; } }
107 const char* getResourceIntermediatesDir() const { return mResourceIntermediatesDir; }
108 void setResourceIntermediatesDir(const char* dir) { mResourceIntermediatesDir = dir; }
109 const android::Vector<const char*>& getPackageIncludes() const { return mPackageIncludes; }
110 void addPackageInclude(const char* file) { mPackageIncludes.add(file); }
111 const android::Vector<const char*>& getJarFiles() const { return mJarFiles; }
112 void addJarFile(const char* file) { mJarFiles.add(file); }
113 const android::Vector<const char*>& getNoCompressExtensions() const { return mNoCompressExtensions; }
114 void addNoCompressExtension(const char* ext) { mNoCompressExtensions.add(ext); }
115
7e486e33
DH
116 const char* getMinSdkVersion() const { return mMinSdkVersion; }
117 void setMinSdkVersion(const char* val) { mMinSdkVersion = val; }
118 const char* getTargetSdkVersion() const { return mTargetSdkVersion; }
119 void setTargetSdkVersion(const char* val) { mTargetSdkVersion = val; }
120 const char* getMaxSdkVersion() const { return mMaxSdkVersion; }
121 void setMaxSdkVersion(const char* val) { mMaxSdkVersion = val; }
122 const char* getVersionCode() const { return mVersionCode; }
123 void setVersionCode(const char* val) { mVersionCode = val; }
124 const char* getVersionName() const { return mVersionName; }
125 void setVersionName(const char* val) { mVersionName = val; }
fa19db5e
XD
126 const char* getCustomPackage() const { return mCustomPackage; }
127 void setCustomPackage(const char* val) { mCustomPackage = val; }
5c71c5c3 128
a534180c
TAOSP
129 /*
130 * Set and get the file specification.
131 *
132 * Note this does NOT make a copy of argv.
133 */
134 void setFileSpec(char* const argv[], int argc) {
135 mArgc = argc;
136 mArgv = argv;
137 }
138 int getFileSpecCount(void) const { return mArgc; }
139 const char* getFileSpecEntry(int idx) const { return mArgv[idx]; }
140 void eatArgs(int n) {
141 if (n > mArgc) n = mArgc;
142 mArgv += n;
143 mArgc -= n;
144 }
145
146#if 0
147 /*
148 * Package count. Nothing to do with anything else here; this is
149 * just a convenient place to stuff it so we don't have to pass it
150 * around everywhere.
151 */
152 int getPackageCount(void) const { return mPackageCount; }
153 void setPackageCount(int val) { mPackageCount = val; }
154#endif
155
156private:
157 /* commands & modifiers */
158 Command mCmd;
159 bool mVerbose;
160 bool mAndroidList;
161 bool mForce;
162 int mGrayscaleTolerance;
163 bool mMakePackageDirs;
164 bool mUpdate;
165 bool mExtending;
166 bool mRequireLocalization;
167 bool mPseudolocalize;
7751daa4 168 bool mValues;
a534180c 169 int mCompressionMethod;
5c71c5c3 170 bool mJunkPath;
a534180c 171 const char* mOutputAPKFile;
18dbbc24 172 bool mAutoAddOverlay;
a534180c 173 const char* mAssetSourceDir;
6648ff78 174 const char* mProguardFile;
a534180c
TAOSP
175 const char* mAndroidManifestFile;
176 const char* mPublicOutputFile;
177 const char* mRClassDir;
178 const char* mResourceIntermediatesDir;
179 android::String8 mConfigurations;
180 android::Vector<const char*> mPackageIncludes;
181 android::Vector<const char*> mJarFiles;
182 android::Vector<const char*> mNoCompressExtensions;
183 android::Vector<const char*> mResourceSourceDirs;
5c71c5c3 184
7e486e33
DH
185 const char* mMinSdkVersion;
186 const char* mTargetSdkVersion;
187 const char* mMaxSdkVersion;
188 const char* mVersionCode;
189 const char* mVersionName;
fa19db5e 190 const char* mCustomPackage;
5c71c5c3 191
a534180c
TAOSP
192 /* file specification */
193 int mArgc;
194 char* const* mArgv;
195
196#if 0
197 /* misc stuff */
198 int mPackageCount;
199#endif
200};
201
202#endif // __BUNDLE_H