Skip to content

Commit

Permalink
Get rid of unused j2objc module map
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 387848469
  • Loading branch information
googlewalt authored and Copybara-Service committed Jul 30, 2021
1 parent d7cd7bb commit 92f7b58
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1681,47 +1681,6 @@ private Optional<Artifact> getPchFile() {
return Optional.fromNullable(pchHdr);
}

/**
* Registers an action that will generate a clang module map for this target, using the hdrs
* attribute of this rule.
*/
public CompilationSupport registerGenerateModuleMapAction(
CompilationArtifacts compilationArtifacts) throws RuleErrorException, InterruptedException {
// TODO(bazel-team): Include textual headers in the module map when Xcode 6 support is
// dropped.
// TODO(b/32225593): Include private headers in the module map.
CcCompilationHelper ccCompilationHelper =
new CcCompilationHelper(
ruleContext,
ruleContext,
ruleContext.getLabel(),
CppHelper.getGrepIncludes(ruleContext),
cppSemantics,
getFeatureConfigurationForSwiftModuleMap(
ruleContext, toolchain, buildConfiguration, cppSemantics),
CcCompilationHelper.SourceCategory.CC_AND_OBJC,
toolchain,
toolchain.getFdoContext(),
buildConfiguration,
TargetUtils.getExecutionInfo(
ruleContext.getRule(), ruleContext.isAllowTagsPropagation()),
/* shouldProcessHeaders= */ false);

ImmutableSortedSet<Artifact> publicHeaders =
Stream.concat(
attributes.hdrs().toList().stream(),
compilationArtifacts.getAdditionalHdrs().toList().stream())
.collect(toImmutableSortedSet(naturalOrder()));

CppModuleMap moduleMap = intermediateArtifacts.swiftModuleMap();

ccCompilationHelper.setCppModuleMap(moduleMap).addPublicHeaders(publicHeaders);

ccCompilationHelper.compile(ruleContext);

return this;
}

/** Registers an action to generate an extra clang module map. */
private CompilationSupport generateExtraModuleMap(
CppModuleMap moduleMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@
* linking into the final application bundle. See {@link J2ObjcLibraryBaseRule} for details.
*/
public class J2ObjcLibrary implements RuleConfiguredTargetFactory {
private final CppSemantics cppSemantics;

protected J2ObjcLibrary(CppSemantics cppSemantics) {
this.cppSemantics = cppSemantics;
}
protected J2ObjcLibrary(CppSemantics cppSemantics) {}

public static final String NO_ENTRY_CLASS_ERROR_MSG =
"Entry classes must be specified when flag --compilation_mode=opt is on in order to"
Expand All @@ -62,7 +59,6 @@ private ObjcCommon common(RuleContext ruleContext) throws InterruptedException {
.addDirectCcCompilationContexts(
j2objcCcInfos.stream().map(J2ObjcCcInfo::getCcInfo).collect(toList()))
.setIntermediateArtifacts(ObjcRuleClasses.intermediateArtifacts(ruleContext))
.setHasModuleMap()
.build();
}

Expand All @@ -87,18 +83,6 @@ public ConfiguredTarget create(RuleContext ruleContext)
J2ObjcMappingFileProvider.union(
ruleContext.getPrerequisites("deps", J2ObjcMappingFileProvider.PROVIDER));

CompilationArtifacts moduleMapCompilationArtifacts =
new CompilationArtifacts.Builder()
.setIntermediateArtifacts(ObjcRuleClasses.intermediateArtifacts(ruleContext))
.build();

new CompilationSupport.Builder(ruleContext, cppSemantics)
.setIntermediateArtifacts(ObjcRuleClasses.intermediateArtifacts(ruleContext))
.doNotUsePch()
.build()
.registerGenerateModuleMapAction(moduleMapCompilationArtifacts)
.validateAttributes();

return new RuleConfiguredTargetBuilder(ruleContext)
.setFilesToBuild(NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER))
.add(RunfilesProvider.class, RunfilesProvider.EMPTY)
Expand Down

0 comments on commit 92f7b58

Please sign in to comment.