diff options
author | 2018-05-07 11:39:09 -0700 | |
---|---|---|
committer | 2018-05-07 11:40:31 -0700 | |
commit | 1ad8a8815e5d0f646f12fbcb2ec53a79fb8dcb79 (patch) | |
tree | e74638d1b8e6b726db0cfd06114417a8315027bd /src/test/java/com/google/devtools/build/lib/rules/android | |
parent | e3faeb73c352ff55f08164801c61784b91cf4e9b (diff) |
Stop collapsing NestedSet of deps in RClassGenerator
This collapsing should be avoided when possible, and punted on until execution when needed.
RELNOTES: none
PiperOrigin-RevId: 195695290
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules/android')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java index 1dd3e80eed..3a9bb90190 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java @@ -1959,6 +1959,50 @@ public class AndroidBinaryTest extends AndroidBuildViewTestCase { } @Test + public void testUseRClassGeneratorMultipleDeps() throws Exception { + scratch.file( + "java/r/android/BUILD", + "android_library(name = 'lib1',", + " manifest = 'AndroidManifest.xml',", + " resource_files = glob(['res1/**']),", + " )", + "android_library(name = 'lib2',", + " manifest = 'AndroidManifest.xml',", + " resource_files = glob(['res2/**']),", + " )", + "android_binary(name = 'r',", + " manifest = 'AndroidManifest.xml',", + " resource_files = glob(['res/**']),", + " deps = [':lib1', ':lib2'],", + " )"); + ConfiguredTargetAndData binary = getConfiguredTargetAndData("//java/r/android:r"); + Artifact jar = getResourceClassJar(binary); + assertThat(getGeneratingAction(jar).getMnemonic()).isEqualTo("RClassGenerator"); + List<String> args = getGeneratingSpawnActionArgs(jar); + + AndroidResourcesInfo resourcesInfo = + binary.getConfiguredTarget().get(AndroidResourcesInfo.PROVIDER); + assertThat(resourcesInfo.getTransitiveAndroidResources()).hasSize(2); + ValidatedAndroidData firstDep = resourcesInfo.getTransitiveAndroidResources().toList().get(0); + ValidatedAndroidData secondDep = resourcesInfo.getTransitiveAndroidResources().toList().get(1); + + assertThat(args) + .containsAllOf( + "--primaryRTxt", + "--primaryManifest", + "--library", + firstDep.getRTxt().getExecPathString() + + "," + + firstDep.getManifest().getExecPathString(), + "--library", + secondDep.getRTxt().getExecPathString() + + "," + + secondDep.getManifest().getExecPathString(), + "--classJarOutput") + .inOrder(); + } + + @Test public void testNoCrunchBinaryOnly() throws Exception { scratch.file("java/r/android/BUILD", "android_binary(name = 'r',", |