Merge "Add --max-res-version flag to aapt." into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
7525c2cfbb
@@ -1830,6 +1830,16 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bundle->getMaxResVersion() != NULL && group.version.length() != 0) {
|
||||||
|
int maxResInt = atoi(bundle->getMaxResVersion());
|
||||||
|
const char *verString = group.version.string();
|
||||||
|
int dirVersionInt = atoi(verString + 1); // skip 'v' in version name
|
||||||
|
if (dirVersionInt > maxResInt) {
|
||||||
|
fprintf(stderr, "max res %d, skipping %s\n", maxResInt, entry->d_name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileType type = getFileType(subdirName.string());
|
FileType type = getFileType(subdirName.string());
|
||||||
|
|
||||||
if (type == kFileTypeDirectory) {
|
if (type == kFileTypeDirectory) {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public:
|
|||||||
mRClassDir(NULL), mResourceIntermediatesDir(NULL), mManifestMinSdkVersion(NULL),
|
mRClassDir(NULL), mResourceIntermediatesDir(NULL), mManifestMinSdkVersion(NULL),
|
||||||
mMinSdkVersion(NULL), mTargetSdkVersion(NULL), mMaxSdkVersion(NULL),
|
mMinSdkVersion(NULL), mTargetSdkVersion(NULL), mMaxSdkVersion(NULL),
|
||||||
mVersionCode(NULL), mVersionName(NULL), mCustomPackage(NULL),
|
mVersionCode(NULL), mVersionName(NULL), mCustomPackage(NULL),
|
||||||
|
mMaxResVersion(NULL),
|
||||||
mArgc(0), mArgv(NULL)
|
mArgc(0), mArgv(NULL)
|
||||||
{}
|
{}
|
||||||
~Bundle(void) {}
|
~Bundle(void) {}
|
||||||
@@ -134,6 +135,8 @@ public:
|
|||||||
void setVersionName(const char* val) { mVersionName = val; }
|
void setVersionName(const char* val) { mVersionName = val; }
|
||||||
const char* getCustomPackage() const { return mCustomPackage; }
|
const char* getCustomPackage() const { return mCustomPackage; }
|
||||||
void setCustomPackage(const char* val) { mCustomPackage = val; }
|
void setCustomPackage(const char* val) { mCustomPackage = val; }
|
||||||
|
const char* getMaxResVersion() const { return mMaxResVersion; }
|
||||||
|
void setMaxResVersion(const char * val) { mMaxResVersion = val; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set and get the file specification.
|
* Set and get the file specification.
|
||||||
@@ -230,6 +233,7 @@ private:
|
|||||||
const char* mVersionCode;
|
const char* mVersionCode;
|
||||||
const char* mVersionName;
|
const char* mVersionName;
|
||||||
const char* mCustomPackage;
|
const char* mCustomPackage;
|
||||||
|
const char* mMaxResVersion;
|
||||||
|
|
||||||
/* file specification */
|
/* file specification */
|
||||||
int mArgc;
|
int mArgc;
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ void usage(void)
|
|||||||
" [--rename-manifest-package PACKAGE] \\\n"
|
" [--rename-manifest-package PACKAGE] \\\n"
|
||||||
" [--rename-instrumentation-target-package PACKAGE] \\\n"
|
" [--rename-instrumentation-target-package PACKAGE] \\\n"
|
||||||
" [--utf16] [--auto-add-overlay] \\\n"
|
" [--utf16] [--auto-add-overlay] \\\n"
|
||||||
|
" [--max-res-version VAL] \\\n"
|
||||||
" [-I base-package [-I base-package ...]] \\\n"
|
" [-I base-package [-I base-package ...]] \\\n"
|
||||||
" [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \\\n"
|
" [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \\\n"
|
||||||
" [-S resource-sources [-S resource-sources ...]] "
|
" [-S resource-sources [-S resource-sources ...]] "
|
||||||
@@ -128,6 +129,8 @@ void usage(void)
|
|||||||
" higher, the default encoding for resources will be in UTF-8.\n"
|
" higher, the default encoding for resources will be in UTF-8.\n"
|
||||||
" --target-sdk-version\n"
|
" --target-sdk-version\n"
|
||||||
" inserts android:targetSdkVersion in to manifest.\n"
|
" inserts android:targetSdkVersion in to manifest.\n"
|
||||||
|
" --max-res-version\n"
|
||||||
|
" ignores versioned resource directories above the given value.\n"
|
||||||
" --values\n"
|
" --values\n"
|
||||||
" when used with \"dump resources\" also includes resource values.\n"
|
" when used with \"dump resources\" also includes resource values.\n"
|
||||||
" --version-code\n"
|
" --version-code\n"
|
||||||
@@ -416,6 +419,15 @@ int main(int argc, char* const argv[])
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
bundle.setMaxSdkVersion(argv[0]);
|
bundle.setMaxSdkVersion(argv[0]);
|
||||||
|
} else if (strcmp(cp, "-max-res-version") == 0) {
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
if (!argc) {
|
||||||
|
fprintf(stderr, "ERROR: No argument supplied for '--max-res-version' option\n");
|
||||||
|
wantUsage = true;
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
bundle.setMaxResVersion(argv[0]);
|
||||||
} else if (strcmp(cp, "-version-code") == 0) {
|
} else if (strcmp(cp, "-version-code") == 0) {
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
|
|||||||
Reference in New Issue
Block a user