Skip to content

Commit

Permalink
Clarify comments concerning output artifact data, remove index check
Browse files Browse the repository at this point in the history
Note that 0 is a legal backend index to use when representing local,
empty, or omitted outputs.

Also, remove backend index check in injectRemoteFile to accommodate
storing omitted output information.

RELNOTES: None.
PiperOrigin-RevId: 230345657
  • Loading branch information
anakanemison authored and Copybara-Service committed Jan 22, 2019
1 parent c612d05 commit e65f3a8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public BigInteger getValueFingerprint() {
* Index used to resolve remote files.
*
* <p>0 indicates that no such information is available which can mean that it's either a local
* file or empty.
* file, empty, or an omitted output.
*/
public int getLocationIndex() {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,6 @@ public void injectDigest(ActionInput output, FileStatus statNoFollow, byte[] dig
public void injectRemoteFile(Artifact output, byte[] digest, long size, int locationIndex) {
Preconditions.checkState(
executionMode.get(), "Tried to inject %s outside of execution.", output);
Preconditions.checkArgument(
locationIndex != 0 || size == 0,
"output = %s, size = %s, locationIndex =%s",
output,
size,
locationIndex);

store.injectRemoteFile(output, digest, size, locationIndex);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,4 @@ void putArtifactData(Artifact artifact, ArtifactFileMetadata value) {}

@Override
void addTreeArtifactContents(Artifact artifact, TreeFileArtifact contents) {}

@Override
void injectRemoteFile(Artifact output, byte[] digest, long size, int locationIndex) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ final void injectOutputData(Artifact output, FileArtifactValue artifactValue) {
injectedFiles.add(output);

// While `artifactValue` carries the important information, consumers also require an entry in
// `outputArtifactData` so a `PLACEHOLDER` is added to `outputArtifactData`.
// `artifactData` so a `PLACEHOLDER` is added to `artifactData`.
artifactData.put(output, ArtifactFileMetadata.PLACEHOLDER);
additionalOutputData.put(output, artifactValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ public boolean isIncluded(String value) {
return inclusionPattern.matcher(value).find();
}

String getInclusionRegex() {
@Nullable
public String getInclusionRegex() {
return inclusionPattern == null ? null : inclusionPattern.pattern();
}

String getExclusionRegex() {
@Nullable
public String getExclusionRegex() {
return exclusionPattern == null ? null : exclusionPattern.pattern();
}

Expand Down

0 comments on commit e65f3a8

Please sign in to comment.