2 // Copyright 2006 The Android Open Source Project
4 // State bundle. Used to pass around stuff like command-line args.
10 #include <utils.h> // android
11 #include <utils/String8.h>
12 #include <utils/Vector.h>
17 typedef enum Command
{
28 * Bundle of goodies, including everything specified on the command line.
33 : mCmd(kCommandUnknown
), mVerbose(false), mAndroidList(false),
34 mForce(false), mGrayscaleTolerance(0), mMakePackageDirs(false),
35 mUpdate(false), mExtending(false),
36 mRequireLocalization(false), mPseudolocalize(false),
38 mCompressionMethod(0), mOutputAPKFile(NULL
),
39 mAssetSourceDir(NULL
),
40 mAndroidManifestFile(NULL
), mPublicOutputFile(NULL
),
41 mRClassDir(NULL
), mResourceIntermediatesDir(NULL
),
42 mMinSdkVersion(NULL
), mTargetSdkVersion(NULL
), mMaxSdkVersion(NULL
),
43 mVersionCode(NULL
), mVersionName(NULL
),
49 * Set the command value. Returns "false" if it was previously set.
51 Command
getCommand(void) const { return mCmd
; }
52 void setCommand(Command cmd
) { mCmd
= cmd
; }
55 * Command modifiers. Not all modifiers are appropriate for all
58 bool getVerbose(void) const { return mVerbose
; }
59 void setVerbose(bool val
) { mVerbose
= val
; }
60 bool getAndroidList(void) const { return mAndroidList
; }
61 void setAndroidList(bool val
) { mAndroidList
= val
; }
62 bool getForce(void) const { return mForce
; }
63 void setForce(bool val
) { mForce
= val
; }
64 void setGrayscaleTolerance(int val
) { mGrayscaleTolerance
= val
; }
65 int getGrayscaleTolerance() { return mGrayscaleTolerance
; }
66 bool getMakePackageDirs(void) const { return mMakePackageDirs
; }
67 void setMakePackageDirs(bool val
) { mMakePackageDirs
= val
; }
68 bool getUpdate(void) const { return mUpdate
; }
69 void setUpdate(bool val
) { mUpdate
= val
; }
70 bool getExtending(void) const { return mExtending
; }
71 void setExtending(bool val
) { mExtending
= val
; }
72 bool getRequireLocalization(void) const { return mRequireLocalization
; }
73 void setRequireLocalization(bool val
) { mRequireLocalization
= val
; }
74 bool getPseudolocalize(void) const { return mPseudolocalize
; }
75 void setPseudolocalize(bool val
) { mPseudolocalize
= val
; }
76 bool getValues(void) const { return mValues
; }
77 void setValues(bool val
) { mValues
= val
; }
78 int getCompressionMethod(void) const { return mCompressionMethod
; }
79 void setCompressionMethod(int val
) { mCompressionMethod
= val
; }
80 const char* getOutputAPKFile() const { return mOutputAPKFile
; }
81 void setOutputAPKFile(const char* val
) { mOutputAPKFile
= val
; }
86 const char* getAssetSourceDir() const { return mAssetSourceDir
; }
87 void setAssetSourceDir(const char* dir
) { mAssetSourceDir
= dir
; }
88 const android::Vector
<const char*>& getResourceSourceDirs() const { return mResourceSourceDirs
; }
89 void addResourceSourceDir(const char* dir
) { mResourceSourceDirs
.insertAt(dir
,0); }
90 const char* getAndroidManifestFile() const { return mAndroidManifestFile
; }
91 void setAndroidManifestFile(const char* file
) { mAndroidManifestFile
= file
; }
92 const char* getPublicOutputFile() const { return mPublicOutputFile
; }
93 void setPublicOutputFile(const char* file
) { mPublicOutputFile
= file
; }
94 const char* getRClassDir() const { return mRClassDir
; }
95 void setRClassDir(const char* dir
) { mRClassDir
= dir
; }
96 const char* getConfigurations() const { return mConfigurations
.size() > 0 ? mConfigurations
.string() : NULL
; }
97 void addConfigurations(const char* val
) { if (mConfigurations
.size() > 0) { mConfigurations
.append(","); mConfigurations
.append(val
); } else { mConfigurations
= val
; } }
98 const char* getResourceIntermediatesDir() const { return mResourceIntermediatesDir
; }
99 void setResourceIntermediatesDir(const char* dir
) { mResourceIntermediatesDir
= dir
; }
100 const android::Vector
<const char*>& getPackageIncludes() const { return mPackageIncludes
; }
101 void addPackageInclude(const char* file
) { mPackageIncludes
.add(file
); }
102 const android::Vector
<const char*>& getJarFiles() const { return mJarFiles
; }
103 void addJarFile(const char* file
) { mJarFiles
.add(file
); }
104 const android::Vector
<const char*>& getNoCompressExtensions() const { return mNoCompressExtensions
; }
105 void addNoCompressExtension(const char* ext
) { mNoCompressExtensions
.add(ext
); }
107 const char* getMinSdkVersion() const { return mMinSdkVersion
; }
108 void setMinSdkVersion(const char* val
) { mMinSdkVersion
= val
; }
109 const char* getTargetSdkVersion() const { return mTargetSdkVersion
; }
110 void setTargetSdkVersion(const char* val
) { mTargetSdkVersion
= val
; }
111 const char* getMaxSdkVersion() const { return mMaxSdkVersion
; }
112 void setMaxSdkVersion(const char* val
) { mMaxSdkVersion
= val
; }
113 const char* getVersionCode() const { return mVersionCode
; }
114 void setVersionCode(const char* val
) { mVersionCode
= val
; }
115 const char* getVersionName() const { return mVersionName
; }
116 void setVersionName(const char* val
) { mVersionName
= val
; }
119 * Set and get the file specification.
121 * Note this does NOT make a copy of argv.
123 void setFileSpec(char* const argv
[], int argc
) {
127 int getFileSpecCount(void) const { return mArgc
; }
128 const char* getFileSpecEntry(int idx
) const { return mArgv
[idx
]; }
129 void eatArgs(int n
) {
130 if (n
> mArgc
) n
= mArgc
;
137 * Package count. Nothing to do with anything else here; this is
138 * just a convenient place to stuff it so we don't have to pass it
141 int getPackageCount(void) const { return mPackageCount
; }
142 void setPackageCount(int val
) { mPackageCount
= val
; }
146 /* commands & modifiers */
151 int mGrayscaleTolerance
;
152 bool mMakePackageDirs
;
155 bool mRequireLocalization
;
156 bool mPseudolocalize
;
158 int mCompressionMethod
;
159 const char* mOutputAPKFile
;
160 const char* mAssetSourceDir
;
161 const char* mAndroidManifestFile
;
162 const char* mPublicOutputFile
;
163 const char* mRClassDir
;
164 const char* mResourceIntermediatesDir
;
165 android::String8 mConfigurations
;
166 android::Vector
<const char*> mPackageIncludes
;
167 android::Vector
<const char*> mJarFiles
;
168 android::Vector
<const char*> mNoCompressExtensions
;
169 android::Vector
<const char*> mResourceSourceDirs
;
171 const char* mMinSdkVersion
;
172 const char* mTargetSdkVersion
;
173 const char* mMaxSdkVersion
;
174 const char* mVersionCode
;
175 const char* mVersionName
;
177 /* file specification */