aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/AnalysisUtils.java
diff options
context:
space:
mode:
authorGravatar dslomov <dslomov@google.com>2017-07-25 10:25:01 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-07-25 13:17:51 +0200
commit6d884afa8da1b08288cb0108e8bbf6c22ec63393 (patch)
tree7baa5a95ee4f6a1be551972912076bcfdead2d35 /src/main/java/com/google/devtools/build/lib/analysis/AnalysisUtils.java
parent0bf2e8e7f53962dfebaacc886f983138fef5ab4e (diff)
Make all WithLegacySkylarkName providers declared providers.
RELNOTES: None PiperOrigin-RevId: 163042362
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/AnalysisUtils.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/AnalysisUtils.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisUtils.java b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisUtils.java
index 966471c37f..a5ad97eff9 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisUtils.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.lib.analysis;
-import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.Artifact;
@@ -100,15 +99,19 @@ public final class AnalysisUtils {
*/
public static <S extends TransitiveInfoCollection, C extends TransitiveInfoProvider> Iterable<S>
filterByProvider(Iterable<S> prerequisites, final Class<C> provider) {
- return Iterables.filter(prerequisites, new Predicate<S>() {
- @Override
- public boolean apply(S target) {
- return target.getProvider(provider) != null;
- }
- });
+ return Iterables.filter(prerequisites, target -> target.getProvider(provider) != null);
}
/**
+ * Returns the iterable of collections that have the specified provider.
+ */
+ public static <S extends TransitiveInfoCollection, C extends SkylarkClassObject> Iterable<S>
+ filterByProvider(Iterable<S> prerequisites, final NativeClassObjectConstructor<C> provider) {
+ return Iterables.filter(prerequisites, target -> target.get(provider) != null);
+ }
+
+
+ /**
* Returns the path of the associated manifest file for the path of a Fileset. Works for both
* exec paths and root relative paths.
*/