aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-09-28 15:05:34 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-09-30 09:31:08 +0000
commit760d1f54a3889d64c81f2caa6f253f3d6e6c8109 (patch)
treeaf3b7b96d661a1e82ec39c05b50097204a79c2af /src/main
parent0113352ad8c5653d04af7bcbd7b1225000652ab3 (diff)
Adds the textual_hdrs attribute, which are treated as regular headers but not currently included in the module map. On Xcode 7, we should add them to the module map as additionalExportedHeaders, since it supports the textual keyword.
RELNOTES: Add support for objc textual headers, which will not be compiled when modules are enabled. -- MOS_MIGRATED_REVID=104100551
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java13
3 files changed, 30 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
index 60b90f2560..adaa108871 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
@@ -430,8 +430,9 @@ public final class CompilationSupport {
.addExecPath("-emit-module-path", intermediateArtifacts.swiftModuleFile(sourceFile));
- ImmutableList.Builder<Artifact> inputHeaders = ImmutableList.builder();
- inputHeaders.addAll(attributes.hdrs());
+ ImmutableList.Builder<Artifact> inputHeaders = ImmutableList.<Artifact>builder()
+ .addAll(attributes.hdrs())
+ .addAll(attributes.textualHdrs());
Optional<Artifact> bridgingHeader = attributes.bridgingHeader();
if (bridgingHeader.isPresent()) {
@@ -635,6 +636,8 @@ public final class CompilationSupport {
CompilationSupport registerGenerateModuleMapAction(
Optional<CompilationArtifacts> compilationArtifacts) {
if (ObjcRuleClasses.objcConfiguration(ruleContext).moduleMapsEnabled()) {
+ // TODO(bazel-team): Include textual headers in the module map when Xcode 6 support is
+ // dropped.
Iterable<Artifact> publicHeaders = attributes.hdrs();
Iterable<Artifact> privateHeaders = ImmutableList.of();
if (compilationArtifacts.isPresent()) {
@@ -1029,6 +1032,7 @@ public final class CompilationSupport {
xcodeProviderBuilder
.addHeaders(attributes.hdrs())
+ .addHeaders(attributes.textualHdrs())
.addUserHeaderSearchPaths(ObjcCommon.userHeaderSearchPaths(ruleContext.getConfiguration()))
.addHeaderSearchPaths("$(WORKSPACE_ROOT)", attributes.headerSearchPaths())
.addHeaderSearchPaths("$(SDKROOT)/usr/include", attributes.sdkIncludes())
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
index 7414c9c522..2c72aae3b6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
@@ -105,6 +105,17 @@ public final class ObjcCommon {
return ImmutableList.copyOf(CcCommon.getHeaders(ruleContext));
}
+ /**
+ * Returns headers that cannot be compiled individually.
+ */
+ ImmutableList<Artifact> textualHdrs() {
+ // Some rules may compile but not have the "textual_hdrs" attribute.
+ if (!ruleContext.attributes().has("textual_hdrs", BuildType.LABEL_LIST)) {
+ return ImmutableList.of();
+ }
+ return ruleContext.getPrerequisiteArtifacts("textual_hdrs", Mode.TARGET).list();
+ }
+
Optional<Artifact> bridgingHeader() {
Artifact header = ruleContext.getPrerequisiteArtifact("bridging_header", Mode.TARGET);
return Optional.fromNullable(header);
@@ -480,6 +491,7 @@ public final class ObjcCommon {
TO_PATH_FRAGMENT);
objcProvider
.addAll(HEADER, attributes.hdrs())
+ .addAll(HEADER, attributes.textualHdrs())
.addAll(INCLUDE, attributes.headerSearchPaths())
.addAll(INCLUDE, sdkIncludes)
.addAll(SDK_FRAMEWORK, attributes.sdkFrameworks())
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 b17ec21321..a3ae6b4240 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
@@ -553,12 +553,23 @@ public class ObjcRuleClasses {
/* <!-- #BLAZE_RULE($objc_compile_dependency_rule).ATTRIBUTE(hdrs) -->
The list of C, C++, Objective-C, and Objective-C++ files that are
included as headers by source files in this rule or by users of this
- library.
+ library. These will be compiled separately from the source if modules
+ are enabled.
${SYNOPSIS}
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("hdrs", LABEL_LIST)
.direct_compile_time_input()
.allowedFileTypes(HDRS_TYPE))
+ /* <!-- #BLAZE_RULE($objc_compile_dependency_rule).ATTRIBUTE(textual_hdrs) -->
+ The list of C, C++, Objective-C, and Objective-C++ files that are
+ included as headers by source files in this rule or by users of this
+ library. Unlike hdrs, these will not be compiled separately from the
+ sources.
+ ${SYNOPSIS}
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(attr("textual_hdrs", LABEL_LIST)
+ .direct_compile_time_input()
+ .allowedFileTypes(HDRS_TYPE))
/* <!-- #BLAZE_RULE($objc_compile_dependency_rule).ATTRIBUTE(bridging_header) -->
A header defining the Objective-C interfaces to be exposed in Swift.
${SYNOPSIS}