|
33 | 33 | import com.google.devtools.build.lib.analysis.Runfiles; |
34 | 34 | import com.google.devtools.build.lib.analysis.RunfilesProvider; |
35 | 35 | import com.google.devtools.build.lib.analysis.RunfilesSupport; |
| 36 | +import com.google.devtools.build.lib.analysis.SourceManifestAction; |
| 37 | +import com.google.devtools.build.lib.analysis.SourceManifestAction.ManifestType; |
36 | 38 | import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; |
37 | 39 | import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; |
38 | 40 | import com.google.devtools.build.lib.analysis.actions.FileWriteAction; |
39 | | -import com.google.devtools.build.lib.analysis.actions.LazyWritePathsFileAction; |
40 | 41 | import com.google.devtools.build.lib.analysis.actions.SpawnAction; |
41 | 42 | import com.google.devtools.build.lib.analysis.config.CompilationMode; |
42 | 43 | import com.google.devtools.build.lib.collect.nestedset.NestedSet; |
@@ -423,19 +424,25 @@ public ConfiguredTarget create(RuleContext ruleContext) |
423 | 424 | NestedSetBuilder<Artifact> coverageSupportFiles = NestedSetBuilder.stableOrder(); |
424 | 425 | if (ruleContext.getConfiguration().isCodeCoverageEnabled()) { |
425 | 426 |
|
426 | | - // Create an artifact that contains the root relative paths of the jars on the runtime |
427 | | - // classpath. |
| 427 | + // Create an artifact that contains the runfiles relative paths of the jars on the runtime |
| 428 | + // classpath. Using SourceManifestAction is the only reliable way to match the runfiles |
| 429 | + // creation code. |
428 | 430 | Artifact runtimeClasspathArtifact = |
429 | 431 | ruleContext.getUniqueDirectoryArtifact( |
430 | 432 | "runtime_classpath_for_coverage", |
431 | 433 | "runtime_classpath.txt", |
432 | 434 | ruleContext.getBinOrGenfilesDirectory()); |
433 | 435 | ruleContext.registerAction( |
434 | | - new LazyWritePathsFileAction( |
| 436 | + new SourceManifestAction( |
| 437 | + ManifestType.SOURCES_ONLY, |
435 | 438 | ruleContext.getActionOwner(), |
436 | 439 | runtimeClasspathArtifact, |
437 | | - common.getRuntimeClasspath(), |
438 | | - /* filesToIgnore= */ ImmutableSet.of(), |
| 440 | + new Runfiles.Builder( |
| 441 | + ruleContext.getWorkspaceName(), |
| 442 | + ruleContext.getConfiguration().legacyExternalRunfiles()) |
| 443 | + // This matches the code below in collectDefaultRunfiles. |
| 444 | + .addTransitiveArtifactsWrappedInStableOrder(common.getRuntimeClasspath()) |
| 445 | + .build(), |
439 | 446 | true)); |
440 | 447 | filesBuilder.add(runtimeClasspathArtifact); |
441 | 448 |
|
|
0 commit comments