diff options
author | Xavier Ducrohet <xav@android.com> | 2011-07-19 10:10:15 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-07-19 10:10:15 -0700 |
commit | 2e659ae59c17a0c0584d35b8c400a294c9d49e12 (patch) | |
tree | 0001ad6ea39148a4dafb95e331d397aecf9b3fe4 | |
parent | a74774fd9146aa22801487d3652dc18e9e328b8e (diff) | |
parent | 42755155d6e8ddc3201b08def2bf262a64fa25f2 (diff) | |
download | frameworks_base-2e659ae59c17a0c0584d35b8c400a294c9d49e12.zip frameworks_base-2e659ae59c17a0c0584d35b8c400a294c9d49e12.tar.gz frameworks_base-2e659ae59c17a0c0584d35b8c400a294c9d49e12.tar.bz2 |
am 42755155: Merge "Copy once-created R.java into library projects"
* commit '42755155d6e8ddc3201b08def2bf262a64fa25f2':
Copy once-created R.java into library projects
-rw-r--r-- | tools/aapt/Bundle.h | 5 | ||||
-rw-r--r-- | tools/aapt/Command.cpp | 11 | ||||
-rw-r--r-- | tools/aapt/Main.cpp | 11 |
3 files changed, 26 insertions, 1 deletions
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h index fa84e93..a32aa7f 100644 --- a/tools/aapt/Bundle.h +++ b/tools/aapt/Bundle.h @@ -45,7 +45,7 @@ public: mAndroidManifestFile(NULL), mPublicOutputFile(NULL), mRClassDir(NULL), mResourceIntermediatesDir(NULL), mManifestMinSdkVersion(NULL), mMinSdkVersion(NULL), mTargetSdkVersion(NULL), mMaxSdkVersion(NULL), - mVersionCode(NULL), mVersionName(NULL), mCustomPackage(NULL), + mVersionCode(NULL), mVersionName(NULL), mCustomPackage(NULL), mExtraPackages(NULL), mMaxResVersion(NULL), mDebugMode(false), mNonConstantId(false), mProduct(NULL), mArgc(0), mArgv(NULL) {} @@ -138,6 +138,8 @@ public: void setVersionName(const char* val) { mVersionName = val; } const char* getCustomPackage() const { return mCustomPackage; } void setCustomPackage(const char* val) { mCustomPackage = val; } + const char* getExtraPackages() const { return mExtraPackages; } + void setExtraPackages(const char* val) { mExtraPackages = val; } const char* getMaxResVersion() const { return mMaxResVersion; } void setMaxResVersion(const char * val) { mMaxResVersion = val; } bool getDebugMode() { return mDebugMode; } @@ -243,6 +245,7 @@ private: const char* mVersionCode; const char* mVersionName; const char* mCustomPackage; + const char* mExtraPackages; const char* mMaxResVersion; bool mDebugMode; bool mNonConstantId; diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 739763e..c7dfb8f 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -1414,6 +1414,17 @@ int doPackage(Bundle* bundle) if (assets->getPackage() == assets->getSymbolsPrivatePackage()) { if (bundle->getCustomPackage() == NULL) { err = writeResourceSymbols(bundle, assets, assets->getPackage(), true); + // Copy R.java for libraries + if (bundle->getExtraPackages() != NULL) { + // Split on semicolon + String8 libs(bundle->getExtraPackages()); + char* packageString = strtok(libs.lockBuffer(libs.length()), ";"); + while (packageString != NULL) { + err = writeResourceSymbols(bundle, assets, String8(packageString), true); + packageString = strtok(NULL, ";"); + } + libs.unlockBuffer(); + } } else { const String8 customPkg(bundle->getCustomPackage()); err = writeResourceSymbols(bundle, assets, customPkg, true); diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp index 1e63131..732541d 100644 --- a/tools/aapt/Main.cpp +++ b/tools/aapt/Main.cpp @@ -145,6 +145,8 @@ void usage(void) " inserts android:versionName in to manifest.\n" " --custom-package\n" " generates R.java into a different package.\n" + " --extra-packages\n" + " generate R.java for libraries. Separate libraries with ';'.\n" " --auto-add-overlay\n" " Automatically add resources that are only in overlays.\n" " --rename-manifest-package\n" @@ -475,6 +477,15 @@ int main(int argc, char* const argv[]) goto bail; } bundle.setCustomPackage(argv[0]); + } else if (strcmp(cp, "-extra-packages") == 0) { + argc--; + argv++; + if (!argc) { + fprintf(stderr, "ERROR: No argument supplied for '--extra-packages' option\n"); + wantUsage = true; + goto bail; + } + bundle.setExtraPackages(argv[0]); } else if (strcmp(cp, "-utf16") == 0) { bundle.setWantUTF16(true); } else if (strcmp(cp, "-rename-manifest-package") == 0) { |