cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 1 | // Copyright 2014 The Bazel Authors. 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 | |
Googler | 1a15920 | 2024-07-25 07:03:28 -0700 | [diff] [blame] | 16 | |
janakr | c902691 | 2021-04-14 10:28:23 -0700 | [diff] [blame] | 17 | import com.google.common.base.MoreObjects; |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 18 | import com.google.devtools.build.lib.analysis.ConfiguredTarget; |
janakr | 876deaa | 2021-02-17 07:49:48 -0800 | [diff] [blame] | 19 | import com.google.devtools.build.lib.analysis.ConfiguredTargetValue; |
janakr | 459b244 | 2018-06-05 10:26:02 -0700 | [diff] [blame] | 20 | import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget; |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 21 | import com.google.devtools.build.lib.collect.nestedset.NestedSet; |
| 22 | import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; |
| 23 | import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; |
| 24 | import com.google.devtools.build.lib.packages.Package; |
Googler | 1a15920 | 2024-07-25 07:03:28 -0700 | [diff] [blame] | 25 | import com.google.devtools.build.lib.skyframe.serialization.VisibleForSerialization; |
| 26 | import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 27 | import javax.annotation.Nullable; |
| 28 | |
janakr | f3130e1 | 2018-03-21 11:46:30 -0700 | [diff] [blame] | 29 | /** A non-rule configured target in the context of a Skyframe graph. */ |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 30 | @Immutable |
| 31 | @ThreadSafe |
Googler | 1a15920 | 2024-07-25 07:03:28 -0700 | [diff] [blame] | 32 | // Reached via OutputFileConfiguredTarget. |
| 33 | @AutoCodec(explicitlyAllowClass = RuleConfiguredTarget.class) |
Googler | 6e6e862 | 2024-04-12 10:47:23 -0700 | [diff] [blame] | 34 | public final class NonRuleConfiguredTargetValue |
| 35 | extends BaseRuleConfiguredTargetValue<ConfiguredTarget> implements ConfiguredTargetValue { |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 36 | |
Googler | 1a15920 | 2024-07-25 07:03:28 -0700 | [diff] [blame] | 37 | @AutoCodec.Instantiator |
| 38 | @VisibleForSerialization |
| 39 | NonRuleConfiguredTargetValue( |
| 40 | ConfiguredTarget configuredTarget) { |
| 41 | // Transitive packages are not serialized. |
| 42 | this(configuredTarget, null); |
| 43 | } |
| 44 | |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 45 | NonRuleConfiguredTargetValue( |
Googler | 720dc5f | 2022-09-16 03:43:51 -0700 | [diff] [blame] | 46 | ConfiguredTarget configuredTarget, @Nullable NestedSet<Package> transitivePackages) { |
Googler | 6e6e862 | 2024-04-12 10:47:23 -0700 | [diff] [blame] | 47 | super(configuredTarget, transitivePackages); |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 48 | } |
| 49 | |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 50 | @Override |
| 51 | public String toString() { |
Googler | 6e6e862 | 2024-04-12 10:47:23 -0700 | [diff] [blame] | 52 | return MoreObjects.toStringHelper(this) |
| 53 | .add("configuredTarget", getConfiguredTarget()) |
| 54 | .toString(); |
shahan | 52bb22a | 2018-09-02 08:39:50 -0700 | [diff] [blame] | 55 | } |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 56 | } |