blob: bf50ec3dcf9e5fdcaabf547616074b104af34e78 [file] [log] [blame]
Damien Martin-Guillerezf88f4d82015-09-25 13:56:55 +00001// Copyright 2014 The Bazel Authors. All rights reserved.
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +01002//
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
15package com.google.devtools.build.lib.pkgcache;
16
Lukacs Berki6e91eb92015-09-21 09:12:37 +000017import com.google.devtools.build.lib.cmdline.Label;
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010018import com.google.devtools.build.lib.packages.Attribute;
19import com.google.devtools.build.lib.packages.NoSuchThingException;
20import com.google.devtools.build.lib.packages.Target;
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010021import javax.annotation.Nullable;
22
23/**
24 * An observer of the visitation over a target graph.
25 */
26public 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 Ramakrishnan3c0adb22016-08-15 21:54:55 +000043 * @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 Nienhuysd08b27f2015-02-25 16:45:20 +010046 * @param e the corresponding exception thrown
47 */
lberki231d77d2019-01-03 11:18:11 -080048 void missingEdge(@Nullable Target target, Label to, NoSuchThingException e);
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010049
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}