Don't require that tests output to bin (instead of genfiles) for coverage
getInstrumentedFileManifest asserts `ruleContext.getRule().hasBinaryOutput()`. However, that doesn't assert that the target has an executable output. Rather, it asserts that the target's output goes to bin instead of genfiles. That's the preferred convention, but if a test sets `output_to_genfiles` for some reason (even though it probably shouldn't), having that return `InstrumentedFilesInfo` will cause it to suddenly start crashing in coverage mode. Which is pretty confusing.
RELNOTES: None.
PiperOrigin-RevId: 374180811
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFileManifestAction.java b/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFileManifestAction.java
index 2e689aa..900dbad 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFileManifestAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFileManifestAction.java
@@ -17,7 +17,6 @@
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.ActionOwner;
@@ -98,9 +97,6 @@
*/
public static Artifact getInstrumentedFileManifest(RuleContext ruleContext,
NestedSet<Artifact> additionalSourceFiles, NestedSet<Artifact> metadataFiles) {
- // Instrumented manifest makes sense only for rules with binary output.
- Preconditions.checkState(
- ruleContext.getRule().hasBinaryOutput(), "not binary output: %s", ruleContext.getLabel());
Artifact instrumentedFileManifest = ruleContext.getBinArtifact(
ruleContext.getTarget().getName() + ".instrumented_files");