Nathan Harmata | ad81050 | 2015-07-29 01:33:49 +0000 | [diff] [blame] | 1 | // 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. |
| 14 | package com.google.devtools.build.lib.skyframe; |
| 15 | |
| 16 | import com.google.common.collect.ImmutableList; |
| 17 | import com.google.devtools.build.lib.vfs.RootedPath; |
| 18 | import com.google.devtools.build.skyframe.SkyKey; |
| 19 | import 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 | */ |
| 27 | class 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 | |