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 | package com.google.devtools.build.lib.skyframe; |
| 15 | |
tomlu | a155b53 | 2017-11-08 20:12:47 +0100 | [diff] [blame] | 16 | import com.google.common.base.Preconditions; |
janakr | b6823b0 | 2019-04-12 13:57:02 -0700 | [diff] [blame] | 17 | import com.google.common.base.Stopwatch; |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 18 | import com.google.common.collect.ImmutableList; |
Lukacs Berki | 7894c18 | 2016-05-10 12:07:01 +0000 | [diff] [blame] | 19 | import com.google.common.collect.ImmutableMap; |
John Cater | 3a0ce77 | 2017-08-09 21:09:53 +0200 | [diff] [blame] | 20 | import com.google.common.collect.ImmutableSet; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 21 | import com.google.common.collect.Iterables; |
Ulf Adams | 7cb66de | 2016-01-14 08:46:43 +0000 | [diff] [blame] | 22 | import com.google.common.collect.Maps; |
jcater | 1f72416 | 2018-08-27 09:16:01 -0700 | [diff] [blame] | 23 | import com.google.common.collect.Streams; |
janakr | b5ace95 | 2019-04-08 17:44:08 -0700 | [diff] [blame] | 24 | import com.google.common.flogger.GoogleLogger; |
Janak Ramakrishnan | b3a6ca7 | 2015-03-27 20:07:28 +0000 | [diff] [blame] | 25 | import com.google.devtools.build.lib.actions.Actions; |
janakr | 93e3eea | 2017-03-30 22:09:37 +0000 | [diff] [blame] | 26 | import com.google.devtools.build.lib.actions.Actions.GeneratingActions; |
Janak Ramakrishnan | b3a6ca7 | 2015-03-27 20:07:28 +0000 | [diff] [blame] | 27 | import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException; |
gregce | 4c3ef11 | 2017-09-20 23:43:14 +0200 | [diff] [blame] | 28 | import com.google.devtools.build.lib.analysis.AspectResolver; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 29 | import com.google.devtools.build.lib.analysis.CachingAnalysisEnvironment; |
Dmitry Lomov | b487ac6 | 2015-11-09 13:09:12 +0000 | [diff] [blame] | 30 | import com.google.devtools.build.lib.analysis.ConfiguredAspect; |
mstaib | 4a07a47 | 2018-04-19 14:16:41 -0700 | [diff] [blame] | 31 | import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 32 | import com.google.devtools.build.lib.analysis.ConfiguredTarget; |
Michael Staib | 5e573fd | 2016-01-27 00:33:29 +0000 | [diff] [blame] | 33 | import com.google.devtools.build.lib.analysis.Dependency; |
lberki | 102256f | 2019-02-08 01:34:23 -0800 | [diff] [blame] | 34 | import com.google.devtools.build.lib.analysis.DependencyResolver; |
lberki | 4cd4447 | 2019-02-06 08:36:34 -0800 | [diff] [blame] | 35 | import com.google.devtools.build.lib.analysis.DependencyResolver.DependencyKind; |
Dmitry Lomov | d83af9e | 2017-02-23 15:44:23 +0000 | [diff] [blame] | 36 | import com.google.devtools.build.lib.analysis.DependencyResolver.InconsistentAspectOrderException; |
lberki | 1161e73 | 2019-02-18 05:07:04 -0800 | [diff] [blame] | 37 | import com.google.devtools.build.lib.analysis.EmptyConfiguredTarget; |
John Cater | cdfa9ca | 2019-04-05 12:32:09 -0700 | [diff] [blame] | 38 | import com.google.devtools.build.lib.analysis.ResolvedToolchainContext; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 39 | import com.google.devtools.build.lib.analysis.TargetAndConfiguration; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 40 | import com.google.devtools.build.lib.analysis.config.BuildConfiguration; |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 41 | import com.google.devtools.build.lib.analysis.config.BuildOptions; |
mstaib | 794a020 | 2019-04-23 17:56:02 -0700 | [diff] [blame] | 42 | import com.google.devtools.build.lib.analysis.config.BuildOptions.OptionsDiffForReconstruction; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 43 | import com.google.devtools.build.lib.analysis.config.ConfigMatchingProvider; |
gregce | 9dbe48b | 2017-09-20 00:35:36 +0200 | [diff] [blame] | 44 | import com.google.devtools.build.lib.analysis.config.ConfigurationResolver; |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 45 | import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException; |
gregce | 2aee44b | 2017-09-16 07:16:44 +0200 | [diff] [blame] | 46 | import com.google.devtools.build.lib.analysis.configuredtargets.MergedConfiguredTarget.DuplicateException; |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 47 | import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget; |
juliexxia | b4519fb | 2019-01-16 07:43:00 -0800 | [diff] [blame] | 48 | import com.google.devtools.build.lib.analysis.skylark.StarlarkTransition.TransitionException; |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 49 | import com.google.devtools.build.lib.buildeventstream.BuildEventId; |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 50 | import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEventId.ConfigurationId; |
| 51 | import com.google.devtools.build.lib.causes.AnalysisFailedCause; |
| 52 | import com.google.devtools.build.lib.causes.Cause; |
| 53 | import com.google.devtools.build.lib.causes.LoadingFailedCause; |
Lukacs Berki | 6e91eb9 | 2015-09-21 09:12:37 +0000 | [diff] [blame] | 54 | import com.google.devtools.build.lib.cmdline.Label; |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 55 | import com.google.devtools.build.lib.collect.nestedset.NestedSet; |
Marian Lobur | c62faba | 2015-09-09 10:08:06 +0000 | [diff] [blame] | 56 | import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 57 | import com.google.devtools.build.lib.collect.nestedset.Order; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 58 | import com.google.devtools.build.lib.events.Event; |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 59 | import com.google.devtools.build.lib.events.EventKind; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 60 | import com.google.devtools.build.lib.events.StoredEventHandler; |
Dmitry Lomov | b487ac6 | 2015-11-09 13:09:12 +0000 | [diff] [blame] | 61 | import com.google.devtools.build.lib.packages.Aspect; |
Lukacs Berki | ffa73ad | 2015-09-18 11:40:12 +0000 | [diff] [blame] | 62 | import com.google.devtools.build.lib.packages.BuildType; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 63 | import com.google.devtools.build.lib.packages.NoSuchTargetException; |
John Cater | ee45c66 | 2018-06-05 11:09:01 -0700 | [diff] [blame] | 64 | import com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper; |
Marian Lobur | c62faba | 2015-09-09 10:08:06 +0000 | [diff] [blame] | 65 | import com.google.devtools.build.lib.packages.Package; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 66 | import com.google.devtools.build.lib.packages.RawAttributeMapper; |
| 67 | import com.google.devtools.build.lib.packages.Rule; |
gregce | 749962a | 2019-03-08 12:47:34 -0800 | [diff] [blame] | 68 | import com.google.devtools.build.lib.packages.RuleClass; |
John Cater | ee45c66 | 2018-06-05 11:09:01 -0700 | [diff] [blame] | 69 | import com.google.devtools.build.lib.packages.RuleClass.ExecutionPlatformConstraintsAllowed; |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 70 | import com.google.devtools.build.lib.packages.RuleClassProvider; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 71 | import com.google.devtools.build.lib.packages.Target; |
| 72 | import com.google.devtools.build.lib.packages.TargetUtils; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 73 | import com.google.devtools.build.lib.skyframe.AspectFunction.AspectCreationException; |
| 74 | import com.google.devtools.build.lib.skyframe.SkyframeExecutor.BuildViewProvider; |
janakr | 00408d6 | 2018-03-24 17:22:23 -0700 | [diff] [blame] | 75 | import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; |
mstaib | 794a020 | 2019-04-23 17:56:02 -0700 | [diff] [blame] | 76 | import com.google.devtools.build.lib.skyframe.trimming.TrimmedConfigurationCache; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 77 | import com.google.devtools.build.lib.syntax.EvalException; |
Greg Estren | d535325 | 2016-08-11 22:13:31 +0000 | [diff] [blame] | 78 | import com.google.devtools.build.lib.util.OrderedSetMultimap; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 79 | import com.google.devtools.build.skyframe.SkyFunction; |
| 80 | import com.google.devtools.build.skyframe.SkyFunctionException; |
| 81 | import com.google.devtools.build.skyframe.SkyKey; |
| 82 | import com.google.devtools.build.skyframe.SkyValue; |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 83 | import com.google.devtools.build.skyframe.ValueOrException; |
janakr | a81bb95 | 2019-01-28 17:30:06 -0800 | [diff] [blame] | 84 | import java.math.BigInteger; |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 85 | import java.util.ArrayList; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 86 | import java.util.Collection; |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 87 | import java.util.HashSet; |
Lukacs Berki | 7894c18 | 2016-05-10 12:07:01 +0000 | [diff] [blame] | 88 | import java.util.LinkedHashMap; |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 89 | import java.util.List; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 90 | import java.util.Map; |
juliexxia | b4519fb | 2019-01-16 07:43:00 -0800 | [diff] [blame] | 91 | import java.util.Objects; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 92 | import java.util.Set; |
Janak Ramakrishnan | bede7b4 | 2016-11-17 18:34:08 +0000 | [diff] [blame] | 93 | import java.util.concurrent.Semaphore; |
janakr | b6823b0 | 2019-04-12 13:57:02 -0700 | [diff] [blame] | 94 | import java.util.concurrent.TimeUnit; |
janakr | a81bb95 | 2019-01-28 17:30:06 -0800 | [diff] [blame] | 95 | import java.util.function.Supplier; |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 96 | import java.util.stream.Collectors; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 97 | import javax.annotation.Nullable; |
| 98 | |
| 99 | /** |
| 100 | * SkyFunction for {@link ConfiguredTargetValue}s. |
Lukacs Berki | 2300cd6 | 2016-05-19 11:06:37 +0000 | [diff] [blame] | 101 | * |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 102 | * <p>This class, together with {@link AspectFunction} drives the analysis phase. For more |
ulfjack | 26d0e49 | 2017-08-07 13:42:33 +0200 | [diff] [blame] | 103 | * information, see {@link com.google.devtools.build.lib.analysis.RuleConfiguredTargetFactory}. |
Lukacs Berki | 2300cd6 | 2016-05-19 11:06:37 +0000 | [diff] [blame] | 104 | * |
ulfjack | 26d0e49 | 2017-08-07 13:42:33 +0200 | [diff] [blame] | 105 | * @see com.google.devtools.build.lib.analysis.RuleConfiguredTargetFactory |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 106 | */ |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 107 | public final class ConfiguredTargetFunction implements SkyFunction { |
janakr | b5ace95 | 2019-04-08 17:44:08 -0700 | [diff] [blame] | 108 | private static final GoogleLogger logger = GoogleLogger.forEnclosingClass(); |
| 109 | |
janakr | b6823b0 | 2019-04-12 13:57:02 -0700 | [diff] [blame] | 110 | private static final ImmutableMap<Label, ConfigMatchingProvider> NO_CONFIG_CONDITIONS = |
| 111 | ImmutableMap.of(); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 112 | |
| 113 | /** |
| 114 | * Exception class that signals an error during the evaluation of a dependency. |
| 115 | */ |
| 116 | public static class DependencyEvaluationException extends Exception { |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 117 | public DependencyEvaluationException(InvalidConfigurationException cause) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 118 | super(cause); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 119 | } |
| 120 | |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 121 | public DependencyEvaluationException(ConfiguredValueCreationException cause) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 122 | super(cause); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 123 | } |
| 124 | |
Dmitry Lomov | d83af9e | 2017-02-23 15:44:23 +0000 | [diff] [blame] | 125 | public DependencyEvaluationException(InconsistentAspectOrderException cause) { |
| 126 | super(cause); |
| 127 | } |
| 128 | |
juliexxia | b4519fb | 2019-01-16 07:43:00 -0800 | [diff] [blame] | 129 | public DependencyEvaluationException(TransitionException cause) { |
| 130 | super(cause); |
| 131 | } |
| 132 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 133 | @Override |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 134 | public synchronized Exception getCause() { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 135 | return (Exception) super.getCause(); |
| 136 | } |
| 137 | } |
| 138 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 139 | private final BuildViewProvider buildViewProvider; |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 140 | private final RuleClassProvider ruleClassProvider; |
Janak Ramakrishnan | bede7b4 | 2016-11-17 18:34:08 +0000 | [diff] [blame] | 141 | private final Semaphore cpuBoundSemaphore; |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 142 | private final BuildOptions defaultBuildOptions; |
Googler | f526ed0 | 2018-09-20 03:59:54 -0700 | [diff] [blame] | 143 | @Nullable private final ConfiguredTargetProgressReceiver configuredTargetProgress; |
janakr | a81bb95 | 2019-01-28 17:30:06 -0800 | [diff] [blame] | 144 | private final Supplier<BigInteger> nonceVersion; |
| 145 | |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 146 | /** |
| 147 | * Indicates whether the set of packages transitively loaded for a given {@link |
| 148 | * ConfiguredTargetValue} will be needed for package root resolution later in the build. If not, |
| 149 | * they are not collected and stored. |
| 150 | */ |
| 151 | private final boolean storeTransitivePackagesForPackageRootResolution; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 152 | |
janakr | 500e17b | 2018-03-28 15:26:04 -0700 | [diff] [blame] | 153 | private final boolean shouldUnblockCpuWorkWhenFetchingDeps; |
| 154 | |
mstaib | 794a020 | 2019-04-23 17:56:02 -0700 | [diff] [blame] | 155 | private final TrimmedConfigurationCache<SkyKey, Label, OptionsDiffForReconstruction> |
| 156 | configuredTargetCache; |
| 157 | |
Janak Ramakrishnan | bede7b4 | 2016-11-17 18:34:08 +0000 | [diff] [blame] | 158 | ConfiguredTargetFunction( |
| 159 | BuildViewProvider buildViewProvider, |
| 160 | RuleClassProvider ruleClassProvider, |
janakr | 93e3eea | 2017-03-30 22:09:37 +0000 | [diff] [blame] | 161 | Semaphore cpuBoundSemaphore, |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 162 | boolean storeTransitivePackagesForPackageRootResolution, |
janakr | 500e17b | 2018-03-28 15:26:04 -0700 | [diff] [blame] | 163 | boolean shouldUnblockCpuWorkWhenFetchingDeps, |
Googler | f526ed0 | 2018-09-20 03:59:54 -0700 | [diff] [blame] | 164 | BuildOptions defaultBuildOptions, |
janakr | a81bb95 | 2019-01-28 17:30:06 -0800 | [diff] [blame] | 165 | @Nullable ConfiguredTargetProgressReceiver configuredTargetProgress, |
mstaib | 794a020 | 2019-04-23 17:56:02 -0700 | [diff] [blame] | 166 | Supplier<BigInteger> nonceVersion, |
| 167 | TrimmedConfigurationCache<SkyKey, Label, OptionsDiffForReconstruction> |
| 168 | configuredTargetCache) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 169 | this.buildViewProvider = buildViewProvider; |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 170 | this.ruleClassProvider = ruleClassProvider; |
Janak Ramakrishnan | bede7b4 | 2016-11-17 18:34:08 +0000 | [diff] [blame] | 171 | this.cpuBoundSemaphore = cpuBoundSemaphore; |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 172 | this.storeTransitivePackagesForPackageRootResolution = |
| 173 | storeTransitivePackagesForPackageRootResolution; |
janakr | 500e17b | 2018-03-28 15:26:04 -0700 | [diff] [blame] | 174 | this.shouldUnblockCpuWorkWhenFetchingDeps = shouldUnblockCpuWorkWhenFetchingDeps; |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 175 | this.defaultBuildOptions = defaultBuildOptions; |
Googler | f526ed0 | 2018-09-20 03:59:54 -0700 | [diff] [blame] | 176 | this.configuredTargetProgress = configuredTargetProgress; |
janakr | a81bb95 | 2019-01-28 17:30:06 -0800 | [diff] [blame] | 177 | this.nonceVersion = nonceVersion; |
mstaib | 794a020 | 2019-04-23 17:56:02 -0700 | [diff] [blame] | 178 | this.configuredTargetCache = configuredTargetCache; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 179 | } |
| 180 | |
janakr | b6823b0 | 2019-04-12 13:57:02 -0700 | [diff] [blame] | 181 | private void acquireWithLogging(SkyKey key) throws InterruptedException { |
| 182 | Stopwatch stopwatch = Stopwatch.createStarted(); |
| 183 | cpuBoundSemaphore.acquire(); |
| 184 | long elapsedTime = stopwatch.elapsed().toMillis(); |
| 185 | if (elapsedTime > 5) { |
| 186 | logger.atInfo().atMostEvery(10, TimeUnit.SECONDS).log( |
| 187 | "Spent %s milliseconds waiting for lock acquisition for %s", elapsedTime, key); |
| 188 | } |
| 189 | } |
| 190 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 191 | @Override |
| 192 | public SkyValue compute(SkyKey key, Environment env) throws ConfiguredTargetFunctionException, |
| 193 | InterruptedException { |
janakr | 500e17b | 2018-03-28 15:26:04 -0700 | [diff] [blame] | 194 | if (shouldUnblockCpuWorkWhenFetchingDeps) { |
| 195 | env = |
| 196 | new StateInformingSkyFunctionEnvironment( |
| 197 | env, |
| 198 | /*preFetch=*/ cpuBoundSemaphore::release, |
janakr | b6823b0 | 2019-04-12 13:57:02 -0700 | [diff] [blame] | 199 | /*postFetch=*/ () -> acquireWithLogging(key)); |
janakr | 500e17b | 2018-03-28 15:26:04 -0700 | [diff] [blame] | 200 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 201 | SkyframeBuildView view = buildViewProvider.getSkyframeBuildView(); |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 202 | NestedSetBuilder<Package> transitivePackagesForPackageRootResolution = |
| 203 | storeTransitivePackagesForPackageRootResolution ? NestedSetBuilder.stableOrder() : null; |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 204 | NestedSetBuilder<Cause> transitiveRootCauses = NestedSetBuilder.stableOrder(); |
janakr | 3863b53 | 2018-01-11 15:49:42 -0800 | [diff] [blame] | 205 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 206 | ConfiguredTargetKey configuredTargetKey = (ConfiguredTargetKey) key.argument(); |
janakr | ac2cd35 | 2017-12-20 13:37:13 -0800 | [diff] [blame] | 207 | Label label = configuredTargetKey.getLabel(); |
janakr | 3863b53 | 2018-01-11 15:49:42 -0800 | [diff] [blame] | 208 | BuildConfiguration configuration = null; |
| 209 | ImmutableSet<SkyKey> packageAndMaybeConfiguration; |
| 210 | SkyKey packageKey = PackageValue.key(label.getPackageIdentifier()); |
| 211 | SkyKey configurationKeyMaybe = configuredTargetKey.getConfigurationKey(); |
| 212 | if (configurationKeyMaybe == null) { |
| 213 | packageAndMaybeConfiguration = ImmutableSet.of(packageKey); |
| 214 | } else { |
| 215 | packageAndMaybeConfiguration = ImmutableSet.of(packageKey, configurationKeyMaybe); |
| 216 | } |
| 217 | Map<SkyKey, SkyValue> packageAndMaybeConfigurationValues = |
| 218 | env.getValues(packageAndMaybeConfiguration); |
| 219 | if (env.valuesMissing()) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 220 | return null; |
| 221 | } |
janakr | 3863b53 | 2018-01-11 15:49:42 -0800 | [diff] [blame] | 222 | PackageValue packageValue = (PackageValue) packageAndMaybeConfigurationValues.get(packageKey); |
| 223 | if (configurationKeyMaybe != null) { |
| 224 | configuration = |
| 225 | ((BuildConfigurationValue) packageAndMaybeConfigurationValues.get(configurationKeyMaybe)) |
| 226 | .getConfiguration(); |
| 227 | } |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 228 | |
| 229 | // TODO(ulfjack): This tries to match the logic in TransitiveTargetFunction / |
| 230 | // TargetMarkerFunction. Maybe we can merge the two? |
Janak Ramakrishnan | 0a4c6e4 | 2015-09-17 00:37:58 +0000 | [diff] [blame] | 231 | Package pkg = packageValue.getPackage(); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 232 | Target target; |
| 233 | try { |
janakr | ac2cd35 | 2017-12-20 13:37:13 -0800 | [diff] [blame] | 234 | target = pkg.getTarget(label.getName()); |
Ulf Adams | 9668361 | 2016-01-25 09:04:54 +0000 | [diff] [blame] | 235 | } catch (NoSuchTargetException e) { |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 236 | throw new ConfiguredTargetFunctionException( |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 237 | new ConfiguredValueCreationException(e.getMessage(), label, configuration)); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 238 | } |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 239 | if (pkg.containsErrors()) { |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 240 | transitiveRootCauses.add( |
| 241 | new LoadingFailedCause(label, new NoSuchTargetException(target).getMessage())); |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 242 | } |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 243 | if (transitivePackagesForPackageRootResolution != null) { |
| 244 | transitivePackagesForPackageRootResolution.add(pkg); |
| 245 | } |
lberki | a1f2ddb | 2019-03-04 23:43:25 -0800 | [diff] [blame] | 246 | if (target.isConfigurable() != (configuredTargetKey.getConfigurationKey() != null)) { |
lberki | 1161e73 | 2019-02-18 05:07:04 -0800 | [diff] [blame] | 247 | // We somehow ended up in a target that requires a non-null configuration as a dependency of |
lberki | a1f2ddb | 2019-03-04 23:43:25 -0800 | [diff] [blame] | 248 | // one that requires a null configuration or the other way round. This is always an error, but |
| 249 | // we need to analyze the dependencies of the latter target to realize that. Short-circuit the |
| 250 | // evaluation to avoid doing useless work and running code with a null configuration that's |
| 251 | // not prepared for it. |
lberki | 1161e73 | 2019-02-18 05:07:04 -0800 | [diff] [blame] | 252 | return new NonRuleConfiguredTargetValue( |
lberki | a1f2ddb | 2019-03-04 23:43:25 -0800 | [diff] [blame] | 253 | new EmptyConfiguredTarget(target.getLabel(), configuredTargetKey.getConfigurationKey()), |
lberki | 1161e73 | 2019-02-18 05:07:04 -0800 | [diff] [blame] | 254 | GeneratingActions.EMPTY, |
| 255 | transitivePackagesForPackageRootResolution == null |
| 256 | ? null |
| 257 | : transitivePackagesForPackageRootResolution.build(), |
| 258 | nonceVersion.get()); |
| 259 | } |
| 260 | |
Greg Estren | b5692bd | 2016-06-08 21:09:11 +0000 | [diff] [blame] | 261 | // This line is only needed for accurate error messaging. Say this target has a circular |
| 262 | // dependency with one of its deps. With this line, loading this target fails so Bazel |
| 263 | // associates the corresponding error with this target, as expected. Without this line, |
| 264 | // the first TransitiveTargetValue call happens on its dep (in trimConfigurations), so Bazel |
| 265 | // associates the error with the dep, which is misleading. |
janakr | ac2cd35 | 2017-12-20 13:37:13 -0800 | [diff] [blame] | 266 | if (configuration != null |
| 267 | && configuration.trimConfigurations() |
| 268 | && env.getValue(TransitiveTargetKey.of(label)) == null) { |
Greg Estren | b5692bd | 2016-06-08 21:09:11 +0000 | [diff] [blame] | 269 | return null; |
| 270 | } |
| 271 | |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 272 | TargetAndConfiguration ctgValue = new TargetAndConfiguration(target, configuration); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 273 | |
| 274 | SkyframeDependencyResolver resolver = view.createDependencyResolver(env); |
Janak Ramakrishnan | bede7b4 | 2016-11-17 18:34:08 +0000 | [diff] [blame] | 275 | |
jcater | 1f72416 | 2018-08-27 09:16:01 -0700 | [diff] [blame] | 276 | UnloadedToolchainContext unloadedToolchainContext = null; |
John Cater | 3a0ce77 | 2017-08-09 21:09:53 +0200 | [diff] [blame] | 277 | |
janakr | b6823b0 | 2019-04-12 13:57:02 -0700 | [diff] [blame] | 278 | // TODO(janakr): this call may tie up this thread indefinitely, reducing the parallelism of |
| 279 | // Skyframe. This is a strict improvement over the prior state of the code, in which we ran |
| 280 | // with #processors threads, but ideally we would call #tryAcquire here, and if we failed, |
| 281 | // would exit this SkyFunction and restart it when permits were available. |
| 282 | acquireWithLogging(key); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 283 | try { |
| 284 | // Get the configuration targets that trigger this rule's configurable attributes. |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 285 | ImmutableMap<Label, ConfigMatchingProvider> configConditions = |
| 286 | getConfigConditions( |
| 287 | ctgValue.getTarget(), |
| 288 | env, |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 289 | ctgValue, |
| 290 | transitivePackagesForPackageRootResolution, |
lberki | c67dcec | 2019-01-17 11:24:01 -0800 | [diff] [blame] | 291 | transitiveRootCauses); |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 292 | if (env.valuesMissing()) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 293 | return null; |
| 294 | } |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 295 | // TODO(ulfjack): ConfiguredAttributeMapper (indirectly used from computeDependencies) isn't |
| 296 | // safe to use if there are missing config conditions, so we stop here, but only if there are |
| 297 | // config conditions - though note that we can't check if configConditions is non-empty - it |
| 298 | // may be empty for other reasons. It would be better to continue here so that we can collect |
| 299 | // more root causes during computeDependencies. |
| 300 | // Note that this doesn't apply to AspectFunction, because aspects can't have configurable |
| 301 | // attributes. |
juliexxia | b4519fb | 2019-01-16 07:43:00 -0800 | [diff] [blame] | 302 | if (!transitiveRootCauses.isEmpty() |
| 303 | && !Objects.equals(configConditions, NO_CONFIG_CONDITIONS)) { |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 304 | throw new ConfiguredTargetFunctionException( |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 305 | new ConfiguredValueCreationException( |
| 306 | "Cannot compute config conditions", configuration, transitiveRootCauses.build())); |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 307 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 308 | |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 309 | // Determine what toolchains are needed by this target. |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 310 | if (target instanceof Rule) { |
John Cater | 53a87b9 | 2017-08-01 00:53:39 +0200 | [diff] [blame] | 311 | Rule rule = ((Rule) target); |
John Cater | 856b4dd | 2017-11-21 08:06:16 -0800 | [diff] [blame] | 312 | if (rule.getRuleClassObject().supportsPlatforms()) { |
| 313 | ImmutableSet<Label> requiredToolchains = |
| 314 | rule.getRuleClassObject().getRequiredToolchains(); |
John Cater | ee45c66 | 2018-06-05 11:09:01 -0700 | [diff] [blame] | 315 | |
| 316 | // Collect local (target, rule) constraints for filtering out execution platforms. |
| 317 | ImmutableSet<Label> execConstraintLabels = getExecutionPlatformConstraints(rule); |
jcater | 1f72416 | 2018-08-27 09:16:01 -0700 | [diff] [blame] | 318 | unloadedToolchainContext = |
John Cater | e39e5c9 | 2019-04-23 10:28:02 -0700 | [diff] [blame] | 319 | (UnloadedToolchainContext) |
| 320 | env.getValueOrThrow( |
| 321 | UnloadedToolchainContext.key() |
| 322 | .configurationKey(configuredTargetKey.getConfigurationKey()) |
| 323 | .requiredToolchainTypeLabels(requiredToolchains) |
| 324 | .execConstraintLabels(execConstraintLabels) |
| 325 | .shouldSanityCheckConfiguration( |
| 326 | configuration.trimConfigurationsRetroactively()) |
| 327 | .build(), |
| 328 | ToolchainException.class); |
John Cater | 856b4dd | 2017-11-21 08:06:16 -0800 | [diff] [blame] | 329 | if (env.valuesMissing()) { |
| 330 | return null; |
| 331 | } |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 332 | } |
| 333 | } |
| 334 | |
| 335 | // Calculate the dependencies of this target. |
lberki | 102256f | 2019-02-08 01:34:23 -0800 | [diff] [blame] | 336 | OrderedSetMultimap<DependencyKind, ConfiguredTargetAndData> depValueMap = |
Dmitry Lomov | 6231d08 | 2015-11-02 17:17:20 +0000 | [diff] [blame] | 337 | computeDependencies( |
| 338 | env, |
| 339 | resolver, |
| 340 | ctgValue, |
Dmitry Lomov | ca9bfa4 | 2016-11-15 13:22:36 +0000 | [diff] [blame] | 341 | ImmutableList.<Aspect>of(), |
Dmitry Lomov | 6231d08 | 2015-11-02 17:17:20 +0000 | [diff] [blame] | 342 | configConditions, |
jcater | 1f72416 | 2018-08-27 09:16:01 -0700 | [diff] [blame] | 343 | unloadedToolchainContext == null |
John Cater | ae4e785 | 2018-07-09 15:02:42 -0700 | [diff] [blame] | 344 | ? ImmutableSet.of() |
jcater | 1f72416 | 2018-08-27 09:16:01 -0700 | [diff] [blame] | 345 | : unloadedToolchainContext.resolvedToolchainLabels(), |
Dmitry Lomov | 6231d08 | 2015-11-02 17:17:20 +0000 | [diff] [blame] | 346 | ruleClassProvider, |
| 347 | view.getHostConfiguration(configuration), |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 348 | transitivePackagesForPackageRootResolution, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 349 | transitiveRootCauses, |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 350 | defaultBuildOptions); |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 351 | if (env.valuesMissing()) { |
| 352 | return null; |
| 353 | } |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 354 | if (!transitiveRootCauses.isEmpty()) { |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 355 | throw new ConfiguredTargetFunctionException( |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 356 | new ConfiguredValueCreationException( |
| 357 | "Analysis failed", configuration, transitiveRootCauses.build())); |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 358 | } |
| 359 | Preconditions.checkNotNull(depValueMap); |
John Cater | ae4e785 | 2018-07-09 15:02:42 -0700 | [diff] [blame] | 360 | |
| 361 | // Load the requested toolchains into the ToolchainContext, now that we have dependencies. |
John Cater | cdfa9ca | 2019-04-05 12:32:09 -0700 | [diff] [blame] | 362 | ResolvedToolchainContext toolchainContext = null; |
jcater | 1f72416 | 2018-08-27 09:16:01 -0700 | [diff] [blame] | 363 | if (unloadedToolchainContext != null) { |
John Cater | 5074514 | 2019-04-16 07:41:24 -0700 | [diff] [blame] | 364 | String targetDescription = target.toString(); |
lberki | 102256f | 2019-02-08 01:34:23 -0800 | [diff] [blame] | 365 | toolchainContext = |
John Cater | 5074514 | 2019-04-16 07:41:24 -0700 | [diff] [blame] | 366 | ResolvedToolchainContext.load( |
| 367 | unloadedToolchainContext, |
| 368 | targetDescription, |
| 369 | depValueMap.get(DependencyResolver.TOOLCHAIN_DEPENDENCY)); |
John Cater | ae4e785 | 2018-07-09 15:02:42 -0700 | [diff] [blame] | 370 | } |
| 371 | |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 372 | ConfiguredTargetValue ans = |
| 373 | createConfiguredTarget( |
| 374 | view, |
| 375 | env, |
| 376 | target, |
| 377 | configuration, |
janakr | eaff19c | 2019-01-31 13:59:40 -0800 | [diff] [blame] | 378 | configuredTargetKey, |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 379 | depValueMap, |
| 380 | configConditions, |
| 381 | toolchainContext, |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 382 | transitivePackagesForPackageRootResolution); |
Googler | f526ed0 | 2018-09-20 03:59:54 -0700 | [diff] [blame] | 383 | if (configuredTargetProgress != null) { |
| 384 | configuredTargetProgress.doneConfigureTarget(); |
| 385 | } |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 386 | return ans; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 387 | } catch (DependencyEvaluationException e) { |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 388 | if (e.getCause() instanceof ConfiguredValueCreationException) { |
John Cater | 3a0ce77 | 2017-08-09 21:09:53 +0200 | [diff] [blame] | 389 | ConfiguredValueCreationException cvce = (ConfiguredValueCreationException) e.getCause(); |
| 390 | |
| 391 | // Check if this is caused by an unresolved toolchain, and report it as such. |
jcater | 1f72416 | 2018-08-27 09:16:01 -0700 | [diff] [blame] | 392 | if (unloadedToolchainContext != null) { |
| 393 | UnloadedToolchainContext finalUnloadedToolchainContext = unloadedToolchainContext; |
John Cater | 3a0ce77 | 2017-08-09 21:09:53 +0200 | [diff] [blame] | 394 | Set<Label> toolchainDependencyErrors = |
jcater | 1f72416 | 2018-08-27 09:16:01 -0700 | [diff] [blame] | 395 | Streams.stream(cvce.getRootCauses()) |
| 396 | .map(Cause::getLabel) |
| 397 | .filter(l -> finalUnloadedToolchainContext.resolvedToolchainLabels().contains(l)) |
| 398 | .collect(ImmutableSet.toImmutableSet()); |
| 399 | |
John Cater | 3a0ce77 | 2017-08-09 21:09:53 +0200 | [diff] [blame] | 400 | if (!toolchainDependencyErrors.isEmpty()) { |
| 401 | env.getListener() |
| 402 | .handle( |
| 403 | Event.error( |
| 404 | String.format( |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 405 | "XXX - While resolving toolchains for target %s: %s", |
John Cater | 3a0ce77 | 2017-08-09 21:09:53 +0200 | [diff] [blame] | 406 | target.getLabel(), e.getCause().getMessage()))); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | throw new ConfiguredTargetFunctionException(cvce); |
Dmitry Lomov | d83af9e | 2017-02-23 15:44:23 +0000 | [diff] [blame] | 411 | } else if (e.getCause() instanceof InconsistentAspectOrderException) { |
| 412 | InconsistentAspectOrderException cause = (InconsistentAspectOrderException) e.getCause(); |
| 413 | throw new ConfiguredTargetFunctionException( |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 414 | new ConfiguredValueCreationException( |
| 415 | cause.getMessage(), target.getLabel(), configuration)); |
John Cater | 3a0ce77 | 2017-08-09 21:09:53 +0200 | [diff] [blame] | 416 | } else if (e.getCause() instanceof InvalidConfigurationException) { |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 417 | InvalidConfigurationException cause = (InvalidConfigurationException) e.getCause(); |
cparsons | f3ad303 | 2017-08-30 19:34:29 +0200 | [diff] [blame] | 418 | env.getListener().handle(Event.error(cause.getMessage())); |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 419 | throw new ConfiguredTargetFunctionException( |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 420 | new ConfiguredValueCreationException( |
| 421 | cause.getMessage(), target.getLabel(), configuration)); |
juliexxia | 03ff878 | 2019-03-20 13:03:27 -0700 | [diff] [blame] | 422 | } else if (e.getCause() instanceof TransitionException) { |
| 423 | TransitionException cause = (TransitionException) e.getCause(); |
| 424 | env.getListener().handle(Event.error(cause.getMessage())); |
| 425 | throw new ConfiguredTargetFunctionException( |
| 426 | new ConfiguredValueCreationException(e.getMessage(), target.getLabel(), configuration)); |
John Cater | 3a0ce77 | 2017-08-09 21:09:53 +0200 | [diff] [blame] | 427 | } else { |
| 428 | // Unknown exception type. |
| 429 | throw new ConfiguredTargetFunctionException( |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 430 | new ConfiguredValueCreationException(e.getMessage(), target.getLabel(), configuration)); |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 431 | } |
Marian Lobur | fc567b3 | 2015-09-14 08:44:25 +0000 | [diff] [blame] | 432 | } catch (AspectCreationException e) { |
| 433 | throw new ConfiguredTargetFunctionException( |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 434 | new ConfiguredValueCreationException( |
| 435 | e.getMessage(), |
| 436 | configuration, |
| 437 | e.getCauses())); |
John Cater | 76b6f20 | 2018-07-10 08:43:04 -0700 | [diff] [blame] | 438 | } catch (ToolchainException e) { |
John Cater | 535daee | 2017-08-04 22:44:03 +0200 | [diff] [blame] | 439 | // We need to throw a ConfiguredValueCreationException, so either find one or make one. |
John Cater | e39e5c9 | 2019-04-23 10:28:02 -0700 | [diff] [blame] | 440 | ConfiguredValueCreationException cvce = e.asConfiguredValueCreationException(); |
| 441 | if (cvce == null) { |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 442 | cvce = |
John Cater | 76b6f20 | 2018-07-10 08:43:04 -0700 | [diff] [blame] | 443 | new ConfiguredValueCreationException(e.getMessage(), target.getLabel(), configuration); |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 444 | } |
John Cater | 535daee | 2017-08-04 22:44:03 +0200 | [diff] [blame] | 445 | |
| 446 | env.getListener() |
| 447 | .handle( |
| 448 | Event.error( |
| 449 | String.format( |
| 450 | "While resolving toolchains for target %s: %s", |
John Cater | 76b6f20 | 2018-07-10 08:43:04 -0700 | [diff] [blame] | 451 | target.getLabel(), e.getMessage()))); |
John Cater | 535daee | 2017-08-04 22:44:03 +0200 | [diff] [blame] | 452 | throw new ConfiguredTargetFunctionException(cvce); |
Janak Ramakrishnan | bede7b4 | 2016-11-17 18:34:08 +0000 | [diff] [blame] | 453 | } finally { |
| 454 | cpuBoundSemaphore.release(); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 455 | } |
| 456 | } |
| 457 | |
| 458 | /** |
John Cater | ee45c66 | 2018-06-05 11:09:01 -0700 | [diff] [blame] | 459 | * Returns the target-specific execution platform constraints, based on the rule definition and |
| 460 | * any constraints added by the target. |
| 461 | */ |
John Cater | 9a849c6 | 2019-04-25 07:03:41 -0700 | [diff] [blame] | 462 | public static ImmutableSet<Label> getExecutionPlatformConstraints(Rule rule) { |
John Cater | ee45c66 | 2018-06-05 11:09:01 -0700 | [diff] [blame] | 463 | NonconfigurableAttributeMapper mapper = NonconfigurableAttributeMapper.of(rule); |
| 464 | ImmutableSet.Builder<Label> execConstraintLabels = new ImmutableSet.Builder<>(); |
| 465 | |
| 466 | execConstraintLabels.addAll(rule.getRuleClassObject().getExecutionPlatformConstraints()); |
| 467 | |
| 468 | if (rule.getRuleClassObject().executionPlatformConstraintsAllowed() |
| 469 | == ExecutionPlatformConstraintsAllowed.PER_TARGET) { |
| 470 | execConstraintLabels.addAll( |
John Cater | ae6f7d5 | 2019-04-12 10:42:59 -0700 | [diff] [blame] | 471 | mapper.get(RuleClass.EXEC_COMPATIBLE_WITH_ATTR, BuildType.LABEL_LIST)); |
John Cater | ee45c66 | 2018-06-05 11:09:01 -0700 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | return execConstraintLabels.build(); |
| 475 | } |
| 476 | |
| 477 | /** |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 478 | * Computes the direct dependencies of a node in the configured target graph (a configured target |
| 479 | * or an aspects). |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 480 | * |
| 481 | * <p>Returns null if Skyframe hasn't evaluated the required dependencies yet. In this case, the |
| 482 | * caller should also return null to Skyframe. |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 483 | * |
| 484 | * @param env the Skyframe environment |
Greg Estren | 86045da | 2016-12-14 19:46:48 +0000 | [diff] [blame] | 485 | * @param resolver the dependency resolver |
| 486 | * @param ctgValue the label and the configuration of the node |
Dmitry Lomov | ca9bfa4 | 2016-11-15 13:22:36 +0000 | [diff] [blame] | 487 | * @param aspects |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 488 | * @param configConditions the configuration conditions for evaluating the attributes of the node |
John Cater | ae4e785 | 2018-07-09 15:02:42 -0700 | [diff] [blame] | 489 | * @param toolchainLabels labels of required toolchain dependencies |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 490 | * @param ruleClassProvider rule class provider for determining the right configuration fragments |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 491 | * to apply to deps |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 492 | * @param hostConfiguration the host configuration. There's a noticeable performance hit from |
| 493 | * instantiating this on demand for every dependency that wants it, so it's best to compute |
| 494 | * the host configuration as early as possible and pass this reference to all consumers |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 495 | * @param defaultBuildOptions the default build options provided by the server; these are used to |
| 496 | * create diffs for {@link BuildConfigurationValue.Key}s to prevent storing the entire |
| 497 | * BuildOptions object. |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 498 | */ |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 499 | @Nullable |
lberki | 102256f | 2019-02-08 01:34:23 -0800 | [diff] [blame] | 500 | static OrderedSetMultimap<DependencyKind, ConfiguredTargetAndData> computeDependencies( |
Dmitry Lomov | 6231d08 | 2015-11-02 17:17:20 +0000 | [diff] [blame] | 501 | Environment env, |
| 502 | SkyframeDependencyResolver resolver, |
| 503 | TargetAndConfiguration ctgValue, |
Dmitry Lomov | ca9bfa4 | 2016-11-15 13:22:36 +0000 | [diff] [blame] | 504 | Iterable<Aspect> aspects, |
Lukacs Berki | 7894c18 | 2016-05-10 12:07:01 +0000 | [diff] [blame] | 505 | ImmutableMap<Label, ConfigMatchingProvider> configConditions, |
John Cater | ae4e785 | 2018-07-09 15:02:42 -0700 | [diff] [blame] | 506 | ImmutableSet<Label> toolchainLabels, |
Dmitry Lomov | 6231d08 | 2015-11-02 17:17:20 +0000 | [diff] [blame] | 507 | RuleClassProvider ruleClassProvider, |
| 508 | BuildConfiguration hostConfiguration, |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 509 | @Nullable NestedSetBuilder<Package> transitivePackagesForPackageRootResolution, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 510 | NestedSetBuilder<Cause> transitiveRootCauses, |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 511 | BuildOptions defaultBuildOptions) |
Dmitry Lomov | 9b2fc5c | 2016-11-11 11:18:48 +0000 | [diff] [blame] | 512 | throws DependencyEvaluationException, ConfiguredTargetFunctionException, |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 513 | AspectCreationException, InterruptedException { |
Greg Estren | d535325 | 2016-08-11 22:13:31 +0000 | [diff] [blame] | 514 | // Create the map from attributes to set of (target, configuration) pairs. |
lberki | 102256f | 2019-02-08 01:34:23 -0800 | [diff] [blame] | 515 | OrderedSetMultimap<DependencyKind, Dependency> depValueNames; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 516 | try { |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 517 | depValueNames = |
| 518 | resolver.dependentNodeMap( |
| 519 | ctgValue, |
| 520 | hostConfiguration, |
| 521 | aspects, |
| 522 | configConditions, |
John Cater | ae4e785 | 2018-07-09 15:02:42 -0700 | [diff] [blame] | 523 | toolchainLabels, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 524 | transitiveRootCauses, |
mstaib | 4a07a47 | 2018-04-19 14:16:41 -0700 | [diff] [blame] | 525 | ((ConfiguredRuleClassProvider) ruleClassProvider).getTrimmingTransitionFactory()); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 526 | } catch (EvalException e) { |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 527 | // EvalException can only be thrown by computed Skylark attributes in the current rule. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 528 | env.getListener().handle(Event.error(e.getLocation(), e.getMessage())); |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 529 | throw new DependencyEvaluationException( |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 530 | new ConfiguredValueCreationException( |
| 531 | e.print(), ctgValue.getLabel(), ctgValue.getConfiguration())); |
Dmitry Lomov | d83af9e | 2017-02-23 15:44:23 +0000 | [diff] [blame] | 532 | } catch (InconsistentAspectOrderException e) { |
| 533 | env.getListener().handle(Event.error(e.getLocation(), e.getMessage())); |
| 534 | throw new DependencyEvaluationException(e); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 535 | } |
| 536 | |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 537 | // Trim each dep's configuration so it only includes the fragments needed by its transitive |
gregce | 5bae50a | 2017-08-17 23:23:47 +0200 | [diff] [blame] | 538 | // closure. |
lberki | afc82e0 | 2019-03-12 01:57:26 -0700 | [diff] [blame] | 539 | depValueNames = |
| 540 | ConfigurationResolver.resolveConfigurations( |
| 541 | env, |
| 542 | ctgValue, |
| 543 | depValueNames, |
| 544 | hostConfiguration, |
| 545 | ruleClassProvider, |
| 546 | defaultBuildOptions); |
Googler | 8f16879 | 2018-07-09 01:36:01 -0700 | [diff] [blame] | 547 | |
| 548 | // Return early in case packages were not loaded yet. In theory, we could start configuring |
| 549 | // dependent targets in loaded packages. However, that creates an artificial sync boundary |
| 550 | // between loading all dependent packages (fast) and configuring some dependent targets (can |
| 551 | // have a long tail). |
| 552 | if (env.valuesMissing()) { |
| 553 | return null; |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 554 | } |
| 555 | |
| 556 | // Resolve configured target dependencies and handle errors. |
janakr | 9c10140 | 2018-03-10 06:48:59 -0800 | [diff] [blame] | 557 | Map<SkyKey, ConfiguredTargetAndData> depValues = |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 558 | resolveConfiguredTargetDependencies( |
| 559 | env, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 560 | ctgValue, |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 561 | depValueNames.values(), |
| 562 | transitivePackagesForPackageRootResolution, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 563 | transitiveRootCauses); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 564 | if (depValues == null) { |
| 565 | return null; |
| 566 | } |
| 567 | |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 568 | // Resolve required aspects. |
gregce | 4c3ef11 | 2017-09-20 23:43:14 +0200 | [diff] [blame] | 569 | OrderedSetMultimap<Dependency, ConfiguredAspect> depAspects = |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 570 | AspectResolver.resolveAspectDependencies( |
| 571 | env, depValues, depValueNames.values(), transitivePackagesForPackageRootResolution); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 572 | if (depAspects == null) { |
| 573 | return null; |
| 574 | } |
| 575 | |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 576 | // Merge the dependent configured targets and aspects into a single map. |
Dmitry Lomov | 9b2fc5c | 2016-11-11 11:18:48 +0000 | [diff] [blame] | 577 | try { |
gregce | 4c3ef11 | 2017-09-20 23:43:14 +0200 | [diff] [blame] | 578 | return AspectResolver.mergeAspects(depValueNames, depValues, depAspects); |
Dmitry Lomov | 9b2fc5c | 2016-11-11 11:18:48 +0000 | [diff] [blame] | 579 | } catch (DuplicateException e) { |
| 580 | env.getListener().handle( |
| 581 | Event.error(ctgValue.getTarget().getLocation(), e.getMessage())); |
| 582 | |
| 583 | throw new ConfiguredTargetFunctionException( |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 584 | new ConfiguredValueCreationException( |
| 585 | e.getMessage(), ctgValue.getLabel(), ctgValue.getConfiguration())); |
Dmitry Lomov | 9b2fc5c | 2016-11-11 11:18:48 +0000 | [diff] [blame] | 586 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 587 | } |
| 588 | |
| 589 | /** |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 590 | * Returns the set of {@link ConfigMatchingProvider}s that key the configurable attributes used by |
| 591 | * this rule. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 592 | * |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 593 | * <p>>If the configured targets supplying those providers aren't yet resolved by the dependency |
| 594 | * resolver, returns null. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 595 | */ |
| 596 | @Nullable |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 597 | static ImmutableMap<Label, ConfigMatchingProvider> getConfigConditions( |
| 598 | Target target, |
| 599 | Environment env, |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 600 | TargetAndConfiguration ctgValue, |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 601 | @Nullable NestedSetBuilder<Package> transitivePackagesForPackageRootResolution, |
lberki | c67dcec | 2019-01-17 11:24:01 -0800 | [diff] [blame] | 602 | NestedSetBuilder<Cause> transitiveRootCauses) |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 603 | throws DependencyEvaluationException, InterruptedException { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 604 | if (!(target instanceof Rule)) { |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 605 | return NO_CONFIG_CONDITIONS; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 606 | } |
gregce | 749962a | 2019-03-08 12:47:34 -0800 | [diff] [blame] | 607 | RawAttributeMapper attrs = RawAttributeMapper.of(((Rule) target)); |
| 608 | if (!attrs.has(RuleClass.CONFIG_SETTING_DEPS_ATTRIBUTE)) { |
| 609 | return NO_CONFIG_CONDITIONS; |
| 610 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 611 | |
| 612 | // Collect the labels of the configured targets we need to resolve. |
gregce | 749962a | 2019-03-08 12:47:34 -0800 | [diff] [blame] | 613 | List<Label> configLabels = |
| 614 | attrs.get(RuleClass.CONFIG_SETTING_DEPS_ATTRIBUTE, BuildType.LABEL_LIST).stream() |
| 615 | .map(configLabel -> target.getLabel().resolveRepositoryRelative(configLabel)) |
| 616 | .collect(Collectors.toList()); |
| 617 | if (configLabels.isEmpty()) { |
Ulf Adams | 2ac2096 | 2016-02-01 13:04:54 +0000 | [diff] [blame] | 618 | return NO_CONFIG_CONDITIONS; |
mstaib | 6e2cfe9 | 2019-04-23 17:50:11 -0700 | [diff] [blame] | 619 | } else if (ctgValue.getConfiguration().trimConfigurationsRetroactively()) { |
| 620 | String message = |
| 621 | target.getLabel() |
| 622 | + " has configurable attributes, but these are not supported in retroactive trimming " |
| 623 | + "mode."; |
| 624 | env.getListener().handle(Event.error(TargetUtils.getLocationMaybe(target), message)); |
| 625 | throw new DependencyEvaluationException( |
| 626 | new ConfiguredValueCreationException( |
| 627 | message, ctgValue.getLabel(), ctgValue.getConfiguration())); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 628 | } |
| 629 | |
lberki | a1f2ddb | 2019-03-04 23:43:25 -0800 | [diff] [blame] | 630 | // Collect the actual deps without a configuration transition (since by definition config |
| 631 | // conditions evaluate over the current target's configuration). If the dependency is |
| 632 | // (erroneously) something that needs the null configuration, its analysis will be |
| 633 | // short-circuited. That error will be reported later. |
gregce | 15e0fa8 | 2018-05-30 07:31:48 -0700 | [diff] [blame] | 634 | ImmutableList.Builder<Dependency> depsBuilder = ImmutableList.builder(); |
gregce | 749962a | 2019-03-08 12:47:34 -0800 | [diff] [blame] | 635 | for (Label configurabilityLabel : configLabels) { |
lberki | a1f2ddb | 2019-03-04 23:43:25 -0800 | [diff] [blame] | 636 | Dependency configurabilityDependency = |
| 637 | Dependency.withConfiguration(configurabilityLabel, ctgValue.getConfiguration()); |
lberki | c67dcec | 2019-01-17 11:24:01 -0800 | [diff] [blame] | 638 | depsBuilder.add(configurabilityDependency); |
Dmitry Lomov | d83af9e | 2017-02-23 15:44:23 +0000 | [diff] [blame] | 639 | } |
lberki | c67dcec | 2019-01-17 11:24:01 -0800 | [diff] [blame] | 640 | |
gregce | 15e0fa8 | 2018-05-30 07:31:48 -0700 | [diff] [blame] | 641 | ImmutableList<Dependency> configConditionDeps = depsBuilder.build(); |
Greg Estren | 0004943 | 2015-08-25 16:43:47 +0000 | [diff] [blame] | 642 | |
janakr | 9c10140 | 2018-03-10 06:48:59 -0800 | [diff] [blame] | 643 | Map<SkyKey, ConfiguredTargetAndData> configValues = |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 644 | resolveConfiguredTargetDependencies( |
| 645 | env, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 646 | ctgValue, |
gregce | 15e0fa8 | 2018-05-30 07:31:48 -0700 | [diff] [blame] | 647 | configConditionDeps, |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 648 | transitivePackagesForPackageRootResolution, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 649 | transitiveRootCauses); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 650 | if (configValues == null) { |
| 651 | return null; |
| 652 | } |
| 653 | |
gregce | 749962a | 2019-03-08 12:47:34 -0800 | [diff] [blame] | 654 | Map<Label, ConfigMatchingProvider> configConditions = new LinkedHashMap<>(); |
| 655 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 656 | // Get the configured targets as ConfigMatchingProvider interfaces. |
gregce | 15e0fa8 | 2018-05-30 07:31:48 -0700 | [diff] [blame] | 657 | for (Dependency entry : configConditionDeps) { |
dslomov | ddc180a | 2017-07-14 11:34:24 +0200 | [diff] [blame] | 658 | SkyKey baseKey = ConfiguredTargetValue.key(entry.getLabel(), entry.getConfiguration()); |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 659 | ConfiguredTarget value = configValues.get(baseKey).getConfiguredTarget(); |
lberki | c67dcec | 2019-01-17 11:24:01 -0800 | [diff] [blame] | 660 | // The code above guarantees that value is non-null here and since the rule is a |
| 661 | // config_setting, provider must also be non-null. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 662 | ConfigMatchingProvider provider = value.getProvider(ConfigMatchingProvider.class); |
| 663 | if (provider != null) { |
Lukacs Berki | 7894c18 | 2016-05-10 12:07:01 +0000 | [diff] [blame] | 664 | configConditions.put(entry.getLabel(), provider); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 665 | } else { |
| 666 | // Not a valid provider for configuration conditions. |
| 667 | String message = |
| 668 | entry.getLabel() + " is not a valid configuration key for " + target.getLabel(); |
| 669 | env.getListener().handle(Event.error(TargetUtils.getLocationMaybe(target), message)); |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 670 | throw new DependencyEvaluationException( |
| 671 | new ConfiguredValueCreationException( |
| 672 | message, ctgValue.getLabel(), ctgValue.getConfiguration())); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 673 | } |
| 674 | } |
| 675 | |
Lukacs Berki | 7894c18 | 2016-05-10 12:07:01 +0000 | [diff] [blame] | 676 | return ImmutableMap.copyOf(configConditions); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 677 | } |
| 678 | |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 679 | /** |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 680 | * Resolves the targets referenced in depValueNames and returns their {@link |
janakr | 9c10140 | 2018-03-10 06:48:59 -0800 | [diff] [blame] | 681 | * ConfiguredTargetAndData} instances. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 682 | * |
| 683 | * <p>Returns null if not all instances are available yet. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 684 | */ |
| 685 | @Nullable |
janakr | 9c10140 | 2018-03-10 06:48:59 -0800 | [diff] [blame] | 686 | private static Map<SkyKey, ConfiguredTargetAndData> resolveConfiguredTargetDependencies( |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 687 | Environment env, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 688 | TargetAndConfiguration ctgValue, |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 689 | Collection<Dependency> deps, |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 690 | @Nullable NestedSetBuilder<Package> transitivePackagesForPackageRootResolution, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 691 | NestedSetBuilder<Cause> transitiveRootCauses) |
Janak Ramakrishnan | 3c0adb2 | 2016-08-15 21:54:55 +0000 | [diff] [blame] | 692 | throws DependencyEvaluationException, InterruptedException { |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 693 | boolean missedValues = env.valuesMissing(); |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 694 | String failWithMessage = null; |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 695 | // Naively we would like to just fetch all requested ConfiguredTargets, together with their |
| 696 | // Packages. However, some ConfiguredTargets are AliasConfiguredTargets, which means that their |
| 697 | // associated Targets (and therefore associated Packages) don't correspond to their own Labels. |
| 698 | // We don't know the associated Package until we fetch the ConfiguredTarget. Therefore, we have |
| 699 | // to do a potential second pass, in which we fetch all the Packages for AliasConfiguredTargets. |
| 700 | Iterable<SkyKey> depKeys = |
| 701 | Iterables.concat( |
| 702 | Iterables.transform( |
| 703 | deps, |
| 704 | input -> ConfiguredTargetValue.key(input.getLabel(), input.getConfiguration())), |
| 705 | Iterables.transform( |
| 706 | deps, input -> PackageValue.key(input.getLabel().getPackageIdentifier()))); |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 707 | Map<SkyKey, ValueOrException<ConfiguredValueCreationException>> depValuesOrExceptions = |
gregce | f19fcfe | 2017-06-02 16:04:07 -0400 | [diff] [blame] | 708 | env.getValuesOrThrow(depKeys, ConfiguredValueCreationException.class); |
janakr | 9c10140 | 2018-03-10 06:48:59 -0800 | [diff] [blame] | 709 | Map<SkyKey, ConfiguredTargetAndData> result = Maps.newHashMapWithExpectedSize(deps.size()); |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 710 | Set<SkyKey> aliasPackagesToFetch = new HashSet<>(); |
| 711 | List<Dependency> aliasDepsToRedo = new ArrayList<>(); |
| 712 | Map<SkyKey, SkyValue> aliasPackageValues = null; |
| 713 | Collection<Dependency> depsToProcess = deps; |
| 714 | for (int i = 0; i < 2; i++) { |
| 715 | for (Dependency dep : depsToProcess) { |
| 716 | SkyKey key = ConfiguredTargetValue.key(dep.getLabel(), dep.getConfiguration()); |
| 717 | try { |
| 718 | ConfiguredTargetValue depValue = |
| 719 | (ConfiguredTargetValue) depValuesOrExceptions.get(key).get(); |
| 720 | |
| 721 | if (depValue == null) { |
| 722 | missedValues = true; |
| 723 | } else { |
| 724 | ConfiguredTarget depCt = depValue.getConfiguredTarget(); |
| 725 | Label depLabel = depCt.getLabel(); |
| 726 | SkyKey packageKey = PackageValue.key(depLabel.getPackageIdentifier()); |
| 727 | PackageValue pkgValue; |
| 728 | if (i == 0) { |
| 729 | ValueOrException<ConfiguredValueCreationException> packageResult = |
| 730 | depValuesOrExceptions.get(packageKey); |
| 731 | if (packageResult == null) { |
| 732 | aliasPackagesToFetch.add(packageKey); |
| 733 | aliasDepsToRedo.add(dep); |
| 734 | continue; |
| 735 | } else { |
janakr | 169e707 | 2019-03-14 09:18:31 -0700 | [diff] [blame] | 736 | pkgValue = (PackageValue) packageResult.get(); |
| 737 | if (pkgValue == null) { |
| 738 | // In a race, the getValuesOrThrow call above may have retrieved the package |
janakr | 9c0a633 | 2019-04-12 16:21:54 -0700 | [diff] [blame] | 739 | // before it was done but the configured target after it was done. Since |
| 740 | // SkyFunctionEnvironment may cache absent values, re-requesting it on this |
| 741 | // evaluation may be useless, just treat it as missing. |
| 742 | missedValues = true; |
| 743 | continue; |
janakr | 169e707 | 2019-03-14 09:18:31 -0700 | [diff] [blame] | 744 | } |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 745 | } |
| 746 | } else { |
| 747 | // We were doing AliasConfiguredTarget mop-up. |
| 748 | pkgValue = (PackageValue) aliasPackageValues.get(packageKey); |
| 749 | if (pkgValue == null) { |
| 750 | // This is unexpected: on the second iteration, all packages should be present, |
| 751 | // since the configured targets that depend on them are present. But since that is |
| 752 | // not a guarantee Skyframe makes, we tolerate their absence. |
| 753 | missedValues = true; |
| 754 | continue; |
| 755 | } |
| 756 | } |
| 757 | try { |
mstaib | dc242d4 | 2019-04-18 10:20:13 -0700 | [diff] [blame] | 758 | BuildConfiguration depConfiguration = dep.getConfiguration(); |
| 759 | BuildConfigurationValue.Key depKey = |
| 760 | depValue.getConfiguredTarget().getConfigurationKey(); |
| 761 | // Retroactive trimming may change the configuration associated with the dependency. |
| 762 | // If it does, we need to get that instance. |
| 763 | // TODO(mstaib): doing these individually instead of doing them all at once may end up |
| 764 | // being wasteful use of Skyframe. Although these configurations are guaranteed to be |
| 765 | // in the Skyframe cache (because the dependency would have had to retrieve them to be |
| 766 | // created in the first place), looking them up repeatedly may be slower than just |
| 767 | // keeping a local cache and assigning the same configuration to all the CTs which |
| 768 | // need it. Profile this and see if there's a better way. |
| 769 | if (depKey != null && !depKey.equals(BuildConfigurationValue.key(depConfiguration))) { |
| 770 | if (!depConfiguration.trimConfigurationsRetroactively()) { |
| 771 | throw new AssertionError( |
| 772 | "Loading configurations mid-dependency resolution should ONLY happen when " |
| 773 | + "retroactive trimming is enabled."); |
| 774 | } |
| 775 | depConfiguration = |
| 776 | ((BuildConfigurationValue) env.getValue(depKey)).getConfiguration(); |
| 777 | } |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 778 | result.put( |
| 779 | key, |
janakr | 9c10140 | 2018-03-10 06:48:59 -0800 | [diff] [blame] | 780 | new ConfiguredTargetAndData( |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 781 | depValue.getConfiguredTarget(), |
janakr | 9c10140 | 2018-03-10 06:48:59 -0800 | [diff] [blame] | 782 | pkgValue.getPackage().getTarget(depLabel.getName()), |
mstaib | dc242d4 | 2019-04-18 10:20:13 -0700 | [diff] [blame] | 783 | depConfiguration)); |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 784 | } catch (NoSuchTargetException e) { |
| 785 | throw new IllegalStateException("Target already verified for " + dep, e); |
| 786 | } |
| 787 | if (transitivePackagesForPackageRootResolution != null) { |
| 788 | transitivePackagesForPackageRootResolution.addTransitive( |
| 789 | depValue.getTransitivePackagesForPackageRootResolution()); |
| 790 | } |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 791 | } |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 792 | } catch (ConfiguredValueCreationException e) { |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 793 | transitiveRootCauses.addTransitive(e.rootCauses); |
| 794 | failWithMessage = e.getMessage(); |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 795 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 796 | } |
janakr | f3e6f25 | 2018-01-18 07:45:12 -0800 | [diff] [blame] | 797 | if (aliasDepsToRedo.isEmpty()) { |
| 798 | break; |
| 799 | } |
| 800 | aliasPackageValues = env.getValues(aliasPackagesToFetch); |
| 801 | depsToProcess = aliasDepsToRedo; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 802 | } |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 803 | if (missedValues) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 804 | return null; |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 805 | } else if (failWithMessage != null) { |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 806 | throw new DependencyEvaluationException( |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 807 | new ConfiguredValueCreationException( |
| 808 | failWithMessage, ctgValue.getConfiguration(), transitiveRootCauses.build())); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 809 | } else { |
Ulf Adams | 7cb66de | 2016-01-14 08:46:43 +0000 | [diff] [blame] | 810 | return result; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 811 | } |
| 812 | } |
| 813 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 814 | @Override |
| 815 | public String extractTag(SkyKey skyKey) { |
| 816 | return Label.print(((ConfiguredTargetKey) skyKey.argument()).getLabel()); |
| 817 | } |
| 818 | |
| 819 | @Nullable |
John Cater | 2e56f06 | 2017-07-20 19:43:20 +0200 | [diff] [blame] | 820 | private ConfiguredTargetValue createConfiguredTarget( |
| 821 | SkyframeBuildView view, |
| 822 | Environment env, |
| 823 | Target target, |
| 824 | BuildConfiguration configuration, |
janakr | eaff19c | 2019-01-31 13:59:40 -0800 | [diff] [blame] | 825 | ConfiguredTargetKey configuredTargetKey, |
lberki | 102256f | 2019-02-08 01:34:23 -0800 | [diff] [blame] | 826 | OrderedSetMultimap<DependencyKind, ConfiguredTargetAndData> depValueMap, |
Lukacs Berki | 7894c18 | 2016-05-10 12:07:01 +0000 | [diff] [blame] | 827 | ImmutableMap<Label, ConfigMatchingProvider> configConditions, |
John Cater | cdfa9ca | 2019-04-05 12:32:09 -0700 | [diff] [blame] | 828 | @Nullable ResolvedToolchainContext toolchainContext, |
janakr | 931d285 | 2017-12-15 13:48:29 -0800 | [diff] [blame] | 829 | @Nullable NestedSetBuilder<Package> transitivePackagesForPackageRootResolution) |
Greg Estren | 9eb1cf0 | 2015-06-26 22:18:35 +0000 | [diff] [blame] | 830 | throws ConfiguredTargetFunctionException, InterruptedException { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 831 | StoredEventHandler events = new StoredEventHandler(); |
janakr | 573807d | 2018-01-11 14:02:35 -0800 | [diff] [blame] | 832 | CachingAnalysisEnvironment analysisEnvironment = |
| 833 | view.createAnalysisEnvironment( |
gregce | d56e958 | 2018-06-15 13:23:34 -0700 | [diff] [blame] | 834 | ConfiguredTargetKey.of(target.getLabel(), configuration), |
janakr | 573807d | 2018-01-11 14:02:35 -0800 | [diff] [blame] | 835 | false, |
| 836 | events, |
| 837 | env, |
| 838 | configuration); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 839 | if (env.valuesMissing()) { |
| 840 | return null; |
| 841 | } |
| 842 | |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 843 | Preconditions.checkNotNull(depValueMap); |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 844 | ConfiguredTarget configuredTarget; |
| 845 | try { |
| 846 | configuredTarget = |
| 847 | view.createConfiguredTarget( |
| 848 | target, |
| 849 | configuration, |
| 850 | analysisEnvironment, |
janakr | eaff19c | 2019-01-31 13:59:40 -0800 | [diff] [blame] | 851 | configuredTargetKey, |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 852 | depValueMap, |
| 853 | configConditions, |
| 854 | toolchainContext); |
| 855 | } catch (ActionConflictException e) { |
| 856 | throw new ConfiguredTargetFunctionException(e); |
| 857 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 858 | |
| 859 | events.replayOn(env.getListener()); |
| 860 | if (events.hasErrors()) { |
| 861 | analysisEnvironment.disable(target); |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 862 | NestedSet<Cause> rootCauses = NestedSetBuilder.wrap( |
| 863 | Order.STABLE_ORDER, |
| 864 | events.getEvents().stream() |
| 865 | .filter((event) -> event.getKind() == EventKind.ERROR) |
| 866 | .map((event) -> |
| 867 | new AnalysisFailedCause( |
| 868 | target.getLabel(), |
| 869 | ConfiguredValueCreationException.toId(configuration), |
| 870 | event.getMessage())) |
| 871 | .collect(Collectors.toList())); |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 872 | throw new ConfiguredTargetFunctionException( |
| 873 | new ConfiguredValueCreationException( |
| 874 | "Analysis of target '" + target.getLabel() + "' failed; build aborted", |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 875 | configuration, |
| 876 | rootCauses)); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 877 | } |
| 878 | Preconditions.checkState(!analysisEnvironment.hasErrors(), |
| 879 | "Analysis environment hasError() but no errors reported"); |
| 880 | if (env.valuesMissing()) { |
| 881 | return null; |
| 882 | } |
| 883 | |
| 884 | analysisEnvironment.disable(target); |
| 885 | Preconditions.checkNotNull(configuredTarget, target); |
| 886 | |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 887 | if (configuredTarget instanceof RuleConfiguredTarget) { |
| 888 | RuleConfiguredTarget ruleConfiguredTarget = (RuleConfiguredTarget) configuredTarget; |
| 889 | return new RuleConfiguredTargetValue( |
| 890 | ruleConfiguredTarget, |
| 891 | transitivePackagesForPackageRootResolution == null |
| 892 | ? null |
janakr | a81bb95 | 2019-01-28 17:30:06 -0800 | [diff] [blame] | 893 | : transitivePackagesForPackageRootResolution.build(), |
| 894 | nonceVersion.get()); |
cparsons | e2d200f | 2018-03-06 16:15:11 -0800 | [diff] [blame] | 895 | } else { |
| 896 | GeneratingActions generatingActions; |
| 897 | // Check for conflicting actions within this configured target (that indicates a bug in the |
| 898 | // rule implementation). |
| 899 | try { |
| 900 | generatingActions = |
| 901 | Actions.filterSharedActionsAndThrowActionConflict( |
| 902 | analysisEnvironment.getActionKeyContext(), |
| 903 | analysisEnvironment.getRegisteredActions()); |
| 904 | } catch (ActionConflictException e) { |
| 905 | throw new ConfiguredTargetFunctionException(e); |
| 906 | } |
| 907 | return new NonRuleConfiguredTargetValue( |
| 908 | configuredTarget, |
| 909 | generatingActions, |
| 910 | transitivePackagesForPackageRootResolution == null |
| 911 | ? null |
janakr | a81bb95 | 2019-01-28 17:30:06 -0800 | [diff] [blame] | 912 | : transitivePackagesForPackageRootResolution.build(), |
| 913 | nonceVersion.get()); |
Janak Ramakrishnan | b3a6ca7 | 2015-03-27 20:07:28 +0000 | [diff] [blame] | 914 | } |
| 915 | } |
| 916 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 917 | /** |
janakr | 00408d6 | 2018-03-24 17:22:23 -0700 | [diff] [blame] | 918 | * An exception indicating that there was a problem during the construction of a |
| 919 | * ConfiguredTargetValue. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 920 | */ |
janakr | 00408d6 | 2018-03-24 17:22:23 -0700 | [diff] [blame] | 921 | @AutoCodec |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 922 | public static final class ConfiguredValueCreationException extends Exception { |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 923 | private static ConfigurationId toId(BuildConfiguration config) { |
| 924 | return config == null ? null : config.getEventId().asStreamProto().getConfiguration(); |
janakr | 00408d6 | 2018-03-24 17:22:23 -0700 | [diff] [blame] | 925 | } |
| 926 | |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 927 | @Nullable private final BuildEventId configuration; |
| 928 | private final NestedSet<Cause> rootCauses; |
| 929 | |
janakr | 00408d6 | 2018-03-24 17:22:23 -0700 | [diff] [blame] | 930 | @AutoCodec.VisibleForSerialization |
| 931 | @AutoCodec.Instantiator |
| 932 | ConfiguredValueCreationException( |
| 933 | String message, |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 934 | @Nullable BuildEventId configuration, |
| 935 | NestedSet<Cause> rootCauses) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 936 | super(message); |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 937 | this.rootCauses = rootCauses; |
janakr | 00408d6 | 2018-03-24 17:22:23 -0700 | [diff] [blame] | 938 | this.configuration = configuration; |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 939 | } |
| 940 | |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 941 | private ConfiguredValueCreationException( |
| 942 | String message, Label currentTarget, @Nullable BuildConfiguration configuration) { |
| 943 | this( |
| 944 | message, |
| 945 | configuration == null ? null : configuration.getEventId(), |
| 946 | NestedSetBuilder.<Cause>stableOrder() |
| 947 | .add(new AnalysisFailedCause(currentTarget, toId(configuration), message)) |
| 948 | .build()); |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 949 | } |
| 950 | |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 951 | private ConfiguredValueCreationException( |
| 952 | String message, @Nullable BuildConfiguration configuration, NestedSet<Cause> rootCauses) { |
| 953 | this(message, configuration == null ? null : configuration.getEventId(), rootCauses); |
Ulf Adams | 8490173 | 2016-01-28 15:05:16 +0000 | [diff] [blame] | 954 | } |
| 955 | |
ulfjack | 904a8d6 | 2018-05-29 05:17:35 -0700 | [diff] [blame] | 956 | public NestedSet<Cause> getRootCauses() { |
| 957 | return rootCauses; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 958 | } |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 959 | |
ulfjack | 6192b8c | 2018-05-24 02:40:42 -0700 | [diff] [blame] | 960 | @Nullable public BuildEventId getConfiguration() { |
Klaus Aehlig | fbdeffe | 2018-01-26 02:19:58 -0800 | [diff] [blame] | 961 | return configuration; |
| 962 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 963 | } |
| 964 | |
| 965 | /** |
janakr | b6823b0 | 2019-04-12 13:57:02 -0700 | [diff] [blame] | 966 | * Used to declare all the exception types that can be wrapped in the exception thrown by {@link |
| 967 | * ConfiguredTargetFunction#compute}. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 968 | */ |
janakr | b6823b0 | 2019-04-12 13:57:02 -0700 | [diff] [blame] | 969 | static final class ConfiguredTargetFunctionException extends SkyFunctionException { |
Ulf Adams | 25f03d8 | 2016-01-25 10:31:46 +0000 | [diff] [blame] | 970 | private ConfiguredTargetFunctionException(ConfiguredValueCreationException e) { |
| 971 | super(e, Transience.PERSISTENT); |
Ulf Adams | 3ab82f7 | 2015-09-04 12:10:53 +0000 | [diff] [blame] | 972 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 973 | |
Janak Ramakrishnan | b3a6ca7 | 2015-03-27 20:07:28 +0000 | [diff] [blame] | 974 | private ConfiguredTargetFunctionException(ActionConflictException e) { |
| 975 | super(e, Transience.PERSISTENT); |
| 976 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 977 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 978 | } |