diff options
Diffstat (limited to 'src/main/java/com/google')
3 files changed, 10 insertions, 20 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java index 9399384c30..f00f1e3c02 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java +++ b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java @@ -415,16 +415,20 @@ public abstract class AbstractAction implements Action, SkylarkValue { * If the action might read directories as inputs in a way that is unsound wrt dependency * checking, this method must be called. */ - protected void checkInputsForDirectories(EventHandler eventHandler, - MetadataHandler metadataHandler) { + protected void checkInputsForDirectories( + EventHandler eventHandler, MetadataHandler metadataHandler) throws ExecException { // Report "directory dependency checking" warning only for non-generated directories (generated // ones will be reported earlier). for (Artifact input : getMandatoryInputs()) { // Assume that if the file did not exist, we would not have gotten here. - if (input.isSourceArtifact() && !metadataHandler.isRegularFile(input)) { - eventHandler.handle(Event.warn(getOwner().getLocation(), "input '" - + input.prettyPrint() + "' to " + getOwner().getLabel() - + " is a directory; dependency checking of directories is unsound")); + try { + if (input.isSourceArtifact() && !metadataHandler.getMetadata(input).isFile()) { + eventHandler.handle(Event.warn(getOwner().getLocation(), "input '" + + input.prettyPrint() + "' to " + getOwner().getLabel() + + " is a directory; dependency checking of directories is unsound")); + } + } catch (IOException e) { + throw new UserExecException(e); } } } diff --git a/src/main/java/com/google/devtools/build/lib/actions/cache/MetadataHandler.java b/src/main/java/com/google/devtools/build/lib/actions/cache/MetadataHandler.java index 57df4e2961..fc6c229d5a 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/cache/MetadataHandler.java +++ b/src/main/java/com/google/devtools/build/lib/actions/cache/MetadataHandler.java @@ -66,9 +66,6 @@ public interface MetadataHandler { */ void markOmitted(ActionInput output); - /** Returns true iff artifact is a regular file. */ - boolean isRegularFile(Artifact artifact); - /** * Returns true iff artifact was intentionally omitted (not saved). */ 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 3027a3841b..0221e288eb 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 @@ -496,17 +496,6 @@ public class ActionMetadataHandler implements MetadataHandler { additionalOutputData.clear(); } - @Override - public boolean isRegularFile(Artifact artifact) { - // Currently this method is used only for genrule input directory checks. If we need to call - // this on output artifacts too, this could be more efficient. - FileArtifactValue value = getInputFileArtifactValue(artifact); - if (value != null && value.isFile()) { - return true; - } - return artifact.getPath().isFile(); - } - /** @return data for output files that was computed during execution. */ Map<Artifact, FileValue> getOutputArtifactData() { return outputArtifactData; |