Automated rollback of commit
*** 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.
***
@@ -81,6 +81,7 @@ public final class RunfilesSupport {
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 @@ public final class RunfilesSupport {
}
Artifact runfilesMiddleman =
createRunfilesMiddleman(ruleContext, owningExecutable, runfiles, runfilesManifest);
+ Artifact sourcesManifest = createSourceManifest(ruleContext, runfiles, owningExecutable);
boolean runfilesEnabled = ruleContext.getConfiguration().runfilesEnabled();
@@ -137,6 +139,7 @@ public final class RunfilesSupport {
runfilesInputManifest,
runfilesManifest,
runfilesMiddleman,
+ sourcesManifest,
owningExecutable,
buildRunfileLinks,
runfilesEnabled,
@@ -150,6 +153,7 @@ public final class RunfilesSupport {
Artifact runfilesInputManifest,
Artifact runfilesManifest,
Artifact runfilesMiddleman,
+ Artifact sourcesManifest,
Artifact owningExecutable,
boolean buildRunfileLinks,
boolean runfilesEnabled,
@@ -158,6 +162,7 @@ public final class RunfilesSupport {
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 @@ public final class RunfilesSupport {
return runfilesMiddleman;
}
+ /** Returns the Sources manifest. */
+ public Artifact getSourceManifest() {
+ return sourcesManifest;
+ }
+
private static Artifact createRunfilesMiddleman(
ActionConstructionContext context,
Artifact owningExecutable,
@@ -372,6 +382,31 @@ public final class RunfilesSupport {
return outputManifest;
}
+ /**
+ * 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
