Avoid building android R class ijar / header jar It is already ignored and the real jar used as the compileTime jar in AndroidCommon. It's only used by the ide-resolve output group. The real jar is pretty close to the header jar in terms of content (field inits deleted). Tradeoff: The real jar is ~33% bigger (w/ same compression level), vs save build time and space by skipping the hjar actions and artifacts. At android_binary level, the hjar action can take ~40 seconds in some cases. At the library level, the hjar time is pretty tiny. hjars are not compressed. We could compress the real jars to make up for the extra 30% size (and beat the hjar size), but that adds ~25% elapsed time to do the compression (e.g., 10s vs 7.5s). Compression can shrink the jar 2-3x (37MB vs 100MB). -- MOS_MIGRATED_REVID=131588283
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java index 8748ed3..f8473ea 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
@@ -136,7 +136,6 @@ private Artifact genClassJar; private Artifact genSourceJar; private Artifact resourceClassJar; - private Artifact resourceIJar; private Artifact resourceSourceJar; private Artifact outputDepsProto; @@ -436,7 +435,6 @@ javaArtifactsBuilder); } javacHelper.createSourceJarAction(resourceSourceJar, null); - resourceIJar = javacHelper.createCompileTimeJarAction(resourceClassJar, javaArtifactsBuilder); } private void createJarJarActions( @@ -701,8 +699,8 @@ .addOutputJar(classJar, iJar, srcJar) .setJdeps(outputDepsProto); OutputJar resourceJar = null; - if (resourceClassJar != null && resourceIJar != null && resourceSourceJar != null) { - resourceJar = new OutputJar(resourceClassJar, resourceIJar, resourceSourceJar); + if (resourceClassJar != null && resourceSourceJar != null) { + resourceJar = new OutputJar(resourceClassJar, null, resourceSourceJar); outputJarsBuilder.addOutputJar(resourceJar); }
diff --git a/src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java b/src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java index 4f59705..d06352e 100644 --- a/src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java +++ b/src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java
@@ -616,7 +616,7 @@ jarString("com/google/example", "libl.jar", "libl-ijar.jar", "libl-src.jar"), jarString("com/google/example", - "l_resources.jar", "l_resources-ijar.jar", "l_resources-src.jar")); + "l_resources.jar", null, "l_resources-src.jar")); assertThat( transform( ruleInfo.getAndroidRuleIdeInfo().getResourcesList(), ARTIFACT_TO_RELATIVE_PATH)) @@ -626,7 +626,7 @@ assertThat(ruleInfo.getAndroidRuleIdeInfo().getJavaPackage()).isEqualTo("com.google.example"); assertThat(LIBRARY_ARTIFACT_TO_STRING.apply(ruleInfo.getAndroidRuleIdeInfo().getResourceJar())) .isEqualTo(jarString("com/google/example", - "l_resources.jar", "l_resources-ijar.jar", "l_resources-src.jar" + "l_resources.jar", null, "l_resources-src.jar" )); assertThat(ruleInfo.getDependenciesList()).contains("//com/google/example:l1"); @@ -635,12 +635,10 @@ "com/google/example/libl-ijar.jar", "com/google/example/libl-src.jar", "com/google/example/l_resources.jar", - "com/google/example/l_resources-ijar.jar", "com/google/example/l_resources-src.jar", "com/google/example/libl1.jar", "com/google/example/libl1-src.jar", "com/google/example/l1_resources.jar", - "com/google/example/l1_resources-ijar.jar", "com/google/example/l1_resources-src.jar"); assertThat(ruleInfo.getJavaRuleIdeInfo().getJdeps().getRelativePath()) .isEqualTo("com/google/example/libl.jdeps"); @@ -677,7 +675,7 @@ jarString("com/google/example", "libb.jar", "libb-ijar.jar", "libb-src.jar"), jarString("com/google/example", - "b_resources.jar", "b_resources-ijar.jar", "b_resources-src.jar")); + "b_resources.jar", null, "b_resources-src.jar")); assertThat( transform( @@ -697,12 +695,10 @@ "com/google/example/libb-ijar.jar", "com/google/example/libb-src.jar", "com/google/example/b_resources.jar", - "com/google/example/b_resources-ijar.jar", "com/google/example/b_resources-src.jar", "com/google/example/libl1.jar", "com/google/example/libl1-src.jar", "com/google/example/l1_resources.jar", - "com/google/example/l1_resources-ijar.jar", "com/google/example/l1_resources-src.jar"); assertThat(ruleInfo.getJavaRuleIdeInfo().getJdeps().getRelativePath()) .isEqualTo("com/google/example/libb.jdeps"); @@ -792,7 +788,6 @@ "com/google/example/liblib.jar", "com/google/example/liblib-src.jar", "com/google/example/lib_resources.jar", - "com/google/example/lib_resources-ijar.jar", "com/google/example/lib_resources-src.jar", "com/google/example/AndroidManifest.xml"); }