Remove legacy "fake" branches from cc_binary implementation
Removes the "isFake" part of CcBinary and all associated code. This was
legacy from blaze and can finally be removed.
PiperOrigin-RevId: 319991630
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
index 8c2aaad..46ea2d2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
@@ -187,15 +187,10 @@
RuleContext ruleContext,
FeatureConfiguration featureConfiguration,
CcToolchainProvider toolchain,
- CppConfiguration cppConfiguration,
List<LibraryToLink> libraries,
CcLinkingOutputs ccLibraryLinkingOutputs,
- CcCompilationContext ccCompilationContext,
Link.LinkingMode linkingMode,
NestedSet<Artifact> transitiveArtifacts,
- Iterable<Artifact> fakeLinkerInputs,
- boolean fake,
- ImmutableSet<CppSource> cAndCppSources,
boolean linkCompileOutputSeparately)
throws RuleErrorException {
Runfiles.Builder builder =
@@ -245,33 +240,6 @@
builder.addTarget(malloc, RunfilesProvider.DEFAULT_RUNFILES);
builder.addTarget(malloc, runfilesMapping);
}
-
- if (fake) {
- // Add the object files, libraries, and linker scripts that are used to
- // link this executable.
- builder.addSymlinksToArtifacts(Iterables.filter(fakeLinkerInputs, Artifact.MIDDLEMAN_FILTER));
- // The crosstool inputs for the link action are not sufficient; we also need the crosstool
- // inputs for compilation. Node that these cannot be middlemen because Runfiles does not
- // know how to expand them.
- builder.addTransitiveArtifacts(toolchain.getAllFiles());
- builder.addTransitiveArtifacts(toolchain.getLibcLink(cppConfiguration));
- // Add the sources files that are used to compile the object files.
- // We add the headers in the transitive closure and our own sources in the srcs
- // attribute. We do not provide the auxiliary inputs, because they are only used when we
- // do FDO compilation, and cc_fake_binary does not support FDO.
- ImmutableSet.Builder<Artifact> sourcesBuilder = ImmutableSet.<Artifact>builder();
- for (CppSource cppSource : cAndCppSources) {
- sourcesBuilder.add(cppSource.getSource());
- }
- builder.addSymlinksToArtifacts(sourcesBuilder.build());
- builder.addSymlinksToArtifacts(ccCompilationContext.getDeclaredIncludeSrcs());
- // Add additional files that are referenced from the compile command, like module maps
- // or header modules.
- builder.addSymlinksToArtifacts(ccCompilationContext.getAdditionalInputs());
- builder.addSymlinksToArtifacts(
- ccCompilationContext.getTransitiveModules(
- usePic(ruleContext, toolchain, cppConfiguration, featureConfiguration)));
- }
return builder.build();
}
@@ -279,15 +247,12 @@
public ConfiguredTarget create(RuleContext context)
throws InterruptedException, RuleErrorException, ActionConflictException {
RuleConfiguredTargetBuilder ruleBuilder = new RuleConfiguredTargetBuilder(context);
- CcBinary.init(semantics, ruleBuilder, context, /*fake =*/ false);
+ CcBinary.init(semantics, ruleBuilder, context);
return ruleBuilder.build();
}
public static void init(
- CppSemantics semantics,
- RuleConfiguredTargetBuilder ruleBuilder,
- RuleContext ruleContext,
- boolean fake)
+ CppSemantics semantics, RuleConfiguredTargetBuilder ruleBuilder, RuleContext ruleContext)
throws InterruptedException, RuleErrorException, ActionConflictException {
CcCommon.checkRuleLoadedThroughMacro(ruleContext);
semantics.validateDeps(ruleContext);
@@ -356,9 +321,6 @@
requestedFeaturesBuilder
.addAll(ruleContext.getFeatures())
.add(linkingMode == Link.LinkingMode.DYNAMIC ? DYNAMIC_LINKING_MODE : STATIC_LINKING_MODE);
- if (fake) {
- requestedFeaturesBuilder.add(CppRuleClasses.IS_CC_FAKE_BINARY);
- }
FdoContext fdoContext = common.getFdoContext();
FeatureConfiguration featureConfiguration =
@@ -400,8 +362,7 @@
.addCcCompilationContexts(
ImmutableList.of(CcCompilationHelper.getStlCcCompilationContext(ruleContext)))
.setHeadersCheckingMode(semantics.determineHeadersCheckingMode(ruleContext))
- .setCodeCoverageEnabled(CcCompilationHelper.isCodeCoverageEnabled(ruleContext))
- .setFake(fake);
+ .setCodeCoverageEnabled(CcCompilationHelper.isCodeCoverageEnabled(ruleContext));
CompilationInfo compilationInfo = compilationHelper.compile();
CcCompilationContext ccCompilationContext = compilationInfo.getCcCompilationContext();
CcCompilationOutputs precompiledFileObjects =
@@ -537,7 +498,6 @@
additionalLinkerInputs,
ccLinkingOutputs,
ccCompilationContext,
- fake,
binary,
depsCcLinkingContext,
extraLinkTimeLibrariesNestedSet.build(),
@@ -558,8 +518,6 @@
CcLauncherInfo ccLauncherInfo = ccLinkingOutputsAndCcLinkingInfo.second;
LibraryToLink ccLinkingOutputsBinaryLibrary = ccLinkingOutputsBinary.getLibraryToLink();
- Iterable<Artifact> fakeLinkerInputs =
- fake ? ccLinkingOutputsBinary.getLinkActionInputs() : ImmutableList.<Artifact>of();
ImmutableList.Builder<LibraryToLink> librariesBuilder = ImmutableList.builder();
if (isLinkShared(ruleContext)) {
if (ccLinkingOutputsBinaryLibrary != null) {
@@ -641,15 +599,10 @@
ruleContext,
featureConfiguration,
ccToolchain,
- cppConfiguration,
libraries,
ccLinkingOutputs,
- ccCompilationContext,
linkingMode,
transitiveArtifacts.build(),
- fakeLinkerInputs,
- fake,
- compilationHelper.getCompilationUnitSources(),
linkCompileOutputSeparately);
RunfilesSupport runfilesSupport = RunfilesSupport.withExecutable(ruleContext, runfiles, binary);
@@ -663,8 +616,7 @@
filesToBuild,
ccCompilationOutputs,
ccCompilationContext,
- libraries,
- fake);
+ libraries);
// Support test execution on darwin.
if (ApplePlatform.isApplePlatform(ccToolchain.getTargetCpu())
@@ -728,7 +680,6 @@
List<Artifact> additionalLinkerInputs,
CcLinkingOutputs ccLinkingOutputs,
CcCompilationContext ccCompilationContext,
- boolean fake,
Artifact binary,
CcLinkingContext depsCcLinkingContext,
NestedSet<CcLinkingContext.LinkerInput> extraLinkTimeLibraries,
@@ -864,8 +815,7 @@
&& featureConfiguration.isEnabled(CppRuleClasses.TARGETS_WINDOWS)
&& CppHelper.useInterfaceSharedLibraries(
cppConfiguration, ccToolchain, featureConfiguration))
- .setPdbFile(pdbFile)
- .setFake(fake);
+ .setPdbFile(pdbFile);
ccLinkingHelper.setDefFile(winDefFile);
@@ -1122,8 +1072,7 @@
NestedSet<Artifact> filesToBuild,
CcCompilationOutputs ccCompilationOutputs,
CcCompilationContext ccCompilationContext,
- List<LibraryToLink> libraries,
- boolean fake)
+ List<LibraryToLink> libraries)
throws RuleErrorException {
List<Artifact> instrumentedObjectFiles = new ArrayList<>();
instrumentedObjectFiles.addAll(ccCompilationOutputs.getObjectFiles(false));
@@ -1131,7 +1080,7 @@
InstrumentedFilesInfo instrumentedFilesProvider =
common.getInstrumentedFilesProvider(
instrumentedObjectFiles,
- !TargetUtils.isTestRule(ruleContext.getRule()) && !fake,
+ !TargetUtils.isTestRule(ruleContext.getRule()),
ccCompilationContext.getVirtualToOriginalHeaders());
NestedSet<Artifact> headerTokens =
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java
index 0fb9224..480fc14 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java
@@ -240,7 +240,6 @@
private final List<PathFragment> frameworkIncludeDirs = new ArrayList<>();
private HeadersCheckingMode headersCheckingMode = HeadersCheckingMode.LOOSE;
- private boolean fake;
private final SourceCategory sourceCategory;
private final List<VariablesExtension> variablesExtensions = new ArrayList<>();
@@ -681,17 +680,6 @@
return this;
}
- /**
- * Marks the resulting code as fake, i.e., the code will not actually be compiled or linked, but
- * instead, the compile command is written to a file and added to the runfiles. This is currently
- * used for non-compilation tests. Unfortunately, the design is problematic, so please don't add
- * any further uses.
- */
- public CcCompilationHelper setFake(boolean fake) {
- this.fake = fake;
- return this;
- }
-
/** Whether to generate no-PIC actions. */
public CcCompilationHelper setGenerateNoPicAction(boolean generateNoPicAction) {
this.generateNoPicAction = generateNoPicAction;
@@ -1179,12 +1167,12 @@
/** @return whether this target needs to generate a pic header module. */
private boolean getGeneratesPicHeaderModule() {
- return shouldProvideHeaderModules() && !fake && generatePicAction;
+ return shouldProvideHeaderModules() && generatePicAction;
}
/** @return whether this target needs to generate a no-PIC header module. */
private boolean getGeneratesNoPicHeaderModule() {
- return shouldProvideHeaderModules() && !fake && generateNoPicAction;
+ return shouldProvideHeaderModules() && generateNoPicAction;
}
/** @return whether we want to provide header modules for the current target. */
@@ -1293,8 +1281,8 @@
/**
* Constructs the C++ compiler actions. It generally creates one action for every specified source
- * file. It takes into account fake-ness, coverage, and PIC, in addition to using the settings
- * specified on the current object. This method should only be called once.
+ * file. It takes into account coverage, and PIC, in addition to using the settings specified on
+ * the current object. This method should only be called once.
*/
private CcCompilationOutputs createCcCompileActions() throws RuleErrorException {
CcCompilationOutputs.Builder result = CcCompilationOutputs.builder();
@@ -1595,7 +1583,6 @@
/* thinLtoInputBitcodeFile= */ null,
/* thinLtoOutputObjectFile= */ null,
getCopts(builder.getSourceFile(), sourceLabel),
- toPathString(builder.getTempOutputFile()),
dotdFileExecPath,
usePic,
additionalBuildVariables);
@@ -1606,10 +1593,6 @@
return a == null ? null : a.getExecPathString();
}
- private static String toPathString(PathFragment a) {
- return a == null ? null : a.getSafePathString();
- }
-
/**
* Returns a {@code CppCompileActionBuilder} with the common fields for a C++ compile action being
* initialized.
@@ -1629,11 +1612,6 @@
private void createModuleCodegenAction(
CcCompilationOutputs.Builder result, Label sourceLabel, Artifact module)
throws RuleErrorException {
- if (fake) {
- // We can't currently foresee a situation where we'd want nocompile tests for module codegen.
- // If we find one, support needs to be added here.
- return;
- }
String outputName = module.getRootRelativePath().getBaseName();
// TODO(djasper): Make this less hacky after refactoring how the PIC/noPIC actions are created.
@@ -1784,158 +1762,144 @@
throws RuleErrorException {
ImmutableList.Builder<Artifact> directOutputs = new ImmutableList.Builder<>();
PathFragment ccRelativeName = sourceArtifact.getRootRelativePath();
- if (fake) {
- boolean usePic = !generateNoPicAction;
- createFakeSourceAction(
- sourceLabel,
- outputName,
- result,
- builder,
- outputCategory,
- addObject,
- ccRelativeName,
- usePic,
- generateDotd);
- } else {
- // Create PIC compile actions (same as no-PIC, but use -fPIC and
- // generate .pic.o, .pic.d, .pic.gcno instead of .o, .d, .gcno.)
- if (generatePicAction) {
- String picOutputBase =
- CppHelper.getArtifactNameForCategory(
- ruleErrorConsumer, ccToolchain, ArtifactCategory.PIC_FILE, outputName);
- CppCompileActionBuilder picBuilder =
- copyAsPicBuilder(builder, picOutputBase, outputCategory, generateDotd);
- String gcnoFileName =
- CppHelper.getArtifactNameForCategory(
- ruleErrorConsumer, ccToolchain, ArtifactCategory.COVERAGE_DATA_FILE, picOutputBase);
- Artifact gcnoFile =
- enableCoverage
- ? CppHelper.getCompileOutputArtifact(
- actionConstructionContext, label, gcnoFileName, configuration)
- : null;
- Artifact dwoFile =
- generateDwo && !bitcodeOutput ? getDwoFile(picBuilder.getOutputFile()) : null;
- Artifact ltoIndexingFile =
- bitcodeOutput ? getLtoIndexingFile(picBuilder.getOutputFile()) : null;
- picBuilder.setVariables(
- setupCompileBuildVariables(
- picBuilder,
- sourceLabel,
- /* usePic= */ true,
- /* needsFdoBuildVariables= */ ccRelativeName != null,
- ccCompilationContext.getCppModuleMap(),
- gcnoFile,
- generateDwo,
- dwoFile,
- ltoIndexingFile,
- /* additionalBuildVariables= */ ImmutableMap.of()));
+ // Create PIC compile actions (same as no-PIC, but use -fPIC and
+ // generate .pic.o, .pic.d, .pic.gcno instead of .o, .d, .gcno.)
+ if (generatePicAction) {
+ String picOutputBase =
+ CppHelper.getArtifactNameForCategory(
+ ruleErrorConsumer, ccToolchain, ArtifactCategory.PIC_FILE, outputName);
+ CppCompileActionBuilder picBuilder =
+ copyAsPicBuilder(builder, picOutputBase, outputCategory, generateDotd);
+ String gcnoFileName =
+ CppHelper.getArtifactNameForCategory(
+ ruleErrorConsumer, ccToolchain, ArtifactCategory.COVERAGE_DATA_FILE, picOutputBase);
+ Artifact gcnoFile =
+ enableCoverage
+ ? CppHelper.getCompileOutputArtifact(
+ actionConstructionContext, label, gcnoFileName, configuration)
+ : null;
+ Artifact dwoFile =
+ generateDwo && !bitcodeOutput ? getDwoFile(picBuilder.getOutputFile()) : null;
+ Artifact ltoIndexingFile =
+ bitcodeOutput ? getLtoIndexingFile(picBuilder.getOutputFile()) : null;
- result.addTemps(
- createTempsActions(
- sourceArtifact,
- sourceLabel,
- outputName,
- picBuilder,
- /* usePic= */ true,
- /* generateDotd= */ generateDotd,
- ccRelativeName));
+ picBuilder.setVariables(
+ setupCompileBuildVariables(
+ picBuilder,
+ sourceLabel,
+ /* usePic= */ true,
+ /* needsFdoBuildVariables= */ ccRelativeName != null,
+ ccCompilationContext.getCppModuleMap(),
+ gcnoFile,
+ generateDwo,
+ dwoFile,
+ ltoIndexingFile,
+ /* additionalBuildVariables= */ ImmutableMap.of()));
- picBuilder.setGcnoFile(gcnoFile);
- picBuilder.setDwoFile(dwoFile);
- picBuilder.setLtoIndexingFile(ltoIndexingFile);
+ result.addTemps(
+ createTempsActions(
+ sourceArtifact,
+ sourceLabel,
+ outputName,
+ picBuilder,
+ /* usePic= */ true,
+ /* generateDotd= */ generateDotd,
+ ccRelativeName));
- semantics.finalizeCompileActionBuilder(configuration, featureConfiguration, picBuilder);
- CppCompileAction picAction = picBuilder.buildOrThrowRuleError(ruleErrorConsumer);
- actionRegistry.registerAction(picAction);
- directOutputs.add(picAction.getOutputFile());
- if (addObject) {
- result.addPicObjectFile(picAction.getOutputFile());
+ picBuilder.setGcnoFile(gcnoFile);
+ picBuilder.setDwoFile(dwoFile);
+ picBuilder.setLtoIndexingFile(ltoIndexingFile);
- if (bitcodeOutput) {
- result.addLtoBitcodeFile(
- picAction.getOutputFile(), ltoIndexingFile, getCopts(sourceArtifact, sourceLabel));
- }
- }
- if (dwoFile != null) {
- // Host targets don't produce .dwo files.
- result.addPicDwoFile(dwoFile);
+ semantics.finalizeCompileActionBuilder(configuration, featureConfiguration, picBuilder);
+ CppCompileAction picAction = picBuilder.buildOrThrowRuleError(ruleErrorConsumer);
+ actionRegistry.registerAction(picAction);
+ directOutputs.add(picAction.getOutputFile());
+ if (addObject) {
+ result.addPicObjectFile(picAction.getOutputFile());
+
+ if (bitcodeOutput) {
+ result.addLtoBitcodeFile(
+ picAction.getOutputFile(), ltoIndexingFile, getCopts(sourceArtifact, sourceLabel));
}
}
+ if (dwoFile != null) {
+ // Host targets don't produce .dwo files.
+ result.addPicDwoFile(dwoFile);
+ }
+ }
- if (generateNoPicAction) {
- Artifact noPicOutputFile =
- CppHelper.getCompileOutputArtifact(
- actionConstructionContext,
- label,
- CppHelper.getArtifactNameForCategory(
- ruleErrorConsumer, ccToolchain, outputCategory, outputName),
- configuration);
- builder.setOutputs(
- actionConstructionContext,
- ruleErrorConsumer,
- label,
- outputCategory,
- outputName,
- generateDotd);
- String gcnoFileName =
- CppHelper.getArtifactNameForCategory(
- ruleErrorConsumer, ccToolchain, ArtifactCategory.COVERAGE_DATA_FILE, outputName);
+ if (generateNoPicAction) {
+ Artifact noPicOutputFile =
+ CppHelper.getCompileOutputArtifact(
+ actionConstructionContext,
+ label,
+ CppHelper.getArtifactNameForCategory(
+ ruleErrorConsumer, ccToolchain, outputCategory, outputName),
+ configuration);
+ builder.setOutputs(
+ actionConstructionContext,
+ ruleErrorConsumer,
+ label,
+ outputCategory,
+ outputName,
+ generateDotd);
+ String gcnoFileName =
+ CppHelper.getArtifactNameForCategory(
+ ruleErrorConsumer, ccToolchain, ArtifactCategory.COVERAGE_DATA_FILE, outputName);
- // Create no-PIC compile actions
- Artifact gcnoFile =
- enableCoverage
- ? CppHelper.getCompileOutputArtifact(
- actionConstructionContext, label, gcnoFileName, configuration)
- : null;
+ // Create no-PIC compile actions
+ Artifact gcnoFile =
+ enableCoverage
+ ? CppHelper.getCompileOutputArtifact(
+ actionConstructionContext, label, gcnoFileName, configuration)
+ : null;
- Artifact noPicDwoFile = generateDwo && !bitcodeOutput ? getDwoFile(noPicOutputFile) : null;
- Artifact ltoIndexingFile =
- bitcodeOutput ? getLtoIndexingFile(builder.getOutputFile()) : null;
+ Artifact noPicDwoFile = generateDwo && !bitcodeOutput ? getDwoFile(noPicOutputFile) : null;
+ Artifact ltoIndexingFile = bitcodeOutput ? getLtoIndexingFile(builder.getOutputFile()) : null;
- builder.setVariables(
- setupCompileBuildVariables(
- builder,
- sourceLabel,
- /* usePic= */ false,
- /* needsFdoBuildVariables= */ ccRelativeName != null,
- cppModuleMap,
- gcnoFile,
- generateDwo,
- noPicDwoFile,
- ltoIndexingFile,
- /* additionalBuildVariables= */ ImmutableMap.of()));
+ builder.setVariables(
+ setupCompileBuildVariables(
+ builder,
+ sourceLabel,
+ /* usePic= */ false,
+ /* needsFdoBuildVariables= */ ccRelativeName != null,
+ cppModuleMap,
+ gcnoFile,
+ generateDwo,
+ noPicDwoFile,
+ ltoIndexingFile,
+ /* additionalBuildVariables= */ ImmutableMap.of()));
- result.addTemps(
- createTempsActions(
- sourceArtifact,
- sourceLabel,
- outputName,
- builder,
- /* usePic= */ false,
- generateDotd,
- ccRelativeName));
+ result.addTemps(
+ createTempsActions(
+ sourceArtifact,
+ sourceLabel,
+ outputName,
+ builder,
+ /* usePic= */ false,
+ generateDotd,
+ ccRelativeName));
- builder.setGcnoFile(gcnoFile);
- builder.setDwoFile(noPicDwoFile);
- builder.setLtoIndexingFile(ltoIndexingFile);
+ builder.setGcnoFile(gcnoFile);
+ builder.setDwoFile(noPicDwoFile);
+ builder.setLtoIndexingFile(ltoIndexingFile);
- semantics.finalizeCompileActionBuilder(configuration, featureConfiguration, builder);
- CppCompileAction compileAction = builder.buildOrThrowRuleError(ruleErrorConsumer);
- actionRegistry.registerAction(compileAction);
- Artifact objectFile = compileAction.getOutputFile();
- directOutputs.add(objectFile);
- if (addObject) {
- result.addObjectFile(objectFile);
- if (bitcodeOutput) {
- result.addLtoBitcodeFile(
- objectFile, ltoIndexingFile, getCopts(sourceArtifact, sourceLabel));
- }
+ semantics.finalizeCompileActionBuilder(configuration, featureConfiguration, builder);
+ CppCompileAction compileAction = builder.buildOrThrowRuleError(ruleErrorConsumer);
+ actionRegistry.registerAction(compileAction);
+ Artifact objectFile = compileAction.getOutputFile();
+ directOutputs.add(objectFile);
+ if (addObject) {
+ result.addObjectFile(objectFile);
+ if (bitcodeOutput) {
+ result.addLtoBitcodeFile(
+ objectFile, ltoIndexingFile, getCopts(sourceArtifact, sourceLabel));
}
- if (noPicDwoFile != null) {
- // Host targets don't produce .dwo files.
- result.addDwoFile(noPicDwoFile);
- }
+ }
+ if (noPicDwoFile != null) {
+ // Host targets don't produce .dwo files.
+ result.addDwoFile(noPicDwoFile);
}
}
return directOutputs.build();
@@ -1972,64 +1936,6 @@
: base;
}
- private void createFakeSourceAction(
- Label sourceLabel,
- String outputName,
- CcCompilationOutputs.Builder result,
- CppCompileActionBuilder builder,
- ArtifactCategory outputCategory,
- boolean addObject,
- PathFragment ccRelativeName,
- boolean usePic,
- boolean generateDotd)
- throws RuleErrorException {
- String outputNameBase = getOutputNameBaseWith(outputName, usePic);
- String tempOutputName =
- configuration
- .getBinFragment()
- .getRelative(CppHelper.getObjDirectory(label))
- .getRelative(
- CppHelper.getArtifactNameForCategory(
- ruleErrorConsumer,
- ccToolchain,
- outputCategory,
- getOutputNameBaseWith(outputName + ".temp", usePic)))
- .getPathString();
- builder
- .setPicMode(usePic)
- .setOutputs(
- actionConstructionContext,
- ruleErrorConsumer,
- label,
- outputCategory,
- outputNameBase,
- generateDotd)
- .setTempOutputFile(PathFragment.create(tempOutputName));
-
- builder.setVariables(
- setupCompileBuildVariables(
- builder,
- sourceLabel,
- usePic,
- /* needsFdoBuildVariables= */ ccRelativeName != null,
- ccCompilationContext.getCppModuleMap(),
- /* gcnoFile= */ null,
- /* isUsingFission= */ false,
- /* dwoFile= */ null,
- /* ltoIndexingFile= */ null,
- /* additionalBuildVariables= */ ImmutableMap.of()));
- semantics.finalizeCompileActionBuilder(configuration, featureConfiguration, builder);
- CppCompileAction action = builder.buildOrThrowRuleError(ruleErrorConsumer);
- actionRegistry.registerAction(action);
- if (addObject) {
- if (usePic) {
- result.addPicObjectFile(action.getOutputFile());
- } else {
- result.addObjectFile(action.getOutputFile());
- }
- }
- }
-
/** Returns true iff code coverage is enabled for the given target. */
public static boolean isCodeCoverageEnabled(RuleContext ruleContext) {
BuildConfiguration configuration = ruleContext.getConfiguration();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java
index a742ef3..c6cd054 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java
@@ -107,7 +107,6 @@
private Artifact pdbFile;
private Artifact defFile;
private LinkingMode linkingMode = LinkingMode.DYNAMIC;
- private boolean fake;
private boolean nativeDeps;
private boolean wholeArchive;
private LinkArtifactFactory linkArtifactFactory = CppLinkAction.DEFAULT_ARTIFACT_FACTORY;
@@ -516,11 +515,6 @@
return this;
}
- public CcLinkingHelper setFake(boolean fake) {
- this.fake = fake;
- return this;
- }
-
public CcLinkingHelper setPdbFile(Artifact pdbFile) {
this.pdbFile = pdbFile;
return this;
@@ -688,18 +682,13 @@
.addNonCodeInputs(ccOutputs.getHeaderTokenFiles())
.addLtoCompilationContext(ccOutputs.getLtoCompilationContext())
.setLinkingMode(linkingMode)
- .setFake(fake)
.addActionInputs(linkActionInputs)
.addLinkopts(linkopts)
.addLinkopts(sonameLinkopts)
.addNonCodeInputs(nonCodeLinkerInputs)
.addVariablesExtensions(variablesExtensions);
- if (fake) {
- dynamicLinkActionBuilder.addFakeObjectFiles(ccOutputs.getObjectFiles(usePic));
- } else {
- dynamicLinkActionBuilder.addObjectFiles(ccOutputs.getObjectFiles(usePic));
- }
+ dynamicLinkActionBuilder.addObjectFiles(ccOutputs.getObjectFiles(usePic));
if (!dynamicLinkType.isExecutable()) {
dynamicLinkActionBuilder.setLibraryIdentifier(mainLibraryIdentifier);
@@ -780,9 +769,6 @@
if (dynamicLinkType.isExecutable()) {
ccLinkingOutputs.setExecutable(linkerOutput);
}
- if (fake) {
- ccLinkingOutputs.addLinkActionInputs(dynamicLinkAction.getInputs());
- }
actionConstructionContext.registerAction(dynamicLinkAction);
LinkerInputs.LibraryToLink dynamicLibrary = dynamicLinkAction.getOutputLibrary();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java
index 1f5489d..06d54b6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java
@@ -266,7 +266,6 @@
userFlagsToIterable(userCompileFlags),
/* cppModuleMap= */ null,
usePic,
- /* fakeOutputFile= */ null,
/* fdoStamp= */ null,
/* dotdFileExecPath= */ null,
/* variablesExtensions= */ ImmutableList.of(),
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcTest.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcTest.java
index f38b6a3..aca19bf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcTest.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcTest.java
@@ -35,7 +35,7 @@
public ConfiguredTarget create(RuleContext context)
throws InterruptedException, RuleErrorException, ActionConflictException {
RuleConfiguredTargetBuilder ruleBuilder = new RuleConfiguredTargetBuilder(context);
- CcBinary.init(semantics, ruleBuilder, context, /*fake =*/ false);
+ CcBinary.init(semantics, ruleBuilder, context);
return ruleBuilder.build();
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariables.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariables.java
index 418dce6..336b63d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariables.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariables.java
@@ -140,7 +140,6 @@
Iterable<String> userCompileFlags,
CppModuleMap cppModuleMap,
boolean usePic,
- PathFragment fakeOutputFile,
String fdoStamp,
String dotdFileExecPath,
ImmutableList<VariablesExtension> variablesExtensions,
@@ -174,7 +173,6 @@
userCompileFlags,
cppModuleMap,
usePic,
- toPathString(fakeOutputFile),
fdoStamp,
dotdFileExecPath,
variablesExtensions,
@@ -210,7 +208,6 @@
Iterable<String> userCompileFlags,
CppModuleMap cppModuleMap,
boolean usePic,
- String fakeOutputFile,
String fdoStamp,
String dotdFileExecPath,
ImmutableList<VariablesExtension> variablesExtensions,
@@ -244,7 +241,6 @@
userCompileFlags,
cppModuleMap,
usePic,
- fakeOutputFile,
fdoStamp,
dotdFileExecPath,
variablesExtensions,
@@ -274,7 +270,6 @@
Iterable<String> userCompileFlags,
CppModuleMap cppModuleMap,
boolean usePic,
- String fakeOutputFile,
String fdoStamp,
String dotdFileExecPath,
ImmutableList<VariablesExtension> variablesExtensions,
@@ -314,7 +309,6 @@
thinLtoInputBitcodeFile,
thinLtoOutputObjectFile,
userCompileFlags,
- fakeOutputFile,
dotdFileExecPath,
usePic,
ImmutableMap.of());
@@ -333,7 +327,6 @@
String thinLtoInputBitcodeFile,
String thinLtoOutputObjectFile,
Iterable<String> userCompileFlags,
- String fakeOutputFile,
String dotdFileExecPath,
boolean usePic,
Map<String, String> additionalBuildVariables) {
@@ -344,11 +337,8 @@
buildVariables.addStringVariable(SOURCE_FILE.getVariableName(), sourceFile);
}
- String fakeOutputFileOrRealOutputFile = fakeOutputFile != null ? fakeOutputFile : outputFile;
-
if (outputFile != null) {
- buildVariables.addStringVariable(
- OUTPUT_FILE.getVariableName(), fakeOutputFileOrRealOutputFile);
+ buildVariables.addStringVariable(OUTPUT_FILE.getVariableName(), outputFile);
}
// Set dependency_file to enable <object>.d file generation.
@@ -513,10 +503,6 @@
Iterables.transform(ImmutableSet.copyOf(paths), PathFragment::getSafePathString));
}
- private static String toPathString(PathFragment a) {
- return a == null ? null : a.getSafePathString();
- }
-
public String getVariableName() {
return variableName;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
index dff6f02..60609d9 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
@@ -214,8 +214,7 @@
* succeed, can be empty but not null, for example, extra sources for FDO.
* @param inputsForInvalidation are there only to invalidate this action when they change, but are
* not needed during actual execution.
- * @param outputFile the object file that is written as result of the compilation, or the fake
- * object for {@link FakeCppCompileAction}s
+ * @param outputFile the object file that is written as result of the compilation
* @param dotdFile the .d file that is generated as a side-effect of compilation
* @param gcnoFile the coverage notes that are written in coverage mode, can be null
* @param dwoFile the .dwo output file where debug information is stored for Fission builds (null
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
index 230789e..b1dbaae 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
@@ -57,7 +57,6 @@
private Artifact outputFile;
private Artifact dwoFile;
private Artifact ltoIndexingFile;
- @Nullable private PathFragment tempOutputFile;
private Artifact dotdFile;
private Artifact gcnoFile;
private CcCompilationContext ccCompilationContext = CcCompilationContext.EMPTY;
@@ -117,7 +116,6 @@
this.outputFile = other.outputFile;
this.dwoFile = other.dwoFile;
this.ltoIndexingFile = other.ltoIndexingFile;
- this.tempOutputFile = other.tempOutputFile;
this.dotdFile = other.dotdFile;
this.gcnoFile = other.gcnoFile;
this.ccCompilationContext = other.ccCompilationContext;
@@ -139,11 +137,6 @@
this.builtinIncludeDirectories = other.builtinIncludeDirectories;
}
- @Nullable
- public PathFragment getTempOutputFile() {
- return tempOutputFile;
- }
-
public CppCompileActionBuilder setSourceFile(Artifact sourceFile) {
this.sourceFile = sourceFile;
return this;
@@ -273,67 +266,38 @@
// Copying the collections is needed to make the builder reusable.
CppCompileAction action;
- boolean fake = tempOutputFile != null;
- if (fake) {
- action =
- new FakeCppCompileAction(
- owner,
- featureConfiguration,
- variables,
- sourceFile,
- cppConfiguration,
- shareable,
- shouldScanIncludes,
- shouldPruneModules(),
- usePic,
- useHeaderModules,
- realMandatoryInputs,
- buildInputsForInvalidation(),
- getBuiltinIncludeFiles(),
- prunableHeaders,
- outputFile,
- tempOutputFile,
- dotdFile,
- env,
- ccCompilationContext,
- coptsFilter,
- cppSemantics,
- builtinIncludeDirectories,
- ImmutableMap.copyOf(executionInfo),
- grepIncludes);
- } else {
- action =
- new CppCompileAction(
- owner,
- featureConfiguration,
- variables,
- sourceFile,
- cppConfiguration,
- shareable,
- shouldScanIncludes,
- shouldPruneModules(),
- usePic,
- useHeaderModules,
- realMandatoryInputs,
- buildInputsForInvalidation(),
- getBuiltinIncludeFiles(),
- prunableHeaders,
- outputFile,
- dotdFile,
- gcnoFile,
- dwoFile,
- ltoIndexingFile,
- env,
- ccCompilationContext,
- coptsFilter,
- ImmutableList.copyOf(additionalIncludeScanningRoots),
- actionClassId,
- ImmutableMap.copyOf(executionInfo),
- getActionName(),
- cppSemantics,
- builtinIncludeDirectories,
- grepIncludes);
- }
+
+ action =
+ new CppCompileAction(
+ owner,
+ featureConfiguration,
+ variables,
+ sourceFile,
+ cppConfiguration,
+ shareable,
+ shouldScanIncludes,
+ shouldPruneModules(),
+ usePic,
+ useHeaderModules,
+ realMandatoryInputs,
+ buildInputsForInvalidation(),
+ getBuiltinIncludeFiles(),
+ prunableHeaders,
+ outputFile,
+ dotdFile,
+ gcnoFile,
+ dwoFile,
+ ltoIndexingFile,
+ env,
+ ccCompilationContext,
+ coptsFilter,
+ ImmutableList.copyOf(additionalIncludeScanningRoots),
+ actionClassId,
+ ImmutableMap.copyOf(executionInfo),
+ getActionName(),
+ cppSemantics,
+ builtinIncludeDirectories,
+ grepIncludes);
return action;
}
@@ -512,20 +476,6 @@
return outputFile;
}
- /**
- * The temp output file is not an artifact, since it does not appear in the outputs of the
- * action.
- *
- * <p>This is theoretically a problem if that file already existed before, since then Blaze
- * does not delete it before executing the rule, but 1. that only applies for local
- * execution which does not happen very often and 2. it is only a problem if the compiler is
- * affected by the presence of this file, which it should not be.
- */
- public CppCompileActionBuilder setTempOutputFile(PathFragment tempOutputFile) {
- this.tempOutputFile = tempOutputFile;
- return this;
- }
-
public Artifact getDotdFile() {
return this.dotdFile;
}
@@ -593,11 +543,7 @@
}
public PathFragment getRealOutputFilePath() {
- if (getTempOutputFile() != null) {
- return getTempOutputFile();
- } else {
- return getOutputFile().getExecPath();
- }
+ return getOutputFile().getExecPath();
}
/**
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
index 4980dac..87dd6d6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
@@ -14,10 +14,8 @@
package com.google.devtools.build.lib.rules.cpp;
-import static java.nio.charset.StandardCharsets.ISO_8859_1;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -51,7 +49,6 @@
import com.google.devtools.build.lib.analysis.starlark.Args;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.RepositoryName;
-import com.google.devtools.build.lib.collect.CollectionUtils;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadCompatible;
import com.google.devtools.build.lib.exec.SpawnStrategyResolver;
@@ -70,10 +67,7 @@
import com.google.devtools.build.lib.util.DetailedExitCode;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.util.ShellEscaper;
-import com.google.devtools.build.lib.vfs.FileSystemUtils;
-import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
-import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -119,7 +113,6 @@
};
private static final String LINK_GUID = "58ec78bd-1176-4e36-8143-439f656b181d";
- private static final String FAKE_LINK_GUID = "da36f819-5a15-43a9-8a45-e01b60e10c8b";
@Nullable private final String mnemonic;
private final LibraryToLink outputLibrary;
@@ -131,10 +124,6 @@
private final LinkCommandLine linkCommandLine;
- /** True for cc_fake_binary targets. */
- private final boolean fake;
-
- private final Iterable<Artifact> fakeLinkerInputArtifacts;
private final boolean isLtoIndexing;
private final PathFragment ldExecutable;
@@ -171,8 +160,6 @@
LibraryToLink outputLibrary,
Artifact linkOutput,
LibraryToLink interfaceOutputLibrary,
- boolean fake,
- Iterable<Artifact> fakeLinkerInputArtifacts,
boolean isLtoIndexing,
ImmutableMap<Linkstamp, Artifact> linkstamps,
LinkCommandLine linkCommandLine,
@@ -187,8 +174,6 @@
this.outputLibrary = outputLibrary;
this.linkOutput = linkOutput;
this.interfaceOutputLibrary = interfaceOutputLibrary;
- this.fake = fake;
- this.fakeLinkerInputArtifacts = CollectionUtils.makeImmutable(fakeLinkerInputArtifacts);
this.isLtoIndexing = isLtoIndexing;
this.linkstamps = linkstamps;
this.linkCommandLine = linkCommandLine;
@@ -257,11 +242,6 @@
return interfaceOutputLibrary;
}
- /** Returns the path to the output artifact produced by the linker. */
- private Path getOutputFile(ActionExecutionContext actionExecutionContext) {
- return actionExecutionContext.getInputPath(linkOutput);
- }
-
@Override
public ImmutableMap<String, String> getExecutionInfo() {
return executionRequirements;
@@ -321,10 +301,6 @@
@ThreadCompatible
public ActionContinuationOrResult beginExecution(ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
- if (fake) {
- executeFake(actionExecutionContext);
- return ActionContinuationOrResult.of(ActionResult.EMPTY);
- }
Spawn spawn = createSpawn(actionExecutionContext);
SpawnContinuation spawnContinuation =
actionExecutionContext
@@ -354,92 +330,6 @@
}
}
- // Don't forget to update FAKE_LINK_GUID if you modify this method.
- @ThreadCompatible
- private void executeFake(ActionExecutionContext actionExecutionContext)
- throws ActionExecutionException {
- try {
- // Prefix all fake output files in the command line with $TEST_TMPDIR/.
- final String outputPrefix = "$TEST_TMPDIR/";
- List<String> escapedLinkArgv =
- escapeLinkArgv(
- linkCommandLine.getRawLinkArgv(actionExecutionContext.getArtifactExpander()),
- outputPrefix);
- // Write the commands needed to build the real target to the fake target
- // file.
- StringBuilder s = new StringBuilder();
- Joiner.on('\n')
- .appendTo(
- s,
- "# This is a fake target file, automatically generated.",
- "# Do not edit by hand!",
- "echo $0 is a fake target file and not meant to be executed.",
- "exit 0",
- "EOS",
- "",
- "makefile_dir=.",
- "");
-
- // Concatenate all the (fake) .o files into the result.
- for (Artifact objectFile : fakeLinkerInputArtifacts) {
- if (CppFileTypes.OBJECT_FILE.matches(objectFile.getFilename())
- || CppFileTypes.PIC_OBJECT_FILE.matches(objectFile.getFilename())) {
- s.append(
- FileSystemUtils.readContentAsLatin1(
- actionExecutionContext.getInputPath(objectFile))); // (IOException)
- }
- }
- Path outputFile = getOutputFile(actionExecutionContext);
-
- s.append(outputFile.getBaseName()).append(": ");
- Joiner.on(' ').appendTo(s, escapedLinkArgv);
- s.append('\n');
- if (outputFile.exists()) {
- outputFile.setWritable(true); // (IOException)
- }
- FileSystemUtils.writeContent(outputFile, ISO_8859_1, s.toString());
- outputFile.setExecutable(true); // (IOException)
- for (Artifact output : getOutputs()) {
- // Make ThinLTO link actions (that also have ThinLTO-specific outputs) kind of work; It does
- // not actually work because this makes cc_fake_binary see the indexing action and not the
- // actual linking action, but it's good enough for now.
- FileSystemUtils.touchFile(actionExecutionContext.getInputPath(output));
- }
- } catch (IOException | CommandLineExpansionException e) {
- String message =
- String.format(
- "failed to create fake link command for rule '%s: %s",
- getOwner().getLabel(), e.getMessage());
- DetailedExitCode code = createDetailedExitCode(message, Code.FAKE_COMMAND_GENERATION_FAILURE);
- throw new ActionExecutionException(message, this, false, code);
- }
- }
-
- /**
- * Shell-escapes the raw link command line.
- *
- * @param rawLinkArgv raw link command line
- * @param outputPrefix to be prepended to any outputs
- * @return escaped link command line
- */
- private List<String> escapeLinkArgv(List<String> rawLinkArgv, String outputPrefix) {
- ImmutableList.Builder<String> escapedArgs = ImmutableList.builder();
- for (String rawArg : rawLinkArgv) {
- String escapedArg;
- if (rawArg.equals(getPrimaryOutput().getExecPathString())) {
- escapedArg = outputPrefix + ShellEscaper.escapeString(rawArg);
- } else if (rawArg.startsWith(Link.FAKE_OBJECT_PREFIX)) {
- escapedArg =
- outputPrefix
- + ShellEscaper.escapeString(rawArg.substring(Link.FAKE_OBJECT_PREFIX.length()));
- } else {
- escapedArg = ShellEscaper.escapeString(rawArg);
- }
- escapedArgs.add(escapedArg);
- }
- return escapedArgs.build();
- }
-
@Override
public ExtraActionInfo.Builder getExtraActionInfo(ActionKeyContext actionKeyContext)
throws CommandLineExpansionException {
@@ -474,7 +364,7 @@
@Override
protected void computeKey(ActionKeyContext actionKeyContext, Fingerprint fp)
throws CommandLineExpansionException {
- fp.addString(fake ? FAKE_LINK_GUID : LINK_GUID);
+ fp.addString(LINK_GUID);
fp.addString(ldExecutable.getPathString());
fp.addStrings(linkCommandLine.arguments());
fp.addStringMap(toolchainEnv);
@@ -482,8 +372,9 @@
// TODO(bazel-team): For correctness, we need to ensure the invariant that all values accessed
// during the execution phase are also covered by the key. Above, we add the argv to the key,
- // which covers most cases. Unfortunately, the extra action and fake support methods above also
- // sometimes directly access settings from the link configuration that may or may not affect the
+ // which covers most cases. Unfortunately, the extra action method above also
+ // sometimes directly accesses settings from the link configuration that may or may not affect
+ // the
// key. We either need to change the code to cover them in the key computation, or change the
// LinkConfiguration to disallow the combinations where the value of a setting does not affect
// the argv.
@@ -498,9 +389,6 @@
@Override
public String describeKey() {
StringBuilder message = new StringBuilder();
- if (fake) {
- message.append("Fake ");
- }
message.append(getProgressMessage());
message.append('\n');
message.append(" Command: ");
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java
index dd58e2a..4bfd026 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java
@@ -122,7 +122,6 @@
private LtoCompilationContext ltoCompilationContext;
private Artifact defFile;
- private boolean fake;
private boolean isNativeDeps;
private boolean useTestOnlyFlags;
private boolean wholeArchive;
@@ -235,11 +234,6 @@
return this.linkingMode;
}
- /** Returns true for a cc_fake_binary. */
- public boolean isFake() {
- return this.fake;
- }
-
public CppLinkActionBuilder setLinkArtifactFactory(LinkArtifactFactory linkArtifactFactory) {
this.linkArtifactFactory = linkArtifactFactory;
return this;
@@ -519,10 +513,6 @@
@VisibleForTesting
boolean canSplitCommandLine() {
- if (fake) {
- return false;
- }
-
if (toolchain == null || !toolchain.supportsParamFiles()) {
return false;
}
@@ -618,9 +608,9 @@
output,
linkArtifactFactory);
- if (interfaceOutput != null && (fake || !linkType.isDynamicLibrary())) {
+ if (interfaceOutput != null && !linkType.isDynamicLibrary()) {
throw new RuntimeException(
- "Interface output can only be used " + "with non-fake DYNAMIC_LIBRARY targets");
+ "Interface output can only be used " + "with DYNAMIC_LIBRARY targets");
}
if (!featureConfiguration.actionIsConfigured(linkType.getActionName())) {
@@ -1063,12 +1053,6 @@
inputsBuilder.addTransitive(linkstampObjectArtifacts);
- ImmutableSet<Artifact> fakeLinkerInputArtifacts =
- collectedLibrariesToLink.getExpandedLinkerInputs().toList().stream()
- .filter(LinkerInput::isFake)
- .map(LinkerInput::getArtifact)
- .collect(ImmutableSet.toImmutableSet());
-
return new CppLinkAction(
getOwner(),
mnemonic,
@@ -1077,8 +1061,6 @@
outputLibrary,
output,
interfaceOutputLibrary,
- fake,
- fakeLinkerInputArtifacts,
isLtoIndexing,
linkstampMap,
linkCommandLine,
@@ -1269,7 +1251,7 @@
/**
* Sets the interface output of the link. A non-null argument can only be provided if the link
- * type is {@code NODEPS_DYNAMIC_LIBRARY} and fake is false.
+ * type is {@code NODEPS_DYNAMIC_LIBRARY}.
*/
public CppLinkActionBuilder setInterfaceOutput(Artifact interfaceOutput) {
this.interfaceOutput = interfaceOutput;
@@ -1344,13 +1326,6 @@
return this;
}
- public CppLinkActionBuilder addFakeObjectFiles(Iterable<Artifact> inputs) {
- for (Artifact input : inputs) {
- addObjectFile(LinkerInputs.fakeLinkerInput(input));
- }
- return this;
- }
-
private void checkLibrary(LinkerInputs.LibraryToLink input) {
String name = input.getArtifact().getFilename();
Preconditions.checkArgument(
@@ -1483,12 +1458,6 @@
return this;
}
- /** Sets whether this link action will be used for a cc_fake_binary; false by default. */
- public CppLinkActionBuilder setFake(boolean fake) {
- this.fake = fake;
- return this;
- }
-
/** Sets whether this link action is used for a native dependency library. */
public CppLinkActionBuilder setNativeDeps(boolean isNativeDeps) {
this.isNativeDeps = isNativeDeps;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java
index eab64d8..2285252 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java
@@ -172,7 +172,6 @@
CcCompilationHelper.getCoptsFromOptions(cppConfiguration, sourceFile.getExecPathString()),
/* cppModuleMap= */ null,
needsPic,
- /* fakeOutputFile= */ null,
fdoBuildStamp,
/* dotdFileExecPath= */ null,
/* variablesExtensions= */ ImmutableList.of(),
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
index b6721f8..7ac4cf3 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
@@ -385,9 +385,6 @@
/** A string constant for the match-clif action. */
public static final String MATCH_CLIF = "match_clif";
- /** A string constant for is_cc_fake_binary feature. */
- public static final String IS_CC_FAKE_BINARY = "is_cc_fake_binary";
-
/** A feature marking that the toolchain can use --start-lib/--end-lib flags */
public static final String SUPPORTS_START_END_LIB = "supports_start_end_lib";
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
deleted file mode 100644
index 3ec4a8b..0000000
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
+++ /dev/null
@@ -1,308 +0,0 @@
-// Copyright 2014 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.devtools.build.lib.rules.cpp;
-
-import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static java.util.stream.Collectors.joining;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.flogger.GoogleLogger;
-import com.google.devtools.build.lib.actions.AbstractAction;
-import com.google.devtools.build.lib.actions.ActionEnvironment;
-import com.google.devtools.build.lib.actions.ActionExecutionContext;
-import com.google.devtools.build.lib.actions.ActionExecutionException;
-import com.google.devtools.build.lib.actions.ActionOwner;
-import com.google.devtools.build.lib.actions.ActionResult;
-import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.CommandLineExpansionException;
-import com.google.devtools.build.lib.actions.ExecException;
-import com.google.devtools.build.lib.actions.ResourceSet;
-import com.google.devtools.build.lib.actions.Spawn;
-import com.google.devtools.build.lib.actions.SpawnResult;
-import com.google.devtools.build.lib.cmdline.Label;
-import com.google.devtools.build.lib.collect.nestedset.NestedSet;
-import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
-import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadCompatible;
-import com.google.devtools.build.lib.events.Event;
-import com.google.devtools.build.lib.exec.SpawnStrategyResolver;
-import com.google.devtools.build.lib.packages.StarlarkSemanticsOptions;
-import com.google.devtools.build.lib.rules.cpp.CcCommon.CoptsFilter;
-import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration;
-import com.google.devtools.build.lib.server.FailureDetails.CppCompile.Code;
-import com.google.devtools.build.lib.util.DetailedExitCode;
-import com.google.devtools.build.lib.util.ShellEscaper;
-import com.google.devtools.build.lib.vfs.FileSystemUtils;
-import com.google.devtools.build.lib.vfs.Path;
-import com.google.devtools.build.lib.vfs.PathFragment;
-import java.io.IOException;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Action that represents a fake C++ compilation step.
- */
-@ThreadCompatible
-public class FakeCppCompileAction extends CppCompileAction {
-
- private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();
-
- public static final UUID GUID = UUID.fromString("8ab63589-be01-4a39-b770-b98ae8b03493");
-
- private final PathFragment tempOutputFile;
-
- FakeCppCompileAction(
- ActionOwner owner,
- FeatureConfiguration featureConfiguration,
- CcToolchainVariables variables,
- Artifact sourceFile,
- CppConfiguration cppConfiguration,
- boolean shareable,
- boolean shouldScanIncludes,
- boolean shouldPruneModules,
- boolean usePic,
- boolean useHeaderModules,
- NestedSet<Artifact> mandatoryInputs,
- NestedSet<Artifact> inputsForInvalidation,
- ImmutableList<Artifact> builtinIncludeFiles,
- NestedSet<Artifact> prunableHeaders,
- Artifact outputFile,
- PathFragment tempOutputFile,
- Artifact dotdFile,
- ActionEnvironment env,
- CcCompilationContext ccCompilationContext,
- CoptsFilter nocopts,
- CppSemantics cppSemantics,
- ImmutableList<PathFragment> builtInIncludeDirectories,
- ImmutableMap<String, String> executionInfo,
- Artifact grepIncludes) {
- super(
- owner,
- featureConfiguration,
- variables,
- sourceFile,
- cppConfiguration,
- shareable,
- shouldScanIncludes,
- shouldPruneModules,
- usePic,
- useHeaderModules,
- mandatoryInputs,
- inputsForInvalidation,
- builtinIncludeFiles,
- prunableHeaders,
- outputFile,
- dotdFile,
- /* gcnoFile=*/ null,
- /* dwoFile=*/ null,
- /* ltoIndexingFile=*/ null,
- env,
- // We only allow inclusion of header files explicitly declared in
- // "srcs", so we only use declaredIncludeSrcs, not declaredIncludeDirs.
- // (Disallowing use of undeclared headers for cc_fake_binary is needed
- // because the header files get included in the runfiles for the
- // cc_fake_binary and for the negative compilation tests that depend on
- // the cc_fake_binary, and the runfiles must be determined at analysis
- // time, so they can't depend on the contents of the ".d" file.)
- CcCompilationContext.disallowUndeclaredHeaders(ccCompilationContext),
- nocopts,
- /* additionalIncludeScanningRoots=*/ ImmutableList.of(),
- GUID,
- executionInfo,
- CppActionNames.CPP_COMPILE,
- cppSemantics,
- builtInIncludeDirectories,
- grepIncludes);
- this.tempOutputFile = Preconditions.checkNotNull(tempOutputFile);
- }
-
- @Override
- @ThreadCompatible
- public ActionResult execute(ActionExecutionContext actionExecutionContext)
- throws ActionExecutionException, InterruptedException {
- List<SpawnResult> spawnResults;
- // First, do a normal compilation, to generate the ".d" file. The generated object file is built
- // to a temporary location (tempOutputFile) and ignored afterwards.
- logger.atInfo().log("Generating %s", getDotdFile());
- byte[] dotDContents = null;
- try {
- Spawn spawn = createSpawn(actionExecutionContext.getClientEnv());
- SpawnStrategyResolver spawnStrategyResolver =
- actionExecutionContext.getContext(SpawnStrategyResolver.class);
- spawnResults = spawnStrategyResolver.exec(spawn, actionExecutionContext);
- // The SpawnActionContext guarantees that the first list entry is the successful one.
- dotDContents = getDotDContents(spawnResults.get(0));
- } catch (ExecException e) {
- Label label = getOwner().getLabel();
- throw e.toActionExecutionException(
- "C++ compilation of rule '" + label + "'",
- actionExecutionContext.showVerboseFailures(label),
- this);
- } finally {
- clearAdditionalInputs();
- }
- CppIncludeExtractionContext scanningContext =
- actionExecutionContext.getContext(CppIncludeExtractionContext.class);
- Path execRoot = actionExecutionContext.getExecRoot();
-
- NestedSet<Artifact> discoveredInputs;
- if (getDotdFile() == null) {
- discoveredInputs = NestedSetBuilder.<Artifact>stableOrder().build();
- } else {
- HeaderDiscovery.Builder discoveryBuilder =
- new HeaderDiscovery.Builder()
- .setAction(this)
- .setSourceFile(getSourceFile())
- .setDependencies(
- processDepset(actionExecutionContext, execRoot, dotDContents).getDependencies())
- .setPermittedSystemIncludePrefixes(getPermittedSystemIncludePrefixes(execRoot))
- .setAllowedDerivedInputs(getAllowedDerivedInputs());
-
- if (needsIncludeValidation) {
- discoveryBuilder.shouldValidateInclusions();
- }
-
- boolean siblingRepositoryLayout =
- actionExecutionContext
- .getOptions()
- .getOptions(StarlarkSemanticsOptions.class)
- .experimentalSiblingRepositoryLayout;
-
- discoveredInputs =
- discoveryBuilder
- .build()
- .discoverInputsFromDependencies(
- execRoot, scanningContext.getArtifactResolver(), siblingRepositoryLayout);
- }
-
- dotDContents = null; // Garbage collect in-memory .d contents.
-
- // Even cc_fake_binary rules need to properly declare their dependencies...
- // In fact, they need to declare their dependencies even more than cc_binary rules do.
- // CcCommonConfiguredTarget passes in an empty set of declaredIncludeDirs,
- // so this check below will only allow inclusion of header files that are explicitly
- // listed in the "srcs" of the cc_fake_binary or in the "srcs" of a cc_library that it
- // depends on.
- try {
- validateInclusions(actionExecutionContext, discoveredInputs);
- } catch (ActionExecutionException e) {
- // TODO(bazel-team): (2009) make this into an error, once most of the current warnings
- // are fixed.
- actionExecutionContext
- .getEventHandler()
- .handle(
- Event.warn(
- getOwner().getLocation(),
- e.getMessage() + ";\n this warning may eventually become an error"));
- }
-
- if (discoversInputs()) {
- updateActionInputs(discoveredInputs);
- } else {
- Preconditions.checkState(
- discoveredInputs.isEmpty(),
- "Discovered inputs without discovering inputs? %s %s",
- discoveredInputs,
- this);
- }
-
- // Generate a fake ".o" file containing the command line needed to generate
- // the real object file.
- logger.atInfo().log("Generating %s", outputFile);
-
- // A cc_fake_binary rule generates fake .o files and a fake target file,
- // which merely contain instructions on building the real target. We need to
- // be careful to use a new set of output file names in the instructions, as
- // to not overwrite the fake output files when someone tries to follow the
- // instructions. As the real compilation is executed by the test from its
- // runfiles directory (where writing is forbidden), we patch the command
- // line to write to $TEST_TMPDIR instead.
- final String outputPrefix = "$TEST_TMPDIR/";
- String argv;
- try {
- argv =
- getArguments().stream()
- .map(
- input -> {
- String result = ShellEscaper.escapeString(input);
- // Replace -c <tempOutputFile> so it's -c <outputFile>.
- if (input.equals(tempOutputFile.getPathString())) {
- result =
- outputPrefix + ShellEscaper.escapeString(outputFile.getExecPathString());
- }
- if (input.equals(outputFile.getExecPathString())
- || (getDotdFile() != null
- && input.equals(getDotdFile().getExecPathString()))) {
- result = outputPrefix + ShellEscaper.escapeString(input);
- }
- return result;
- })
- .collect(joining(" "));
- } catch (CommandLineExpansionException e) {
- String message =
- String.format(
- "failed to generate compile command for rule '%s: %s",
- getOwner().getLabel(), e.getMessage());
- DetailedExitCode code = createDetailedExitCode(message, Code.COMMAND_GENERATION_FAILURE);
- throw new ActionExecutionException(message, this, /*catastrophe=*/ false, code);
- }
-
- // Write the command needed to build the real .o file to the fake .o file.
- // Generate a command to ensure that the output directory exists; otherwise
- // the compilation would fail.
- try {
- // Ensure that the .d file and .o file are siblings, so that the "mkdir" below works for
- // both.
- Preconditions.checkState(
- getDotdFile() == null
- || outputFile
- .getExecPath()
- .getParentDirectory()
- .equals(getDotdFile().getExecPath().getParentDirectory()));
- FileSystemUtils.writeContent(
- actionExecutionContext.getInputPath(outputFile),
- ISO_8859_1,
- actionExecutionContext.getInputPath(outputFile).getBaseName()
- + ": "
- + "mkdir -p "
- + outputPrefix
- + "$(dirname "
- + outputFile.getExecPath()
- + ")"
- + " && "
- + argv
- + "\n");
- } catch (IOException e) {
- String message =
- String.format(
- "failed to create fake compile command for rule '%s: %s",
- getOwner().getLabel(), e.getMessage());
- DetailedExitCode code = createDetailedExitCode(message, Code.FAKE_COMMAND_GENERATION_FAILURE);
- throw new ActionExecutionException(message, this, false, code);
- }
- return ActionResult.create(spawnResults);
- }
-
- @Override
- public String getMnemonic() {
- return "FakeCppCompile";
- }
-
- @Override
- public ResourceSet estimateResourceConsumptionLocal() {
- return AbstractAction.DEFAULT_RESOURCE_SET;
- }
-}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java
index 80518ee..37c8d1d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java
@@ -343,22 +343,6 @@
}
/**
- * Get the effective path for the object artifact, being careful not to create new strings if
- * possible.
- *
- * @param: objectFile - Artifact representing an object file.
- * @param -inputIsFake - Is this object being used for a cc_fake_binary.
- */
- private static String effectiveObjectFilePath(Artifact objectFile, boolean inputIsFake) {
- // Avoid making new strings as much as possible! This called for every object file used in the
- // build.
- if (inputIsFake) {
- return Link.FAKE_OBJECT_PREFIX + objectFile.getExecPathString();
- }
- return objectFile.getExecPathString();
- }
-
- /**
* Adds command-line options for a static library or non-library input into options.
*
* @param librariesToLink - a collection that will be exposed as a build variable.
@@ -437,8 +421,7 @@
// unreferenced code).
librariesToLink.addValue(
LibraryToLinkValue.forObjectFile(
- effectiveObjectFilePath(member, input.isFake()),
- /* isWholeArchive= */ true));
+ member.getExecPathString(), /* isWholeArchive= */ true));
}
}
} else {
@@ -476,7 +459,7 @@
} else {
librariesToLink.addValue(
LibraryToLinkValue.forObjectFile(
- effectiveObjectFilePath(inputArtifact, input.isFake()), inputIsWholeArchive));
+ inputArtifact.getExecPathString(), inputIsWholeArchive));
}
if (!input.isLinkstamp()) {
expandedLinkerInputsBuilder.add(input);
@@ -484,7 +467,7 @@
} else {
librariesToLink.addValue(
LibraryToLinkValue.forStaticLibrary(
- effectiveObjectFilePath(inputArtifact, input.isFake()), inputIsWholeArchive));
+ inputArtifact.getExecPathString(), inputIsWholeArchive));
expandedLinkerInputsBuilder.add(input);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
index 91647c8..2328acd 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
@@ -66,14 +66,6 @@
CppFileTypes.OBJECT_FILE, CppFileTypes.PIC_OBJECT_FILE, CppFileTypes.CLIF_OUTPUT_PROTO);
/**
- * Prefix that is prepended to command line entries that refer to the output
- * of cc_fake_binary compile actions. This is a bad hack to signal to the code
- * in {@code CppLinkAction#executeFake(Executor, FileOutErr)} that it needs
- * special handling.
- */
- public static final String FAKE_OBJECT_PREFIX = "fake:";
-
- /**
* Whether a particular link target requires PIC code.
*/
public enum Picness {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInput.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInput.java
index 01cf6c3..41c6d66 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInput.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInput.java
@@ -42,11 +42,6 @@
*/
boolean containsObjectFiles();
- /**
- * Returns whether the input artifact is a fake object file or not.
- */
- boolean isFake();
-
default boolean isLinkstamp() {
return false;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java
index 1803029..033be5e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java
@@ -88,11 +88,6 @@
}
@Override
- public boolean isFake() {
- return false;
- }
-
- @Override
public Iterable<Artifact> getObjectFiles() {
throw new IllegalStateException();
}
@@ -108,7 +103,7 @@
}
SimpleLinkerInput other = (SimpleLinkerInput) that;
- return artifact.equals(other.artifact) && isFake() == other.isFake();
+ return artifact.equals(other.artifact);
}
@Override
@@ -132,27 +127,6 @@
}
}
- /**
- * A linker input that is a fake object file generated by cc_fake_binary. The contained
- * artifact must be an object file.
- */
- @ThreadSafety.Immutable
- private static class FakeLinkerInput extends SimpleLinkerInput {
- private FakeLinkerInput(Artifact artifact) {
- super(artifact, ArtifactCategory.OBJECT_FILE, /* disableWholeArchive= */ false);
- Preconditions.checkState(Link.OBJECT_FILETYPES.matches(artifact.getFilename()));
- }
-
- @Override
- public boolean isFake() {
- return true;
- }
- }
-
- /**
- * A linker input that is a fake object file generated by cc_fake_binary. The contained artifact
- * must be an object file.
- */
@ThreadSafety.Immutable
private static class LinkstampLinkerInput extends SimpleLinkerInput {
private LinkstampLinkerInput(Artifact artifact) {
@@ -243,11 +217,6 @@
}
@Override
- public boolean isFake() {
- return false;
- }
-
- @Override
public Iterable<Artifact> getObjectFiles() {
throw new IllegalStateException(
"LinkerInputs: does not support getObjectFiles: " + toString());
@@ -403,11 +372,6 @@
}
@Override
- public boolean isFake() {
- return false;
- }
-
- @Override
public ImmutableMap<Artifact, LtoBackendArtifacts> getSharedNonLtoBackends() {
return sharedNonLtoBackends;
}
@@ -477,13 +441,6 @@
}
/**
- * Creates a fake linker input. The artifact must be an object file.
- */
- public static LinkerInput fakeLinkerInput(Artifact artifact) {
- return new FakeLinkerInput(artifact);
- }
-
- /**
* Creates input libraries for which we do not know what objects files it consists of.
*/
public static Iterable<LibraryToLink> opaqueLibrariesToLink(
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
index 62e166f..2893977 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
@@ -460,7 +460,6 @@
OUTPUT_FILE,
NATIVE_DEPS,
USE_TEST_ONLY_FLAGS,
- FAKE,
RUNTIME_SOLIB_DIR,
ENVIRONMENT,
}
@@ -512,7 +511,6 @@
builder.setNativeDeps(attributesToFlip.contains(NonStaticAttributes.NATIVE_DEPS));
builder.setUseTestOnlyFlags(
attributesToFlip.contains(NonStaticAttributes.USE_TEST_ONLY_FLAGS));
- builder.setFake(attributesToFlip.contains(NonStaticAttributes.FAKE));
builder.setToolchainLibrariesSolibDir(
attributesToFlip.contains(NonStaticAttributes.RUNTIME_SOLIB_DIR)
? null
@@ -650,7 +648,6 @@
objects.build(),
ImmutableList.<LibraryToLink>of(),
getMockFeatureConfiguration(/* envVars= */ ImmutableMap.of()))
- .setFake(true)
.build();
// Ensure that minima are enforced.
@@ -752,7 +749,7 @@
createLinkBuilder(ruleContext, LinkTargetType.EXECUTABLE)
.setInterfaceOutput(scratchArtifact("FakeInterfaceOutput"));
- assertError("Interface output can only be used with non-fake DYNAMIC_LIBRARY targets", builder);
+ assertError("Interface output can only be used with DYNAMIC_LIBRARY targets", builder);
}
@Test
@@ -972,24 +969,24 @@
for (LinkTargetType linkType : targetTypesToTest) {
scratch.deleteFile("dummyRuleContext/BUILD");
- Artifact output = scratchArtifact("output." + linkType.getDefaultExtension());
+ Artifact output = ruleContext.getBinArtifact("output." + linkType.getDefaultExtension());
CppLinkActionBuilder builder =
createLinkBuilder(
ruleContext,
linkType,
- output.getExecPathString(),
+ output.getRootRelativePathString(),
ImmutableList.<Artifact>of(),
ImmutableList.<LibraryToLink>of(),
getMockFeatureConfiguration(/* envVars= */ ImmutableMap.of()))
.setLibraryIdentifier("foo")
.addObjectFiles(ImmutableList.of(testTreeArtifact))
- .addObjectFile(objectFile)
- // Makes sure this doesn't use a params file.
- .setFake(true);
+ .addObjectFile(objectFile);
CppLinkAction linkAction = builder.build();
- assertThat(linkAction.getCommandLine(expander))
+ assertThat(
+ ImmutableList.copyOf(
+ linkAction.getLinkCommandLine().paramCmdLine().arguments(expander)))
.containsAtLeast(
library0.getExecPathString(),
library1.getExecPathString(),