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.analysis; |
| 16 | |
| 17 | import com.google.devtools.build.lib.analysis.config.BuildConfiguration; |
| 18 | import com.google.devtools.build.lib.packages.Target; |
vladmos | 632d961 | 2017-07-07 13:01:00 -0400 | [diff] [blame] | 19 | import com.google.devtools.build.lib.skylarkinterface.SkylarkValue; |
dslomov | 211a3ba | 2017-05-16 00:21:22 +0200 | [diff] [blame] | 20 | import com.google.devtools.build.lib.syntax.ClassObject; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 21 | import 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 | */ |
vladmos | 632d961 | 2017-07-07 13:01:00 -0400 | [diff] [blame] | 33 | public interface ConfiguredTarget extends TransitiveInfoCollection, ClassObject, SkylarkValue { |
Dmitry Lomov | dce0170 | 2016-11-28 15:51:32 +0000 | [diff] [blame] | 34 | |
| 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 Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 46 | /** |
| 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 | } |