diff options
author | 2018-02-06 12:36:27 -0800 | |
---|---|---|
committer | 2018-02-06 12:37:47 -0800 | |
commit | fe68c6b586e96aff48259f78f82568c59260a1ef (patch) | |
tree | 0048699815ac206d142406ed95c1332f7a2c10a2 /src/test/java/com/google/devtools | |
parent | 5e573b6d7227d0e0146f5ac63956848a1c366c21 (diff) |
Always do filtering in execution (even after doing it in analysis)
Filtering only in analysis was neglecting the possibility of resources being in
filesets, the contents of which are not available in analysis. As such, we must
*always* filter in execution, even though it's usually just going to be a
no-op.
Also, add some documentation of same.
RELNOTES: none
PiperOrigin-RevId: 184722564
Diffstat (limited to 'src/test/java/com/google/devtools')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java | 19 |
1 files changed, 13 insertions, 6 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 914dc8a906..227406c03a 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 @@ -1641,16 +1641,23 @@ public class AndroidBinaryTest extends AndroidBuildViewTestCase { // Only transitive resources need to be ignored when filtered,, and there aren't any here. assertThat(resourceArguments(directResources)).doesNotContain("--prefilteredResources"); - // Validate resource filters are not passed to execution, since they were applied in analysis + // Validate resource filters are passed to execution List<String> args = resourceArguments(directResources); - assertThat(args) - .doesNotContain(ResourceFilterFactory.RESOURCE_CONFIGURATION_FILTERS_NAME); - assertThat(args).doesNotContain(ResourceFilterFactory.DENSITIES_NAME); + + // Remove whitespace and quotes from the resourceConfigurationFilters attribute value to get the + // value we expect to pass to the resource processing action + String fixedResourceConfigFilters = resourceConfigurationFilters.replaceAll("[ ']", ""); + if (resourceConfigurationFilters.isEmpty()) { + assertThat(args).containsNoneOf("--resourceConfigs", fixedResourceConfigFilters); + } else { + assertThat(args).containsAllOf("--resourceConfigs", fixedResourceConfigFilters).inOrder(); + } + if (densities.isEmpty()) { - assertThat(args).doesNotContain("--densitiesForManifest"); + assertThat(args).containsNoneOf("--densities", densities); } else { // We still expect densities only for the purposes of adding information to manifests - assertThat(args).containsAllOf("--densitiesForManifest", densities); + assertThat(args).containsAllOf("--densities", densities).inOrder(); } } |