Skip to content

Commit 5b25f8c

Browse files
lberkicopybara-github
authored andcommitted
Rename FileStateValue.DEFAULT_MIDDLEMAN to RUNFILES_TREE_MARKER.
Also add a Javadoc explaining why it exists; it really shouldn't, but at least then we should have a record as to why it does. RELNOTES: None. PiperOrigin-RevId: 695692425 Change-Id: I16ba3d739a45e6a031e987a36ffec0c7c77fcbd6
1 parent d22c22c commit 5b25f8c

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,20 @@ public Optional<PathFragment> getMaterializationExecPath() {
189189
*/
190190
interface Singleton {}
191191

192+
/**
193+
* Metadata for runfiles trees.
194+
*
195+
* <p>This should really be more nuanced so that runfiles trees don't need to be special-cased in
196+
* the local action cache, but it works well enough. The only downsides are that we don't detect
197+
* when someone changed a runfiles tree like we do for other output artifacts and a number of
198+
* extra branches.
199+
*
200+
* <p>In Skyframe, we check whether a runfiles tree changed based on {@link
201+
* RunfilesArtifactValue}, which does contain data about its contents.
202+
*/
192203
@SerializationConstant
193-
public static final FileArtifactValue DEFAULT_MIDDLEMAN = new SingletonMarkerValue();
204+
public static final FileArtifactValue RUNFILES_TREE_MARKER = new SingletonMarkerValue();
205+
194206
/** Data that marks that a file is not present on the filesystem. */
195207
@SerializationConstant
196208
public static final FileArtifactValue MISSING_FILE_MARKER = new SingletonMarkerValue();

src/main/java/com/google/devtools/build/lib/skyframe/ActionOutputMetadataStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ public FileArtifactValue getOutputMetadata(ActionInput actionInput)
197197
if (value != null) {
198198
return checkExists(value, artifact);
199199
}
200-
putArtifactData(artifact, FileArtifactValue.DEFAULT_MIDDLEMAN);
201-
return FileArtifactValue.DEFAULT_MIDDLEMAN;
200+
putArtifactData(artifact, FileArtifactValue.RUNFILES_TREE_MARKER);
201+
return FileArtifactValue.RUNFILES_TREE_MARKER;
202202
}
203203

204204
if (artifact.isTreeArtifact()) {

src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedExcept
417417
.build();
418418
treeArtifactData.put(output, tree);
419419
} else if (output.isRunfilesTree()) {
420-
artifactData.put(output, FileArtifactValue.DEFAULT_MIDDLEMAN);
420+
artifactData.put(output, FileArtifactValue.RUNFILES_TREE_MARKER);
421421
} else {
422422
Path path = output.getPath();
423423
FileArtifactValue noDigest =

src/test/java/com/google/devtools/build/lib/skyframe/FileArtifactValueTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void testEqualsAndHashCode() {
9292
RemoteFileArtifactValue.create(toBytes("00112233445566778899AABBCCDDEEFF"), 1, 1, 1),
9393
RemoteFileArtifactValue.create(toBytes("00112233445566778899AABBCCDDEEFF"), 1, 1, 2))
9494
.addEqualityGroup(FileArtifactValue.MISSING_FILE_MARKER)
95-
.addEqualityGroup(FileArtifactValue.DEFAULT_MIDDLEMAN)
95+
.addEqualityGroup(FileArtifactValue.RUNFILES_TREE_MARKER)
9696
.addEqualityGroup("a string")
9797
.testEquals();
9898
}

0 commit comments

Comments
 (0)