Skip to content

Commit

Permalink
Make classJarOutput of AndroidResourceMergingAction read package from…
Browse files Browse the repository at this point in the history
… manifest

if --packageForR is not specified.

RELNOTES: None
PiperOrigin-RevId: 166923102
  • Loading branch information
aj-michael authored and vladmos committed Aug 30, 2017
1 parent 95bf7c8 commit 75f97c1
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
package com.google.devtools.build.android;

import com.android.builder.core.VariantConfiguration;
import com.android.builder.core.VariantType;
import com.android.ide.common.internal.PngCruncher;
import com.android.ide.common.internal.PngException;
Expand Down Expand Up @@ -214,10 +215,15 @@ public static void main(String[] args) throws Exception {
logger.fine(String.format("Setup finished at %sms", timer.elapsed(TimeUnit.MILLISECONDS)));

VariantType packageType = VariantType.LIBRARY;
String packageForR = options.packageForR;
if (packageForR == null) {
packageForR =
Strings.nullToEmpty(
VariantConfiguration.getManifestPackage(options.primaryManifest.toFile()));
}
AndroidResourceClassWriter resourceClassWriter =
AndroidResourceClassWriter.createWith(aaptConfigOptions.androidJar,
generatedSources,
Strings.nullToEmpty(options.packageForR));
AndroidResourceClassWriter.createWith(
aaptConfigOptions.androidJar, generatedSources, packageForR);
resourceClassWriter.setIncludeClassFile(true);
resourceClassWriter.setIncludeJavaFile(false);

Expand Down

0 comments on commit 75f97c1

Please sign in to comment.