blob: 62082cbf5553d784fdb98043939d0ca7977b5e1d [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.analysis;
16
17import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
18import com.google.devtools.build.lib.packages.Target;
vladmos632d9612017-07-07 13:01:00 -040019import com.google.devtools.build.lib.skylarkinterface.SkylarkValue;
dslomov211a3ba2017-05-16 00:21:22 +020020import com.google.devtools.build.lib.syntax.ClassObject;
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010021import javax.annotation.Nullable;
22
23/**
24 * A {@link ConfiguredTarget} is conceptually a {@link TransitiveInfoCollection} coupled
25 * with the {@link Target} and {@link BuildConfiguration} objects it was created from.
26 *
27 * <p>This interface is supposed to only be used in {@link BuildView} and above. In particular,
28 * rule implementations should not be able to access the {@link ConfiguredTarget} objects
29 * associated with their direct dependencies, only the corresponding
30 * {@link TransitiveInfoCollection}s. Also, {@link ConfiguredTarget} objects should not be
31 * accessible from the action graph.
32 */
vladmos632d9612017-07-07 13:01:00 -040033public interface ConfiguredTarget extends TransitiveInfoCollection, ClassObject, SkylarkValue {
Dmitry Lomovdce01702016-11-28 15:51:32 +000034
35 /**
36 * All <code>ConfiguredTarget</code>s have a "label" field.
37 */
38 String LABEL_FIELD = "label";
39
40 /**
41 * All <code>ConfiguredTarget</code>s have a "files" field.
42 */
43 String FILES_FIELD = "files";
44
45
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010046 /**
47 * Returns the Target with which this {@link ConfiguredTarget} is associated.
48 */
49 Target getTarget();
50
51 /**
52 * <p>Returns the {@link BuildConfiguration} for which this {@link ConfiguredTarget} is
53 * defined. Configuration is defined for all configured targets with exception
54 * of the {@link InputFileConfiguredTarget} for which it is always
55 * <b>null</b>.</p>
56 */
57 @Override
58 @Nullable
59 BuildConfiguration getConfiguration();
60}