aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar Manuel Klimek <klimek@google.com>2016-04-21 12:00:25 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-04-21 14:54:37 +0000
commite5685efc492f1b0641e11e06e9a1b3538597b7ff (patch)
tree8c994a474352527c8e4c4931d09bc60cf2c965e1 /src/main/java/com/google
parent668fe479bd25ad9f0cc7091ab135f86bc73811df (diff)
Fix LIPO with C++ header modules.
When collecting LIPO context, do not create module actions. -- MOS_MIGRATED_REVID=120432142
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
index 076e7d286e..865a3d8758 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
@@ -228,6 +228,14 @@ public final class CppModel {
this.featureConfiguration = featureConfiguration;
return this;
}
+
+ /**
+ * @returns whether we want to provide header modules for the current target.
+ */
+ private boolean shouldProvideHeaderModules() {
+ return featureConfiguration.isEnabled(CppRuleClasses.HEADER_MODULES)
+ && !cppConfiguration.isLipoContextCollector();
+ }
/**
* @return the non-pic header module artifact for the current target.
@@ -272,17 +280,14 @@ public final class CppModel {
* @return whether this target needs to generate a pic header module.
*/
public boolean getGeneratesPicHeaderModule() {
- // TODO(bazel-team): Make sure cc_fake_binary works with header module support.
- return featureConfiguration.isEnabled(CppRuleClasses.HEADER_MODULES) && !fake
- && getGeneratePicActions();
+ return shouldProvideHeaderModules() && !fake && getGeneratePicActions();
}
/**
* @return whether this target needs to generate a non-pic header module.
*/
public boolean getGeneratesNoPicHeaderModule() {
- return featureConfiguration.isEnabled(CppRuleClasses.HEADER_MODULES) && !fake
- && getGenerateNoPicActions();
+ return shouldProvideHeaderModules() && !fake && getGenerateNoPicActions();
}
/**
@@ -390,7 +395,7 @@ public final class CppModel {
CcToolchainFeatures.Variables variables = buildVariables.build();
builder.setVariables(variables);
}
-
+
/**
* Constructs the C++ compiler actions. It generally creates one action for every specified source
* file. It takes into account LIPO, fake-ness, coverage, and PIC, in addition to using the
@@ -402,7 +407,7 @@ public final class CppModel {
AnalysisEnvironment env = ruleContext.getAnalysisEnvironment();
PathFragment objectDir = CppHelper.getObjDirectory(ruleContext.getLabel());
- if (featureConfiguration.isEnabled(CppRuleClasses.HEADER_MODULES)) {
+ if (shouldProvideHeaderModules()) {
Artifact moduleMapArtifact = context.getCppModuleMap().getArtifact();
Label moduleMapLabel = Label.parseAbsoluteUnchecked(context.getCppModuleMap().getName());
PathFragment outputName = getObjectOutputPath(moduleMapArtifact, objectDir);