aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ToolchainException.java30
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ToolchainUtil.java170
7 files changed, 107 insertions, 143 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
index 027323239c..4088d3f1fd 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
@@ -65,7 +65,6 @@ import com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.Configure
import com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.DependencyEvaluationException;
import com.google.devtools.build.lib.skyframe.SkyframeExecutor.BuildViewProvider;
import com.google.devtools.build.lib.skyframe.SkylarkImportLookupFunction.SkylarkImportFailedException;
-import com.google.devtools.build.lib.skyframe.ToolchainUtil.ToolchainContextException;
import com.google.devtools.build.lib.syntax.Type.ConversionException;
import com.google.devtools.build.lib.util.OrderedSetMultimap;
import com.google.devtools.build.skyframe.SkyFunction;
@@ -416,7 +415,7 @@ public final class AspectFunction implements SkyFunction {
requiredToolchains,
/* execConstraintLabels= */ ImmutableSet.of(),
key.getAspectConfigurationKey());
- } catch (ToolchainContextException e) {
+ } catch (ToolchainException e) {
// TODO(katre): better error handling
throw new AspectCreationException(
e.getMessage(), new LabelCause(key.getLabel(), e.getMessage()));
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java
index 938ce5e51b..d50c6c80f3 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java
@@ -67,7 +67,6 @@ import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.packages.TargetUtils;
import com.google.devtools.build.lib.skyframe.AspectFunction.AspectCreationException;
import com.google.devtools.build.lib.skyframe.SkyframeExecutor.BuildViewProvider;
-import com.google.devtools.build.lib.skyframe.ToolchainUtil.ToolchainContextException;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.util.OrderedSetMultimap;
@@ -370,15 +369,14 @@ public final class ConfiguredTargetFunction implements SkyFunction {
e.getMessage(),
configuration,
e.getCauses()));
- } catch (ToolchainContextException e) {
+ } catch (ToolchainException e) {
// We need to throw a ConfiguredValueCreationException, so either find one or make one.
ConfiguredValueCreationException cvce;
if (e.getCause() instanceof ConfiguredValueCreationException) {
cvce = (ConfiguredValueCreationException) e.getCause();
} else {
cvce =
- new ConfiguredValueCreationException(
- e.getCause().getMessage(), target.getLabel(), configuration);
+ new ConfiguredValueCreationException(e.getMessage(), target.getLabel(), configuration);
}
env.getListener()
@@ -386,7 +384,7 @@ public final class ConfiguredTargetFunction implements SkyFunction {
Event.error(
String.format(
"While resolving toolchains for target %s: %s",
- target.getLabel(), e.getCause().getMessage())));
+ target.getLabel(), e.getMessage())));
throw new ConfiguredTargetFunctionException(cvce);
} finally {
cpuBoundSemaphore.release();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java
index 5d3b580853..b581130b8b 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java
@@ -172,14 +172,13 @@ public class RegisteredToolchainsFunction implements SkyFunction {
* Used to indicate that the given {@link Label} represents a {@link ConfiguredTarget} which is
* not a valid {@link DeclaredToolchainInfo} provider.
*/
- public static final class InvalidToolchainLabelException extends Exception {
+ public static final class InvalidToolchainLabelException extends ToolchainException {
public InvalidToolchainLabelException(Label invalidLabel) {
super(
- String.format(
- "invalid registered toolchain '%s': "
- + "target does not provide the DeclaredToolchainInfo provider",
- invalidLabel));
+ formatMessage(
+ invalidLabel.getCanonicalForm(),
+ "target does not provide the DeclaredToolchainInfo provider"));
}
public InvalidToolchainLabelException(ToolchainUtil.InvalidTargetPatternException e) {
@@ -187,14 +186,15 @@ public class RegisteredToolchainsFunction implements SkyFunction {
}
public InvalidToolchainLabelException(String invalidPattern, TargetParsingException e) {
- super(
- String.format("invalid registered toolchain '%s': %s", invalidPattern, e.getMessage()),
- e);
+ super(formatMessage(invalidPattern, e.getMessage()), e);
}
public InvalidToolchainLabelException(Label invalidLabel, ConfiguredValueCreationException e) {
- super(
- String.format("invalid registered toolchain '%s': %s", invalidLabel, e.getMessage()), e);
+ super(formatMessage(invalidLabel.getCanonicalForm(), e.getMessage()), e);
+ }
+
+ private static String formatMessage(String invalidPattern, String reason) {
+ return String.format("invalid registered toolchain '%s': %s", invalidPattern, reason);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
index 09f665b8a9..fcd6047e80 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
@@ -131,7 +131,6 @@ import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossReposit
import com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.ActionCompletedReceiver;
import com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.ProgressSupplier;
import com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternKey;
-import com.google.devtools.build.lib.skyframe.ToolchainUtil.ToolchainContextException;
import com.google.devtools.build.lib.syntax.SkylarkSemantics;
import com.google.devtools.build.lib.util.AbruptExitException;
import com.google.devtools.build.lib.util.ResourceUsage;
@@ -952,7 +951,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory {
@VisibleForTesting
public ToolchainContext getToolchainContextForTesting(
Set<Label> requiredToolchains, BuildConfiguration config, ExtendedEventHandler eventHandler)
- throws ToolchainContextException, InterruptedException {
+ throws ToolchainException, InterruptedException {
SkyFunctionEnvironmentForTesting env =
new SkyFunctionEnvironmentForTesting(buildDriver, eventHandler, this);
return ToolchainUtil.createToolchainContext(
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainException.java b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainException.java
new file mode 100644
index 0000000000..cc9db65a3a
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainException.java
@@ -0,0 +1,30 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package com.google.devtools.build.lib.skyframe;
+
+/** Base class for exceptions that happen during toolchain resolution. */
+public class ToolchainException extends Exception {
+
+ public ToolchainException(String message) {
+ super(message);
+ }
+
+ public ToolchainException(Throwable cause) {
+ super(cause);
+ }
+
+ public ToolchainException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java
index 630542b5af..737bbd8982 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java
@@ -28,8 +28,7 @@ import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.packages.NoSuchThingException;
import com.google.devtools.build.lib.skyframe.RegisteredToolchainsFunction.InvalidToolchainLabelException;
-import com.google.devtools.build.lib.skyframe.ToolchainUtil.ToolchainContextException;
-import com.google.devtools.build.lib.syntax.EvalException;
+import com.google.devtools.build.lib.skyframe.ToolchainUtil.InvalidPlatformException;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
@@ -64,15 +63,12 @@ public class ToolchainResolutionFunction implements SkyFunction {
(RegisteredToolchainsValue)
env.getValueOrThrow(
RegisteredToolchainsValue.key(key.configurationKey()),
- InvalidToolchainLabelException.class,
- EvalException.class);
+ InvalidToolchainLabelException.class);
if (toolchains == null) {
return null;
}
} catch (InvalidToolchainLabelException e) {
throw new ToolchainResolutionFunctionException(e);
- } catch (EvalException e) {
- throw new ToolchainResolutionFunctionException(e);
}
// Find the right one.
@@ -125,7 +121,7 @@ public class ToolchainResolutionFunction implements SkyFunction {
if (platforms == null) {
return null;
}
- } catch (ToolchainContextException e) {
+ } catch (InvalidPlatformException e) {
throw new ToolchainResolutionFunctionException(e);
}
@@ -255,15 +251,11 @@ public class ToolchainResolutionFunction implements SkyFunction {
super(e, Transience.PERSISTENT);
}
- public ToolchainResolutionFunctionException(ToolchainContextException e) {
- super(e, Transience.PERSISTENT);
- }
-
public ToolchainResolutionFunctionException(InvalidToolchainLabelException e) {
super(e, Transience.PERSISTENT);
}
- public ToolchainResolutionFunctionException(EvalException e) {
+ public ToolchainResolutionFunctionException(InvalidPlatformException e) {
super(e, Transience.PERSISTENT);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainUtil.java b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainUtil.java
index b5f363158a..7f69391025 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainUtil.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainUtil.java
@@ -39,11 +39,10 @@ import com.google.devtools.build.lib.pkgcache.FilteringPolicy;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.ConfiguredValueCreationException;
import com.google.devtools.build.lib.skyframe.RegisteredToolchainsFunction.InvalidToolchainLabelException;
import com.google.devtools.build.lib.skyframe.ToolchainResolutionFunction.NoToolchainFoundException;
-import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.ValueOrException;
-import com.google.devtools.build.skyframe.ValueOrException4;
+import com.google.devtools.build.skyframe.ValueOrException2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -87,7 +86,7 @@ public class ToolchainUtil {
Set<Label> requiredToolchains,
Set<Label> execConstraintLabels,
@Nullable BuildConfigurationValue.Key configurationKey)
- throws ToolchainContextException, InterruptedException {
+ throws InterruptedException, ToolchainException {
// In some cases this is called with a missing configuration, so we skip toolchain context.
if (configurationKey == null) {
@@ -169,8 +168,7 @@ public class ToolchainUtil {
private static RegisteredExecutionPlatformsValue loadRegisteredExecutionPlatforms(
Environment env, BuildConfigurationValue.Key configurationKey)
- throws InterruptedException, ToolchainContextException {
- try {
+ throws InterruptedException, InvalidPlatformException {
RegisteredExecutionPlatformsValue registeredExecutionPlatforms =
(RegisteredExecutionPlatformsValue)
env.getValueOrThrow(
@@ -180,30 +178,23 @@ public class ToolchainUtil {
return null;
}
return registeredExecutionPlatforms;
- } catch (InvalidPlatformException e) {
- throw new ToolchainContextException(e);
- }
}
@Nullable
static Map<ConfiguredTargetKey, PlatformInfo> getPlatformInfo(
Iterable<ConfiguredTargetKey> platformKeys, Environment env)
- throws InterruptedException, ToolchainContextException {
+ throws InterruptedException, InvalidPlatformException {
Map<SkyKey, ValueOrException<ConfiguredValueCreationException>> values =
env.getValuesOrThrow(platformKeys, ConfiguredValueCreationException.class);
boolean valuesMissing = env.valuesMissing();
Map<ConfiguredTargetKey, PlatformInfo> platforms = valuesMissing ? null : new HashMap<>();
- try {
for (ConfiguredTargetKey key : platformKeys) {
- PlatformInfo platformInfo = findPlatformInfo(values.get(key));
+ PlatformInfo platformInfo = findPlatformInfo(key.getLabel(), values.get(key));
if (!valuesMissing && platformInfo != null) {
platforms.put(key, platformInfo);
}
}
- } catch (ConfiguredValueCreationException e) {
- throw new ToolchainContextException(e);
- }
if (valuesMissing) {
return null;
}
@@ -214,26 +205,29 @@ public class ToolchainUtil {
* Returns the {@link PlatformInfo} provider from the {@link ConfiguredTarget} in the {@link
* ValueOrException}, or {@code null} if the {@link ConfiguredTarget} is not present. If the
* {@link ConfiguredTarget} does not have a {@link PlatformInfo} provider, a {@link
- * InvalidPlatformException} is thrown, wrapped in a {@link ToolchainContextException}.
+ * InvalidPlatformException} is thrown.
*/
@Nullable
private static PlatformInfo findPlatformInfo(
- ValueOrException<ConfiguredValueCreationException> valueOrException)
- throws ConfiguredValueCreationException, ToolchainContextException {
+ Label label, ValueOrException<ConfiguredValueCreationException> valueOrException)
+ throws InvalidPlatformException {
- ConfiguredTargetValue ctv = (ConfiguredTargetValue) valueOrException.get();
- if (ctv == null) {
- return null;
- }
+ try {
+ ConfiguredTargetValue ctv = (ConfiguredTargetValue) valueOrException.get();
+ if (ctv == null) {
+ return null;
+ }
- ConfiguredTarget configuredTarget = ctv.getConfiguredTarget();
- PlatformInfo platformInfo = PlatformProviderUtils.platform(configuredTarget);
- if (platformInfo == null) {
- throw new ToolchainContextException(
- new InvalidPlatformException(configuredTarget.getLabel()));
- }
+ ConfiguredTarget configuredTarget = ctv.getConfiguredTarget();
+ PlatformInfo platformInfo = PlatformProviderUtils.platform(configuredTarget);
+ if (platformInfo == null) {
+ throw new InvalidPlatformException(label);
+ }
- return platformInfo;
+ return platformInfo;
+ } catch (ConfiguredValueCreationException e) {
+ throw new InvalidPlatformException(label, e);
+ }
}
/** Data class to hold the result of resolving toolchain labels. */
@@ -264,7 +258,7 @@ public class ToolchainUtil {
ImmutableList<ConfiguredTargetKey> availableExecutionPlatformKeys,
ConfiguredTargetKey targetPlatformKey,
boolean debug)
- throws InterruptedException, ToolchainContextException {
+ throws InterruptedException, ToolchainException {
// Find the toolchains for the required toolchain types.
List<ToolchainResolutionValue.Key> registeredToolchainKeys = new ArrayList<>();
@@ -274,35 +268,24 @@ public class ToolchainUtil {
configurationKey, toolchainType, targetPlatformKey, availableExecutionPlatformKeys));
}
- Map<
- SkyKey,
- ValueOrException4<
- NoToolchainFoundException, ConfiguredValueCreationException,
- InvalidToolchainLabelException, EvalException>>
+ Map<SkyKey, ValueOrException2<NoToolchainFoundException, InvalidToolchainLabelException>>
results =
env.getValuesOrThrow(
registeredToolchainKeys,
NoToolchainFoundException.class,
- ConfiguredValueCreationException.class,
- InvalidToolchainLabelException.class,
- EvalException.class);
+ InvalidToolchainLabelException.class);
boolean valuesMissing = false;
// Determine the potential set of toolchains.
Table<ConfiguredTargetKey, Label, Label> resolvedToolchains = HashBasedTable.create();
List<Label> missingToolchains = new ArrayList<>();
for (Map.Entry<
- SkyKey,
- ValueOrException4<
- NoToolchainFoundException, ConfiguredValueCreationException,
- InvalidToolchainLabelException, EvalException>>
+ SkyKey, ValueOrException2<NoToolchainFoundException, InvalidToolchainLabelException>>
entry : results.entrySet()) {
try {
Label requiredToolchainType =
((ToolchainResolutionValue.Key) entry.getKey().argument()).toolchainType();
- ValueOrException4<
- NoToolchainFoundException, ConfiguredValueCreationException,
- InvalidToolchainLabelException, EvalException>
+ ValueOrException2<NoToolchainFoundException, InvalidToolchainLabelException>
valueOrException = entry.getValue();
if (valueOrException.get() == null) {
valuesMissing = true;
@@ -315,17 +298,11 @@ public class ToolchainUtil {
} catch (NoToolchainFoundException e) {
// Save the missing type and continue looping to check for more.
missingToolchains.add(e.missingToolchainType());
- } catch (ConfiguredValueCreationException e) {
- throw new ToolchainContextException(e);
- } catch (InvalidToolchainLabelException e) {
- throw new ToolchainContextException(e);
- } catch (EvalException e) {
- throw new ToolchainContextException(e);
}
}
if (!missingToolchains.isEmpty()) {
- throw new ToolchainContextException(new UnresolvedToolchainsException(missingToolchains));
+ throw new UnresolvedToolchainsException(missingToolchains);
}
if (valuesMissing) {
@@ -346,9 +323,8 @@ public class ToolchainUtil {
}
if (!selectedExecutionPlatformKey.isPresent()) {
- throw new ToolchainContextException(
- new NoMatchingPlatformException(
- requiredToolchains, availableExecutionPlatformKeys, targetPlatformKey));
+ throw new NoMatchingPlatformException(
+ requiredToolchains, availableExecutionPlatformKeys, targetPlatformKey);
}
return ResolvedToolchains.create(
@@ -412,7 +388,7 @@ public class ToolchainUtil {
ConfiguredTargetKey targetPlatformKey,
Set<Label> requiredToolchains,
ImmutableBiMap<Label, Label> toolchains)
- throws ToolchainContextException, InterruptedException {
+ throws InterruptedException, InvalidPlatformException {
Map<ConfiguredTargetKey, PlatformInfo> platforms =
getPlatformInfo(ImmutableList.of(executionPlatformKey, targetPlatformKey), env);
@@ -477,7 +453,7 @@ public class ToolchainUtil {
ImmutableList<ConfiguredTargetKey> constraintKeys,
Environment env,
boolean debug)
- throws ToolchainContextException, InterruptedException {
+ throws InterruptedException, InvalidConstraintValueException, InvalidPlatformException {
// Short circuit if not needed.
if (constraintKeys.isEmpty()) {
@@ -502,22 +478,20 @@ public class ToolchainUtil {
@Nullable
private static List<ConstraintValueInfo> getConstraintValueInfo(
ImmutableList<ConfiguredTargetKey> constraintKeys, Environment env)
- throws InterruptedException, ToolchainContextException {
+ throws InterruptedException, InvalidConstraintValueException {
Map<SkyKey, ValueOrException<ConfiguredValueCreationException>> values =
env.getValuesOrThrow(constraintKeys, ConfiguredValueCreationException.class);
boolean valuesMissing = env.valuesMissing();
List<ConstraintValueInfo> constraintValues = valuesMissing ? null : new ArrayList<>();
- try {
for (ConfiguredTargetKey key : constraintKeys) {
- ConstraintValueInfo constraintValueInfo = findConstraintValueInfo(values.get(key));
+ ConstraintValueInfo constraintValueInfo =
+ findConstraintValueInfo(key.getLabel(), values.get(key));
if (!valuesMissing && constraintValueInfo != null) {
constraintValues.add(constraintValueInfo);
}
}
- } catch (ConfiguredValueCreationException e) {
- throw new ToolchainContextException(e);
- }
+
if (valuesMissing) {
return null;
}
@@ -526,23 +500,26 @@ public class ToolchainUtil {
@Nullable
private static ConstraintValueInfo findConstraintValueInfo(
- ValueOrException<ConfiguredValueCreationException> valueOrException)
- throws ConfiguredValueCreationException, ToolchainContextException {
+ Label label, ValueOrException<ConfiguredValueCreationException> valueOrException)
+ throws InvalidConstraintValueException {
- ConfiguredTargetValue configuredTargetValue = (ConfiguredTargetValue) valueOrException.get();
- if (configuredTargetValue == null) {
- return null;
- }
+ try {
+ ConfiguredTargetValue configuredTargetValue = (ConfiguredTargetValue) valueOrException.get();
+ if (configuredTargetValue == null) {
+ return null;
+ }
- ConfiguredTarget configuredTarget = configuredTargetValue.getConfiguredTarget();
- ConstraintValueInfo constraintValueInfo =
- PlatformProviderUtils.constraintValue(configuredTarget);
- if (constraintValueInfo == null) {
- throw new ToolchainContextException(
- new InvalidConstraintValueException(configuredTarget.getLabel()));
- }
+ ConfiguredTarget configuredTarget = configuredTargetValue.getConfiguredTarget();
+ ConstraintValueInfo constraintValueInfo =
+ PlatformProviderUtils.constraintValue(configuredTarget);
+ if (constraintValueInfo == null) {
+ throw new InvalidConstraintValueException(label);
+ }
- return constraintValueInfo;
+ return constraintValueInfo;
+ } catch (ConfiguredValueCreationException e) {
+ throw new InvalidConstraintValueException(label, e);
+ }
}
private static boolean filterPlatform(
@@ -573,7 +550,7 @@ public class ToolchainUtil {
}
/** Exception used when no execution platform can be found. */
- static final class NoMatchingPlatformException extends Exception {
+ static final class NoMatchingPlatformException extends ToolchainException {
NoMatchingPlatformException() {
super("No available execution platform satisfies all requested toolchain types");
}
@@ -615,7 +592,7 @@ public class ToolchainUtil {
* Exception used when an error occurs in {@link #expandTargetPatterns(Environment, List,
* FilteringPolicy)}.
*/
- static final class InvalidTargetPatternException extends Exception {
+ static final class InvalidTargetPatternException extends ToolchainException {
private String invalidPattern;
private TargetParsingException tpe;
@@ -635,7 +612,7 @@ public class ToolchainUtil {
}
/** Exception used when a platform label is not a valid platform. */
- static final class InvalidPlatformException extends Exception {
+ static final class InvalidPlatformException extends ToolchainException {
InvalidPlatformException(Label label) {
super(formatError(label));
}
@@ -651,7 +628,7 @@ public class ToolchainUtil {
}
/** Exception used when a constraint value label is not a valid constraint value. */
- static final class InvalidConstraintValueException extends Exception {
+ static final class InvalidConstraintValueException extends ToolchainException {
InvalidConstraintValueException(Label label) {
super(formatError(label));
}
@@ -669,7 +646,7 @@ public class ToolchainUtil {
}
/** Exception used when a toolchain type is required but no matching toolchain is found. */
- public static final class UnresolvedToolchainsException extends Exception {
+ public static final class UnresolvedToolchainsException extends ToolchainException {
private final ImmutableList<Label> missingToolchainTypes;
public UnresolvedToolchainsException(List<Label> missingToolchainTypes) {
@@ -684,35 +661,4 @@ public class ToolchainUtil {
return missingToolchainTypes;
}
}
-
- /** Exception used to wrap exceptions during toolchain resolution. */
- public static class ToolchainContextException extends Exception {
- public ToolchainContextException(NoMatchingPlatformException e) {
- super(e);
- }
-
- public ToolchainContextException(InvalidPlatformException e) {
- super(e);
- }
-
- public ToolchainContextException(InvalidConstraintValueException e) {
- super(e);
- }
-
- public ToolchainContextException(UnresolvedToolchainsException e) {
- super(e);
- }
-
- public ToolchainContextException(ConfiguredValueCreationException e) {
- super(e);
- }
-
- public ToolchainContextException(InvalidToolchainLabelException e) {
- super(e);
- }
-
- public ToolchainContextException(EvalException e) {
- super(e);
- }
- }
}