diff options
author | 2018-01-08 09:31:17 -0800 | |
---|---|---|
committer | 2018-01-08 09:33:08 -0800 | |
commit | 3e28868f63692b3a57a3d22a2dabc18395f24ceb (patch) | |
tree | 04352641789b9a6598772b692d08172264b035e2 /src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java | |
parent | 67330ad52391ad6562d439f77cc5133a0ea4247d (diff) |
Use EmptyActionInput instead of null in SpawnInputExpander
This simplifies some spawn runners, which no longer have to specially handle
null; unfortunately, the sandbox runners do not support VirtualActionInput,
so they still have to special-case it.
PiperOrigin-RevId: 181175408
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java b/src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java index f30209df53..f9abca0137 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java +++ b/src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java @@ -24,6 +24,8 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.Artifact.ArtifactExpander; import com.google.devtools.build.lib.actions.RunfilesSupplier; import com.google.devtools.build.lib.actions.Spawn; +import com.google.devtools.build.lib.actions.cache.VirtualActionInput; +import com.google.devtools.build.lib.actions.cache.VirtualActionInput.EmptyActionInput; import com.google.devtools.build.lib.rules.fileset.FilesetActionContext; import com.google.devtools.build.lib.vfs.PathFragment; import java.io.IOException; @@ -39,7 +41,8 @@ import java.util.TreeMap; * laid out. */ public class SpawnInputExpander { - public static final ActionInput EMPTY_FILE = null; + @VisibleForTesting + static final ActionInput EMPTY_FILE = new EmptyActionInput("/dev/null"); private final boolean strict; @@ -129,7 +132,8 @@ public class SpawnInputExpander { /** * Convert the inputs of the given spawn to a map from exec-root relative paths to action inputs. - * In some cases, this generates empty files, for which it uses {@code null}. + * The returned map never contains {@code null} values; it uses {@link #EMPTY_FILE} for empty + * files, which is an instance of {@link VirtualActionInput}. */ public SortedMap<PathFragment, ActionInput> getInputMapping( Spawn spawn, ArtifactExpander artifactExpander, ActionInputFileCache actionInputFileCache, |