aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-06-12 15:53:47 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-06-15 10:50:05 +0000
commit162d5b276e1539b1acc44afcd4a4ccadcf99023a (patch)
tree1dff00fc9e451cc47a3e95385b061f2fc95ea4ab /src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
parente54eee40d866326ca7b699e441c83c1c58be3ecf (diff)
Allow private header files in the srcs attribute of objc_* rules.
This uses CppModuleMap and CppModuleMapAction to generate clang module maps for the target and its transitive dependencies. clang enforces private header usage through these maps. Right now module maps are interpreted but modules aren't enabled. RELNOTES: Allow private header files in the srcs attribute of objc_* rules. -- MOS_MIGRATED_REVID=95844137
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.java32
1 files changed, 23 insertions, 9 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 dec8cc582c..32716a65d6 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
@@ -83,7 +83,7 @@ public class ObjcRuleClasses {
ruleContext.getBinOrGenfilesDirectory());
}
- static IntermediateArtifacts intermediateArtifacts(RuleContext ruleContext) {
+ public static IntermediateArtifacts intermediateArtifacts(RuleContext ruleContext) {
return new IntermediateArtifacts(
ruleContext.getAnalysisEnvironment(), ruleContext.getBinOrGenfilesDirectory(),
ruleContext.getLabel(), /*archiveFileNameSuffix=*/"");
@@ -314,7 +314,20 @@ public class ObjcRuleClasses {
private static final FileType NON_CPP_SOURCES = FileType.of(".m", ".c");
- static final FileTypeSet SRCS_TYPE = FileTypeSet.of(NON_CPP_SOURCES, CPP_SOURCES);
+ /**
+ * Header files, which are not compiled directly, but may be included/imported from source files.
+ */
+ static final FileType HEADERS = FileType.of(".h");
+
+ /**
+ * Files allowed in the srcs attribute. This includes private headers.
+ */
+ static final FileTypeSet SRCS_TYPE = FileTypeSet.of(NON_CPP_SOURCES, CPP_SOURCES, HEADERS);
+
+ /**
+ * Files that should actually be compiled.
+ */
+ static final FileTypeSet COMPILABLE_SRCS_TYPE = FileTypeSet.of(NON_CPP_SOURCES, CPP_SOURCES);
static final FileTypeSet NON_ARC_SRCS_TYPE = FileTypeSet.of(FileType.of(".m", ".mm"));
@@ -494,8 +507,8 @@ public class ObjcRuleClasses {
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
/* <!-- #BLAZE_RULE($objc_compile_dependency_rule).ATTRIBUTE(hdrs) -->
- The list of Objective-C files that are included as headers by source
- files in this rule or by users of this library.
+ 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.
${SYNOPSIS}
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("hdrs", LABEL_LIST)
@@ -551,12 +564,13 @@ public class ObjcRuleClasses {
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
/* <!-- #BLAZE_RULE($objc_compiling_rule).ATTRIBUTE(srcs) -->
- The list of C, C++, Objective-C, and Objective-C++ files that are
- processed to create the library target.
+ The list of C, C++, Objective-C, and Objective-C++ source and header
+ files that are processed to create the library target.
${SYNOPSIS}
- These are your checked-in source files, plus any generated files.
- These are compiled into .o files with Clang, so headers should not go
- here (see the hdrs attribute).
+ These are your checked-in files, plus any generated files.
+ Source files are compiled into .o files with Clang. Header files
+ may be included/imported by any source or header in this target,
+ but not by any targets that depend on this rule.
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("srcs", LABEL_LIST)
.direct_compile_time_input()