Skip to content

Commit

Permalink
Remove references to middlemen from the code of C++ rules.
Browse files Browse the repository at this point in the history
The kind of middlemen C++ rules used (scheduling dependency middlemen) stopped existing a long time ago and the demise of middlemen in general is a good time to remove these obsolete references, too.

RELNOTES: None.
PiperOrigin-RevId: 696431863
Change-Id: If47e4f4ebaa5e044b132b431f608b3dfe70ffafa
  • Loading branch information
lberki authored and copybara-github committed Nov 14, 2024
1 parent dfdbe77 commit c0a210d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ public static Builder builder() {

/** Builder class for {@link CcCompilationContext}. */
public static class Builder {
private String purpose;
private final NestedSetBuilder<Artifact> compilationPrerequisites =
NestedSetBuilder.stableOrder();
private final TransitiveSetHelper<PathFragment> includeDirs = new TransitiveSetHelper<>();
Expand All @@ -722,21 +721,6 @@ public static class Builder {
/** Creates a new builder for a {@link CcCompilationContext} instance. */
private Builder() {}

/**
* Overrides the purpose of this context.
*
* @param a string suitable for use as a filename.
*/
@CanIgnoreReturnValue
public Builder setPurpose(String purpose) {
this.purpose = purpose;
return this;
}

public String getPurpose() {
return purpose;
}

/**
* Merges the {@link CcCompilationContext} of a dependency into this one by adding the contents
* of all of its attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public CcCompilationContext getCcCompilationContext() {
private final CcToolchainProvider ccToolchain;
private final FdoContext fdoContext;
private boolean generateModuleMap = true;
private String purpose = "cc_compilation_middleman";
private String purpose = "";
private boolean generateNoPicAction;
private boolean generatePicAction;
private boolean isCodeCoverageEnabled = true;
Expand Down Expand Up @@ -862,8 +862,6 @@ public CompilationInfo compile(RuleContext ruleContext)
(CcCompilationContext) ccCompilationContextObjectsTuple.get(0);
ccCompilationContext = publicCompilationContext;
if (!implementationDeps.isEmpty()) {
// We set a different purpose so that the middleman doesn't clash with the one from propagated
// ccCompilationContext.
Preconditions.checkState(
ccCompilationContextObjectsTuple.get(1) != Starlark.NONE,
"Compilation context for implementation deps was not created");
Expand Down Expand Up @@ -906,9 +904,8 @@ public CcCompilationHelper doNotGenerateModuleMap() {
/**
* Sets the purpose for the {@code CcCompilationContext}.
*
* @see CcCompilationContext.Builder#setPurpose
* @param purpose must be a string which is suitable for use as a filename. A single rule may have
* many middlemen with distinct purposes.
* @param purpose the purpose. Only used to influence the location of the output of Objective-C
* compilation.
*/
@CanIgnoreReturnValue
public CcCompilationHelper setPurpose(String purpose) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ public CcCompilationContext createCcCompilationContext(
Sequence<?> directTextualHdrs,
Sequence<?> directPublicHdrs,
Sequence<?> directPrivateHdrs,
Object purposeNoneable,
Object unused3,
Object moduleMap,
Object unused1,
Object unused2,
Expand Down Expand Up @@ -769,13 +769,6 @@ public CcCompilationContext createCcCompilationContext(
ccCompilationContext.addModularPublicHdrs(modularPublicHdrsList);
ccCompilationContext.addModularPrivateHdrs(modularPrivateHdrsList);

// Private parameters.
if (purposeNoneable != null
&& purposeNoneable != Starlark.UNBOUND
&& purposeNoneable != Starlark.NONE) {
ccCompilationContext.setPurpose((String) purposeNoneable);
}

if (moduleMap != null && moduleMap != Starlark.UNBOUND && moduleMap != Starlark.NONE) {
ccCompilationContext.setCppModuleMap((CppModuleMap) moduleMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ CompilationContextT createCcCompilationContext(
Sequence<?> directTextualHdrs,
Sequence<?> directPublicHdrs,
Sequence<?> directPrivateHdrs,
Object purpose,
Object unused3,
Object moduleMap,
Object unused1,
Object unused2,
Expand Down

0 comments on commit c0a210d

Please sign in to comment.