use of com.google.devtools.build.lib.skyframe.FileSymlinkException in project bazel by bazelbuild.
the class SkylarkRepositoryContext method verifyLabelMarkerData.
private static boolean verifyLabelMarkerData(String key, String value, Environment env) throws InterruptedException {
Preconditions.checkArgument(key.startsWith("FILE:"));
try {
Label label = Label.parseAbsolute(key.substring(5));
RootedPath rootedPath = getRootedPathFromLabel(label, env);
SkyKey fileSkyKey = FileValue.key(rootedPath);
FileValue fileValue = (FileValue) env.getValueOrThrow(fileSkyKey, IOException.class, FileSymlinkException.class, InconsistentFilesystemException.class);
if (fileValue == null || !fileValue.isFile()) {
return false;
}
return Objects.equals(value, Integer.toString(fileValue.realFileStateValue().hashCode()));
} catch (LabelSyntaxException e) {
throw new IllegalStateException("Key " + key + " is not a correct file key (should be in form FILE:label)", e);
} catch (IOException | FileSymlinkException | InconsistentFilesystemException | EvalException e) {
// Consider those exception to be a cause for invalidation
return false;
}
}
use of com.google.devtools.build.lib.skyframe.FileSymlinkException in project bazel by bazelbuild.
the class RepositoryFunction method getRepositoryDirectory.
/**
* Adds the repository's directory to the graph and, if it's a symlink, resolves it to an actual
* directory.
*/
@Nullable
protected static FileValue getRepositoryDirectory(Path repositoryDirectory, Environment env) throws RepositoryFunctionException, InterruptedException {
SkyKey outputDirectoryKey = FileValue.key(RootedPath.toRootedPath(repositoryDirectory, PathFragment.EMPTY_FRAGMENT));
FileValue value;
try {
value = (FileValue) env.getValueOrThrow(outputDirectoryKey, IOException.class, FileSymlinkException.class, InconsistentFilesystemException.class);
} catch (IOException | FileSymlinkException | InconsistentFilesystemException e) {
throw new RepositoryFunctionException(new IOException("Could not access " + repositoryDirectory + ": " + e.getMessage()), Transience.PERSISTENT);
}
return value;
}
Aggregations