From ec94a847fa1fe53d8f41500baec0a8f5980c9b8b Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 25 Apr 2012 18:53:49 -0700 Subject: [PATCH] Apply --extra-packages in case --custom-pacakge is also specified. Cherry-picked from master. Change-Id: I2d67b8821afdf064f4186ccd8def1b65f9a7dc88 --- Command.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Command.cpp b/Command.cpp index a4473c8..d428fef 100644 --- a/Command.cpp +++ b/Command.cpp @@ -1740,20 +1740,6 @@ int doPackage(Bundle* bundle) // Write the R.java file into the appropriate class directory // e.g. gen/com/foo/app/R.java err = writeResourceSymbols(bundle, assets, assets->getPackage(), true); - // If we have library files, we're going to write our R.java file into - // the appropriate class directory for those libraries as well. - // e.g. gen/com/foo/app/lib/R.java - if (bundle->getExtraPackages() != NULL) { - // Split on colon - String8 libs(bundle->getExtraPackages()); - char* packageString = strtok(libs.lockBuffer(libs.length()), ":"); - while (packageString != NULL) { - // Write the R.java file out with the correct package name - err = writeResourceSymbols(bundle, assets, String8(packageString), true); - packageString = strtok(NULL, ":"); - } - libs.unlockBuffer(); - } } else { const String8 customPkg(bundle->getCustomPackage()); err = writeResourceSymbols(bundle, assets, customPkg, true); @@ -1761,6 +1747,23 @@ int doPackage(Bundle* bundle) if (err < 0) { goto bail; } + // If we have library files, we're going to write our R.java file into + // the appropriate class directory for those libraries as well. + // e.g. gen/com/foo/app/lib/R.java + if (bundle->getExtraPackages() != NULL) { + // Split on colon + String8 libs(bundle->getExtraPackages()); + char* packageString = strtok(libs.lockBuffer(libs.length()), ":"); + while (packageString != NULL) { + // Write the R.java file out with the correct package name + err = writeResourceSymbols(bundle, assets, String8(packageString), true); + if (err < 0) { + goto bail; + } + packageString = strtok(NULL, ":"); + } + libs.unlockBuffer(); + } } else { err = writeResourceSymbols(bundle, assets, assets->getPackage(), false); if (err < 0) { -- 2.45.2