aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Dmitry Shevchenko <dmishe@google.com>2016-06-28 19:37:40 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-06-29 08:55:31 +0000
commit322e4e20510005f261f71abb1ba0beb2fe38d0cf (patch)
tree0df1acb45d3de07190d05ca16273a634d93bd2e7 /src
parent9a8064d1784efc75e3e83e01ffc3a51b93cf56ee (diff)
Filter out non-headers from module maps generated by objc_ rules.
-- MOS_MIGRATED_REVID=126104957
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java22
1 files changed, 9 insertions, 13 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 a90787f30f..6b71ae01eb 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
@@ -173,20 +173,19 @@ public final class CompilationSupport {
}
};
- /**
- * Predicate to remove '.inc' files from an iterable.
- */
- private static final Predicate<Artifact> NON_INC_FILES =
+ /** Predicate that matches all artifacts that can be used in a Clang module map. */
+ private static final Predicate<Artifact> MODULE_MAP_HEADER =
new Predicate<Artifact>() {
@Override
public boolean apply(Artifact artifact) {
- return !artifact.getFilename().endsWith(".inc");
+ // The current clang (clang-600.0.57) on Darwin doesn't support 'textual', so we can't
+ // have '.inc' files in the module map (since they're implictly textual).
+ // TODO(bazel-team): Use HEADERS file type once clang-700 is the base clang we support.
+ return artifact.getFilename().endsWith(".h");
}
};
- /**
- * Selects cc libraries that have alwayslink=1.
- */
+ /** Selects cc libraries that have alwayslink=1. */
private static final Predicate<Artifact> ALWAYS_LINKED_CC_LIBRARY =
new Predicate<Artifact>() {
@Override
@@ -977,11 +976,8 @@ public final class CompilationSupport {
*/
private void registerGenerateModuleMapAction(
CppModuleMap moduleMap, Iterable<Artifact> publicHeaders, Iterable<Artifact> privateHeaders) {
- // The current clang (clang-600.0.57) on Darwin doesn't support 'textual', so we can't have
- // '.inc' files in the module map (since they're implictly textual).
- // TODO(bazel-team): Remove filtering once clang-700 is the base clang we support.
- publicHeaders = Iterables.filter(publicHeaders, NON_INC_FILES);
- privateHeaders = Iterables.filter(privateHeaders, NON_INC_FILES);
+ publicHeaders = Iterables.filter(publicHeaders, MODULE_MAP_HEADER);
+ privateHeaders = Iterables.filter(privateHeaders, MODULE_MAP_HEADER);
ruleContext.registerAction(
new CppModuleMapAction(
ruleContext.getActionOwner(),