From e65f3a8ee2405854e6b6b62d6c318289e7d3c059 Mon Sep 17 00:00:00 2001 From: mschaller Date: Tue, 22 Jan 2019 08:36:48 -0800 Subject: [PATCH] Clarify comments concerning output artifact data, remove index check 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 --- .../devtools/build/lib/actions/FileArtifactValue.java | 2 +- .../devtools/build/lib/skyframe/ActionMetadataHandler.java | 7 ------- .../devtools/build/lib/skyframe/MinimalOutputStore.java | 3 --- .../google/devtools/build/lib/skyframe/OutputStore.java | 2 +- .../com/google/devtools/build/lib/util/RegexFilter.java | 6 ++++-- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java b/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java index 6b063d608ca0fa..c7e4966e6a29b1 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java +++ b/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java @@ -118,7 +118,7 @@ public BigInteger getValueFingerprint() { * Index used to resolve remote files. * *

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; diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java index 50391f5edbd55a..6b6564629d4a53 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java @@ -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); } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/MinimalOutputStore.java b/src/main/java/com/google/devtools/build/lib/skyframe/MinimalOutputStore.java index 57ae76922d5f28..7f07c14acade7d 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/MinimalOutputStore.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/MinimalOutputStore.java @@ -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) {} } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/OutputStore.java b/src/main/java/com/google/devtools/build/lib/skyframe/OutputStore.java index fcff7aea70018b..78298190a76bfa 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/OutputStore.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/OutputStore.java @@ -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); } diff --git a/src/main/java/com/google/devtools/build/lib/util/RegexFilter.java b/src/main/java/com/google/devtools/build/lib/util/RegexFilter.java index 62c5e711dc8e86..b175401c342090 100644 --- a/src/main/java/com/google/devtools/build/lib/util/RegexFilter.java +++ b/src/main/java/com/google/devtools/build/lib/util/RegexFilter.java @@ -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(); }