blob: e866b5157282e7634089f70de1314158ed1d087b [file] [log] [blame]
Nathan Harmataad810502015-07-29 01:33:49 +00001// Copyright 2015 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14package com.google.devtools.build.lib.skyframe;
15
16import com.google.common.collect.ImmutableList;
17import com.google.devtools.build.lib.vfs.RootedPath;
18import com.google.devtools.build.skyframe.SkyKey;
19import com.google.devtools.build.skyframe.SkyValue;
20
21/**
22 * A value for ensuring that a file symlink expansion error is reported exactly once. This is
23 * achieved by forcing the same value key for two logically equivalent expansion errors (e.g.
24 * ['a' -> 'b' -> 'c' -> 'a/nope'] and ['b' -> 'c' -> 'a' -> 'a/nope']), and letting Skyframe do
25 * its magic.
26 */
27class FileSymlinkInfiniteExpansionUniquenessValue implements SkyValue {
28 static final FileSymlinkInfiniteExpansionUniquenessValue INSTANCE =
29 new FileSymlinkInfiniteExpansionUniquenessValue();
30
31 private FileSymlinkInfiniteExpansionUniquenessValue() {
32 }
33
34 static SkyKey key(ImmutableList<RootedPath> cycle) {
35 return AbstractFileSymlinkExceptionUniquenessValue.key(
36 SkyFunctions.FILE_SYMLINK_INFINITE_EXPANSION_UNIQUENESS, cycle);
37 }
38}
39