aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
diff options
context:
space:
mode:
authorGravatar Chris Parsons <cparsons@google.com>2016-10-31 17:53:27 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2016-11-02 08:25:57 +0000
commitff47759a662c6e9664d3ed03836f73e2c0c6093f (patch)
tree51bf355fd89c81636ba0d6c3fb3a1e8988dfad82 /src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
parenta0e3af46ca41f55163188d4beef10534c006aaca (diff)
Initial implementation of "dylib" attribute for apple_binary and apple_dynamic_library rules
Provided values propagated from "dylib" dependencies will be compiled against the srcs of the rule, and linked together with the dependencies. It is worth noting that "dylibs" differs from "deps" in that there is no configuration transition along this edge. There is more work to be done on this attribute, so it remains undocumented. Namely, symbol deduping between dylib and statically-linked dependencies needs to be addressed. -- MOS_MIGRATED_REVID=137721599
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
index d86b1f1b57..749d653c31 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
@@ -965,6 +965,40 @@ public class ObjcRuleClasses {
}
/**
+ * Common attributes for apple rules that can depend on one or more dynamic libraries.
+ */
+ public static class DylibDependingRule implements RuleDefinition {
+
+ /**
+ * Attribute name for dylib dependencies.
+ */
+ static final String DYLIBS_ATTR_NAME = "dylibs";
+
+ @Override
+ public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
+ return builder
+ // TODO(b/32411441): Restrict the dylibs attribute to take only dylib dependencies.
+ // This will require refactoring ObjcProvider into alternate providers.
+ // TODO(cparsons): Subtract transitive dependencies from "deps" during linking, as needed.
+ // Also document this attribute when this is resolved.
+ .add(attr(DYLIBS_ATTR_NAME, LABEL_LIST)
+ .direct_compile_time_input()
+ .mandatoryNativeProviders(
+ ImmutableList.<Class<? extends TransitiveInfoProvider>>of(ObjcProvider.class))
+ .allowedFileTypes())
+ .build();
+ }
+
+ @Override
+ public Metadata getMetadata() {
+ return RuleDefinition.Metadata.builder()
+ .name("$apple_dylib_depending_rule")
+ .type(RuleClassType.ABSTRACT)
+ .build();
+ }
+ }
+
+ /**
* Common attributes for {@code objc_*} rules that create a bundle. Specifically, for rules
* which use the {@link Bundling} helper class.
*/