mRequireLocalization(false), mPseudolocalize(false),
mValues(false),
mCompressionMethod(0), mOutputAPKFile(NULL),
- mAssetSourceDir(NULL), mProguardFile(NULL),
+ mAutoAddOverlay(false), mAssetSourceDir(NULL), mProguardFile(NULL),
mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
mRClassDir(NULL), mResourceIntermediatesDir(NULL),
mMinSdkVersion(NULL), mTargetSdkVersion(NULL), mMaxSdkVersion(NULL),
void setJunkPath(bool val) { mJunkPath = val; }
const char* getOutputAPKFile() const { return mOutputAPKFile; }
void setOutputAPKFile(const char* val) { mOutputAPKFile = val; }
+ bool getAutoAddOverlay() { return mAutoAddOverlay; }
+ void setAutoAddOverlay(bool val) { mAutoAddOverlay = val; }
/*
* Input options.
int mCompressionMethod;
bool mJunkPath;
const char* mOutputAPKFile;
+ bool mAutoAddOverlay;
const char* mAssetSourceDir;
const char* mProguardFile;
const char* mAndroidManifestFile;
" [--min-sdk-version VAL] [--target-sdk-version VAL] \\\n"
" [--max-sdk-version VAL] [--app-version VAL] \\\n"
" [--app-version-name TEXT] [--custom-package VAL] \\\n"
+ " [--auto-add-overlay] \\\n"
" [-I base-package [-I base-package ...]] \\\n"
" [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \\\n"
" [-S resource-sources [-S resource-sources ...]] "
" --version-name\n"
" inserts android:versionName in to manifest.\n"
" --custom-package\n"
- " generates R.java into a different package.\n");
+ " generates R.java into a different package.\n"
+ " --auto-add-overlay\n"
+ " Automatically add resources that are only in overlays.\n");
}
/*
goto bail;
}
bundle.setCustomPackage(argv[0]);
+ } else if (strcmp(cp, "-auto-add-overlay") == 0) {
+ bundle.setAutoAddOverlay(true);
} else {
fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
wantUsage = true;
sourcePos.file.striing(), sourcePos.line, String8(type).string());
}
#endif
- if (overlay && !hasBagOrEntry(package, type, name)) {
+ if (overlay && !mBundle->getAutoAddOverlay() && !hasBagOrEntry(package, type, name)) {
bool canAdd = false;
sp<Package> p = mPackages.valueFor(package);
if (p != NULL) {
const SourcePos& sourcePos,
const ResTable_config* config,
bool doSetIndex,
- bool overlay)
+ bool overlay,
+ bool autoAddOverlay)
{
int pos = -1;
sp<ConfigList> c = mConfigs.valueFor(entry);
if (c == NULL) {
- if (overlay == true && mCanAddEntries.indexOf(entry) < 0) {
+ if (overlay && !autoAddOverlay && mCanAddEntries.indexOf(entry) < 0) {
sourcePos.error("Resource at %s appears in overlay but not"
" in the base package; use <add-resource> to add.\n",
String8(entry).string());
if (t == NULL) {
return NULL;
}
- return t->getEntry(name, sourcePos, config, doSetIndex, overlay);
+ return t->getEntry(name, sourcePos, config, doSetIndex, overlay, mBundle->getAutoAddOverlay());
}
sp<const ResourceTable::Entry> ResourceTable::getEntry(uint32_t resID,
const SourcePos& pos,
const ResTable_config* config = NULL,
bool doSetIndex = false,
- bool overlay = false);
+ bool overlay = false,
+ bool autoAddOverlay = false);
const SourcePos& getFirstPublicSourcePos() const { return *mFirstPublicSourcePos; }