Automated rollback of commit 3be8bdbe44b2eee49c10e09e1f16c8851eb3959a.
*** Reason for rollback ***
Rolling back because it breaks head blaze. See yitingwang@'s comment:
*** Original change description ***
RunfilesSupport: remove the sources manifest
This is unused in Bazel, and it's ~trivial to create one where needed.
RELNOTES: None.
***
PiperOrigin-RevId: 281697418
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java b/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java
index fef0eca..be87200 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java
@@ -81,6 +81,7 @@
private final Artifact runfilesInputManifest;
private final Artifact runfilesManifest;
private final Artifact runfilesMiddleman;
+ private final Artifact sourcesManifest;
private final Artifact owningExecutable;
private final boolean buildRunfileLinks;
private final boolean runfilesEnabled;
@@ -129,6 +130,7 @@
}
Artifact runfilesMiddleman =
createRunfilesMiddleman(ruleContext, owningExecutable, runfiles, runfilesManifest);
+ Artifact sourcesManifest = createSourceManifest(ruleContext, runfiles, owningExecutable);
boolean runfilesEnabled = ruleContext.getConfiguration().runfilesEnabled();
@@ -137,6 +139,7 @@
runfilesInputManifest,
runfilesManifest,
runfilesMiddleman,
+ sourcesManifest,
owningExecutable,
buildRunfileLinks,
runfilesEnabled,
@@ -150,6 +153,7 @@
Artifact runfilesInputManifest,
Artifact runfilesManifest,
Artifact runfilesMiddleman,
+ Artifact sourcesManifest,
Artifact owningExecutable,
boolean buildRunfileLinks,
boolean runfilesEnabled,
@@ -158,6 +162,7 @@
this.runfilesInputManifest = runfilesInputManifest;
this.runfilesManifest = runfilesManifest;
this.runfilesMiddleman = runfilesMiddleman;
+ this.sourcesManifest = sourcesManifest;
this.owningExecutable = owningExecutable;
this.buildRunfileLinks = buildRunfileLinks;
this.runfilesEnabled = runfilesEnabled;
@@ -304,6 +309,11 @@
return runfilesMiddleman;
}
+ /** Returns the Sources manifest. */
+ public Artifact getSourceManifest() {
+ return sourcesManifest;
+ }
+
private static Artifact createRunfilesMiddleman(
ActionConstructionContext context,
Artifact owningExecutable,
@@ -373,6 +383,31 @@
}
/**
+ * Creates an {@link Artifact} which writes the "sources only" manifest file.
+ *
+ * @param context the owner for the manifest action
+ * @param runfiles the runfiles
+ * @return the Artifact representing the file write action.
+ */
+ private static Artifact createSourceManifest(
+ ActionConstructionContext context, Runfiles runfiles, Artifact owningExecutable) {
+ // Put the sources only manifest next to the MANIFEST file but call it SOURCES.
+ PathFragment executablePath = owningExecutable.getRootRelativePath();
+ PathFragment sourcesManifestPath =
+ executablePath
+ .getParentDirectory()
+ .getChild(executablePath.getBaseName() + ".runfiles.SOURCES");
+ Artifact sourceOnlyManifest =
+ context.getDerivedArtifact(sourcesManifestPath, context.getBinDirectory());
+ context
+ .getAnalysisEnvironment()
+ .registerAction(
+ new SourceManifestAction(
+ ManifestType.SOURCES_ONLY, context.getActionOwner(), sourceOnlyManifest, runfiles));
+ return sourceOnlyManifest;
+ }
+
+ /**
* Helper method that returns a collection of artifacts that are necessary for the runfiles of the
* given target. Note that the runfile symlink tree is never built, so this may include artifacts
* that end up not being used (see {@link Runfiles}).