Private resource package shouldn't be buried in some resource file.
It can now be specified on the command line via the Android.mk file.
Change-Id: I9e3cb0bf54830d6b021077af271913306c024701
const android::String8& getPlatformBuildVersionName() { return mPlatformVersionName; }
void setPlatformBuildVersionName(const android::String8& name) { mPlatformVersionName = name; }
+ const android::String8& getPrivateSymbolsPackage() const { return mPrivateSymbolsPackage; }
+
+ void setPrivateSymbolsPackage(const android::String8& package) {
+ mPrivateSymbolsPackage = package;
+ }
+
bool getUTF16StringsOption() {
return mWantUTF16 || !isMinSdkAtLeast(SDK_FROYO);
}
bool mBuildAppAsSharedLibrary;
android::String8 mPlatformVersionCode;
android::String8 mPlatformVersionName;
+ android::String8 mPrivateSymbolsPackage;
/* file specification */
int mArgc;
" Prevents symbols from being generated for strings that do not have a default\n"
" localization\n"
" --no-version-vectors\n"
- " Do not automatically generate versioned copies of vector XML resources.\n",
+ " Do not automatically generate versioned copies of vector XML resources.\n"
+ " --private-symbols\n"
+ " Java package name to use when generating R.java for private resources.\n",
gDefaultIgnoreAssets);
}
bundle.setPseudolocalize(PSEUDO_ACCENTED | PSEUDO_BIDI);
} else if (strcmp(cp, "-no-version-vectors") == 0) {
bundle.setNoVersionVectors(true);
+ } else if (strcmp(cp, "-private-symbols") == 0) {
+ argc--;
+ argv++;
+ if (!argc) {
+ fprintf(stderr, "ERROR: No argument supplied for "
+ "'--private-symbols' option\n");
+ wantUsage = true;
+ goto bail;
+ }
+ bundle.setPrivateSymbolsPackage(String8(argv[0]));
} else {
fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
wantUsage = true;
printf("Creating resources for package %s\n", assets->getPackage().string());
}
+ // Set the private symbols package if it was declared.
+ // This can also be declared in XML as <private-symbols name="package" />
+ if (bundle->getPrivateSymbolsPackage().size() != 0) {
+ assets->setSymbolsPrivatePackage(bundle->getPrivateSymbolsPackage());
+ }
+
ResourceTable::PackageType packageType = ResourceTable::App;
if (bundle->getBuildSharedLibrary()) {
packageType = ResourceTable::SharedLibrary;
}
pkg = String16(block.getAttributeStringValue(pkgIdx, &len));
if (!localHasErrors) {
- assets->setSymbolsPrivatePackage(String8(pkg));
+ SourcePos(in->getPrintableSource(), block.getLineNumber()).warning(
+ "<private-symbols> is deprecated. Use the command line flag "
+ "--private-symbols instead.\n");
+ if (assets->havePrivateSymbols()) {
+ SourcePos(in->getPrintableSource(), block.getLineNumber()).warning(
+ "private symbol package already specified. Ignoring...\n");
+ } else {
+ assets->setSymbolsPrivatePackage(String8(pkg));
+ }
}
while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {