Damien Martin-Guillerez | f88f4d8 | 2015-09-25 13:56:55 +0000 | [diff] [blame] | 1 | // Copyright 2014 The Bazel Authors. All rights reserved. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 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 | |
| 15 | package com.google.devtools.build.lib.pkgcache; |
| 16 | |
Lukacs Berki | 6e91eb9 | 2015-09-21 09:12:37 +0000 | [diff] [blame] | 17 | import com.google.devtools.build.lib.cmdline.Label; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 18 | import com.google.devtools.build.lib.packages.Attribute; |
| 19 | import com.google.devtools.build.lib.packages.NoSuchThingException; |
| 20 | import com.google.devtools.build.lib.packages.Target; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 21 | import javax.annotation.Nullable; |
| 22 | |
| 23 | /** |
| 24 | * An observer of the visitation over a target graph. |
| 25 | */ |
| 26 | public interface TargetEdgeObserver { |
| 27 | |
| 28 | /** |
| 29 | * Called when an edge is discovered. |
| 30 | * May be called more than once for the same |
| 31 | * (from, to) pair. |
| 32 | * |
| 33 | * @param from the originating node. |
| 34 | * @param attribute The attribute which defines the edge. |
| 35 | * Non-null iff (from instanceof Rule). |
| 36 | * @param to the target node. |
| 37 | */ |
| 38 | void edge(Target from, Attribute attribute, Target to); |
| 39 | |
| 40 | /** |
| 41 | * Called when a Target has a reference to a non-existent target. |
| 42 | * |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 43 | * @param target the target. May be null (e.g. in the case of an implicit dependency on a |
| 44 | * subincluded file). |
| 45 | * @param to a label reference in the rule, which does not correspond to a valid target. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 46 | * @param e the corresponding exception thrown |
| 47 | */ |
lberki | 231d77d | 2019-01-03 11:18:11 -0800 | [diff] [blame] | 48 | void missingEdge(@Nullable Target target, Label to, NoSuchThingException e); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * Called when a node is discovered. May be called |
| 52 | * more than once for the same node. |
| 53 | * |
| 54 | * @param node the target. |
| 55 | */ |
| 56 | void node(Target node); |
| 57 | } |