aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcSrcsProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcSrcsProvider.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcSrcsProvider.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcSrcsProvider.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcSrcsProvider.java
index 9c745276e5..886721fbbc 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcSrcsProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcSrcsProvider.java
@@ -62,15 +62,28 @@ public final class J2ObjcSrcsProvider implements TransitiveInfoProvider {
/**
* Transitively adds all the J2ObjcSrcsProviders and all their properties
- * that can be reached through the "deps" attribute of the given RuleContext.
+ * that can be reached through the "deps", "exports" and "runtime_deps" attributes.
*
- * @param ruleContext the rule context in which to look for deps
+ * @param ruleContext the rule context
* @return this builder
*/
- public Builder addTransitiveFromDeps(RuleContext ruleContext) {
- if (ruleContext.attributes().has("deps", Type.LABEL_LIST)) {
+ public Builder addTransitiveJ2ObjcSrcs(RuleContext ruleContext) {
+ return addTransitiveJ2ObjcSrcs(ruleContext, "deps")
+ .addTransitiveJ2ObjcSrcs(ruleContext, "exports")
+ .addTransitiveJ2ObjcSrcs(ruleContext, "runtime_deps");
+ }
+
+ /**
+ * Transitively adds the J2ObjCSrcsProviders of a given attribute to this Builder.
+ *
+ * @param ruleContext the rule context
+ * @param attribute the attribute to which to add sources
+ * @return this builder
+ */
+ public Builder addTransitiveJ2ObjcSrcs(RuleContext ruleContext, String attribute) {
+ if (ruleContext.attributes().has(attribute, Type.LABEL_LIST)) {
for (J2ObjcSrcsProvider provider :
- ruleContext.getPrerequisites("deps", Mode.TARGET, J2ObjcSrcsProvider.class)) {
+ ruleContext.getPrerequisites(attribute, Mode.TARGET, J2ObjcSrcsProvider.class)) {
addTransitive(provider);
}
}
@@ -118,7 +131,7 @@ public final class J2ObjcSrcsProvider implements TransitiveInfoProvider {
* @param ruleContext the rule context in which to look for deps
*/
public static J2ObjcSrcsProvider buildFrom(RuleContext ruleContext) {
- return new Builder().addTransitiveFromDeps(ruleContext).build();
+ return new Builder().addTransitiveJ2ObjcSrcs(ruleContext).build();
}
/**