diff options
author | 2017-03-24 15:32:53 +0000 | |
---|---|---|
committer | 2017-03-27 11:35:01 +0000 | |
commit | 74e90608de56759247c12f0eabfdcf26b0cfd19f (patch) | |
tree | 666c65461da650ced96242ceffb047083641e8d0 /src/main/java/com/google/devtools/build/lib/rules/android/ResourceContainer.java | |
parent | 28d378bb6d62a59930142d618af882b257491c05 (diff) |
Un-rollback and fix bugs in resource density filtering
Rollback of commit df366408188f0451bae9b2ed079c795a4beb2e2b.
In addition to undoing the rollback of my previous change, fix the bugs it
introduced and add tests for those bugs.
Always ignore empty filters. Empty filters are always useless or
counterproductive. Before the original change, empty filters as a single item
within the list of filters (e.g., ["en", ""]) were ignored, but empty filters
as a portion of a string in the list (e.g., ["en,"]) were not. I can't imagine
any reason people would actually want the empty filter (if it were handled
correctly, it would effectively tell Bazel to just ignore every other filter
the user passed in).
Since it makes more sense with the new code, represent the stringified filters
as a list of strings, rather than a single string of comma-seperated values.
Manually trim whitespace from each token. Before the original change, the code
trimmed whitespace following commas (e.g., ["en, es"] -> ["en,es"]) but not
otherwise. If we're allowing whitespace in filter strings anyway, there doesn't
seem to be any reason to allow it in some places but not others.
--
PiperOrigin-RevId: 151128685
MOS_MIGRATED_REVID=151128685
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/ResourceContainer.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/ResourceContainer.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceContainer.java b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceContainer.java index c89de68856..a18daa0027 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceContainer.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceContainer.java @@ -128,7 +128,7 @@ public abstract class ResourceContainer { /** * Returns a copy of this container with filtered resources. The original container is unchanged. */ - public ResourceContainer filter(ResourceConfigurationFilter filter) { + public ResourceContainer filter(ResourceFilter filter) { return toBuilder().setResources(filter.filter(getResources())).build(); } |