diff options
author | Googler <noreply@google.com> | 2018-07-08 16:15:53 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-08 16:17:17 -0700 |
commit | 4e4c77ae96955138006af15664074123d6a4f51d (patch) | |
tree | daf2083fa3c02df668ff35dd21af31580d06db8f /src/main/java/com/google/devtools/build/lib/actions | |
parent | 3ac44db0427b7db46b6c39f7dbfab7b5f31f8c37 (diff) |
PiperOrigin-RevId: 203687257
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/ParamFileInfo.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ParamFileInfo.java b/src/main/java/com/google/devtools/build/lib/actions/ParamFileInfo.java index 27f4d4597d..171a073450 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ParamFileInfo.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ParamFileInfo.java @@ -17,6 +17,8 @@ package com.google.devtools.build.lib.actions; import static java.nio.charset.StandardCharsets.ISO_8859_1; import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType; import java.nio.charset.Charset; import java.util.Objects; @@ -32,13 +34,24 @@ public final class ParamFileInfo { private final Charset charset; private final String flagFormatString; private final boolean always; + private final Iterable<Artifact> inputs; private ParamFileInfo( - ParameterFileType fileType, Charset charset, String flagFormatString, boolean always) { + ParameterFileType fileType, + Charset charset, + String flagFormatString, + Iterable<Artifact> inputs, + boolean always) { this.fileType = Preconditions.checkNotNull(fileType); this.charset = Preconditions.checkNotNull(charset); this.flagFormatString = Preconditions.checkNotNull(flagFormatString); this.always = always; + this.inputs = Iterables.transform(inputs, input -> { + Preconditions.checkArgument(input.isTreeArtifact(), + input.getExecPath() + " is not tree artifacts, " + + "it should not be put into ParamFileInfo's inputs"); + return input; + }); } /** @@ -65,6 +78,11 @@ public final class ParamFileInfo { return always; } + /** Returns the tree artifacts that are needed as input for {@code ParameterFileWriteAction} */ + public Iterable<Artifact> getInputs() { + return inputs; + } + @Override public int hashCode() { return Objects.hash(charset, flagFormatString, fileType, always); @@ -95,6 +113,7 @@ public final class ParamFileInfo { private Charset charset = ISO_8859_1; private String flagFormatString = "@%s"; private boolean always; + private Iterable<Artifact> inputs = ImmutableList.<Artifact>of(); private Builder(ParameterFileType fileType) { this.fileType = fileType; @@ -123,8 +142,13 @@ public final class ParamFileInfo { return this; } + public Builder setInputs(Iterable<Artifact> inputs) { + this.inputs = inputs; + return this; + } + public ParamFileInfo build() { - return new ParamFileInfo(fileType, charset, flagFormatString, always); + return new ParamFileInfo(fileType, charset, flagFormatString, inputs, always); } } } |