Skip to content

Commit

Permalink
Only create the CppModuleMap action once from ObjcCompile actions.
Browse files Browse the repository at this point in the history
ObjcCompile create a CcCompilationHelper twice (with and without ARC enabled).
They both did create the identical CppModuleMap action that later was found as shareable.

After this CL, the module map action is only created in one of the compile calls.

RELNOTES: None
PiperOrigin-RevId: 256506511
  • Loading branch information
meisterT authored and copybara-github committed Jul 4, 2019
1 parent 4efb6c2 commit 5812b3d
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ private CompilationInfo compile(
// TODO(b/70777494): Find out how deps get used and remove if not needed.
Iterable<? extends TransitiveInfoCollection> deps,
ObjcCppSemantics semantics,
String purpose)
String purpose,
boolean generateModuleMap)
throws RuleErrorException {
CcCompilationHelper result =
new CcCompilationHelper(
Expand Down Expand Up @@ -336,7 +337,7 @@ private CompilationInfo compile(
result.addNonModuleMapHeader(pchHdr);
}

if (getCustomModuleMap(ruleContext).isPresent()) {
if (getCustomModuleMap(ruleContext).isPresent() || !generateModuleMap) {
result.doNotGenerateModuleMap();
}

Expand Down Expand Up @@ -386,7 +387,8 @@ private Pair<CcCompilationOutputs, ImmutableMap<String, NestedSet<Artifact>>> cc
pchHdr,
deps,
semantics,
purpose);
purpose,
/* generateModuleMap= */ true);

purpose = String.format("%s_non_objc_arc", semantics.getPurpose());
extensionBuilder.setArcEnabled(false);
Expand All @@ -404,7 +406,9 @@ private Pair<CcCompilationOutputs, ImmutableMap<String, NestedSet<Artifact>>> cc
pchHdr,
deps,
semantics,
purpose);
purpose,
// Only generate the module map once (see above) and re-use it here.
/* generateModuleMap= */ false);

FeatureConfiguration featureConfiguration =
getFeatureConfiguration(ruleContext, ccToolchain, buildConfiguration, objcProvider);
Expand Down

0 comments on commit 5812b3d

Please sign in to comment.