aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
diff options
context:
space:
mode:
authorGravatar Cal Peyser <cpeyser@google.com>2016-06-06 21:21:46 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-06-07 07:49:00 +0000
commitc88fcfdd56ac1eb3b825751833ec823327809672 (patch)
treede9bf958e7a3f3109a3fd00e4afe08e2f366c418 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
parent4c839b5a7e034fb81bcb6b8235e9be3ea0a9a3d9 (diff)
Add module map support to ExperimentalObjcLibrary, which contains experimental support
for building objc code using the c++ crosstool. This will eventually replace the current module support in blaze. Note: This required injecting a CppModuleMap into the cc logic. The reason that objc cannot rely on standard CppModuleMap creation logic is that there is different naming semantics for module maps between cpp and objc. In particular: - In cc, module maps can be inputs to a compilation action. Thus, the module maps are given labels. - In objc, if interoping with swift, module maps are explicitly referenced in swift code. Thus, their names cannot contain illegal characters for swift source. Those, some name mangling occurs to get rid of "//" and ":". To enforce that this does not cause problems with compilation actions, the CPP_MODULE_COMPILE action has been disabled for the objc CcLibraryHelper.SourceCategory -- MOS_MIGRATED_REVID=124177067
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
index 7069c8fbcd..f554eb9c34 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
@@ -418,17 +418,17 @@ public class CppHelper {
return (dep != null) ? dep.getProvider(LipoContextProvider.class) : null;
}
- // Creates CppModuleMap object, and adds it to C++ compilation context.
- public static CppModuleMap addCppModuleMapToContext(RuleContext ruleContext,
- CppCompilationContext.Builder contextBuilder) {
+ /**
+ * Creates a CppModuleMap object for pure c++ builds. The module map artifact becomes a
+ * candidate input to a CppCompileAction.
+ */
+ public static CppModuleMap createDefaultCppModuleMap(RuleContext ruleContext) {
// Create the module map artifact as a genfile.
Artifact mapFile = ruleContext.getPackageRelativeArtifact(
ruleContext.getLabel().getName()
+ Iterables.getOnlyElement(CppFileTypes.CPP_MODULE_MAP.getExtensions()),
ruleContext.getConfiguration().getGenfilesDirectory());
- CppModuleMap moduleMap = new CppModuleMap(mapFile, ruleContext.getLabel().toString());
- contextBuilder.setCppModuleMap(moduleMap);
- return moduleMap;
+ return new CppModuleMap(mapFile, ruleContext.getLabel().toString());
}
/**