From 6c5ef5369a3ffceb8a65cc159a2fff1401242810 Mon Sep 17 00:00:00 2001 From: lberki Date: Fri, 2 Aug 2019 03:54:58 -0700 Subject: [PATCH] Do not assert that all TreeFileArtifacts have RegularFileValues. This apparently happens for the root directory of TreeArtifacts on OS X for some odd reason. Fixes #9054. RELNOTES: None. PiperOrigin-RevId: 261295961 --- .../lib/skyframe/ActionExecutionValue.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java index 4de2fbbbeb0274..8fc740763a6aac 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java @@ -85,16 +85,16 @@ private ActionExecutionValue( for (Map.Entry tree : treeArtifactData.entrySet()) { for (Map.Entry file : tree.getValue().getChildValues().entrySet()) { - Preconditions.checkArgument( - file.getValue().getType() == FileStateType.REGULAR_FILE, - "file %s in tree artifact %s is not a regular file", - file.getKey(), - tree.getKey()); - Preconditions.checkArgument( - file.getValue().getDigest() != null, - "missing digest for file %s in tree artifact %s", - file.getKey(), - tree.getKey()); + // We should only have RegularFileValue instances in here, but apparently tree artifacts + // sometimes store their own root directory in here. Sad. + // https://github.com/bazelbuild/bazel/issues/9058 + if (file.getValue().getType() == FileStateType.REGULAR_FILE) { + Preconditions.checkArgument( + file.getValue().getDigest() != null, + "missing digest for file %s in tree artifact %s", + file.getKey(), + tree.getKey()); + } } }