Skip to content

Commit ca58b64

Browse files
alexjskicopybara-github
authored andcommitted
Add a getter for arguments in ParamFileActionInput.
Expand `DummyExecutor` to allow customizing `BugReporter` and `ShowSubcommands` for tests. PiperOrigin-RevId: 427875824
1 parent 21f679c commit ca58b64

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/main/java/com/google/devtools/build/lib/actions/CommandLines.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ public String getExecPathString() {
315315
public PathFragment getExecPath() {
316316
return paramFileExecPath;
317317
}
318+
319+
public ImmutableList<String> getArguments() {
320+
return ImmutableList.copyOf(arguments);
321+
}
318322
}
319323

320324
// Helper function to unpack the optimized storage format into a list

src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,33 @@
2828
public class DummyExecutor implements Executor {
2929

3030
private final FileSystem fileSystem;
31+
private final BugReporter bugReporter;
3132
private final Path inputDir;
3233
private final ManualClock clock = new ManualClock();
3334
@Nullable private final OptionsProvider optionsProvider;
35+
@Nullable private final ShowSubcommands showSubcommands;
3436

3537
public DummyExecutor(
36-
FileSystem fileSystem, Path inputDir, @Nullable OptionsProvider optionsProvider) {
38+
FileSystem fileSystem,
39+
BugReporter bugReporter,
40+
Path inputDir,
41+
@Nullable OptionsProvider optionsProvider,
42+
@Nullable ShowSubcommands showSubcommands) {
3743
this.fileSystem = fileSystem;
44+
this.bugReporter = bugReporter;
3845
this.inputDir = inputDir;
3946
this.optionsProvider = optionsProvider;
47+
this.showSubcommands = showSubcommands;
48+
}
49+
50+
public DummyExecutor(
51+
FileSystem fileSystem, Path inputDir, @Nullable OptionsProvider optionsProvider) {
52+
this(
53+
fileSystem,
54+
BugReporter.defaultInstance(),
55+
inputDir,
56+
optionsProvider,
57+
/*showSubcommands=*/ null);
4058
}
4159

4260
public DummyExecutor(FileSystem fileSystem, Path inputDir) {
@@ -64,7 +82,7 @@ public Clock getClock() {
6482

6583
@Override
6684
public BugReporter getBugReporter() {
67-
return BugReporter.defaultInstance();
85+
return bugReporter;
6886
}
6987

7088
@Override
@@ -82,6 +100,9 @@ public OptionsProvider getOptions() {
82100

83101
@Override
84102
public ShowSubcommands reportsSubcommands() {
103+
if (showSubcommands != null) {
104+
return showSubcommands;
105+
}
85106
throw new UnsupportedOperationException();
86107
}
87108
}

0 commit comments

Comments
 (0)