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