aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-08-31 18:27:15 +0200
committerGravatar Vladimir Moskva <vladmos@google.com>2017-09-01 12:27:05 +0200
commit59141a8fc0f1016f5d1676f6c53e896490343570 (patch)
tree9a9580724c50d8ab96c5c4af6cb6b42ed739eb26 /src/main/java/com/google/devtools/build
parent91d23bfd98025094d9549857a28d3da1e0a311b9 (diff)
Fix --nobuild_runfile_manifests to keep transitive dependencies of the runfiles
manifest on "pruning manifests". We may need these at test execution time. RELNOTES: None. PiperOrigin-RevId: 167147362
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java23
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java2
2 files changed, 22 insertions, 3 deletions
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 2f99405f28..684cf867ba 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
@@ -123,8 +123,8 @@ public final class RunfilesSupport {
runfilesInputManifest = createRunfilesInputManifestArtifact(ruleContext);
runfilesManifest = createRunfilesAction(ruleContext, runfiles, artifactsMiddleman);
} else {
- runfilesInputManifest = artifactsMiddleman;
- runfilesManifest = artifactsMiddleman;
+ runfilesInputManifest = runfilesManifest =
+ createManifestMiddleman(ruleContext, runfiles, artifactsMiddleman);
}
runfilesMiddleman = createRunfilesMiddleman(ruleContext, artifactsMiddleman, runfilesManifest);
sourcesManifest = createSourceManifest(ruleContext, runfiles);
@@ -324,6 +324,25 @@ public final class RunfilesSupport {
}
/**
+ * Creates a middleman artifact which substitutes for the input and
+ * output manifests when manifest files are disabled.
+ */
+ private Artifact createManifestMiddleman(ActionConstructionContext context, Runfiles runfiles,
+ Artifact artifactsMiddleman) {
+ // Deps which are otherwise omitted when we don't build the manifest.
+ // These may include "pruning manifests" which are needed at execution time.
+ Collection<Artifact> manifestDeps = SourceManifestAction.getDependencies(runfiles);
+ if (manifestDeps.isEmpty()) {
+ // Can't create a runfiles middleman from zero artifacts.
+ return artifactsMiddleman;
+ }
+ return context.getAnalysisEnvironment().getMiddlemanFactory().createRunfilesMiddleman(
+ context.getActionOwner(), owningExecutable, SourceManifestAction.getDependencies(runfiles),
+ context.getConfiguration().getMiddlemanDirectory(context.getRule().getRepository()),
+ "runfiles_manifest");
+ }
+
+ /**
* Creates an {@link Artifact} which writes the "sources only" manifest file.
*
* @param context the owner for the manifest action
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java b/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java
index 0981efe719..0fe1ba736e 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java
@@ -143,7 +143,7 @@ public final class SourceManifestAction extends AbstractFileWriteAction {
* depend on them. The only necessary dependencies are pruning manifests, which must be read
* to properly prune the tree.
*/
- private static Collection<Artifact> getDependencies(Runfiles runfiles) {
+ public static Collection<Artifact> getDependencies(Runfiles runfiles) {
ImmutableList.Builder<Artifact> builder = ImmutableList.builder();
for (Runfiles.PruningManifest manifest : runfiles.getPruningManifests()) {
builder.add(manifest.getManifestFile());