Prevented catching/wrapping of InterruptedExceptions, especially in BaseFunction.

--
MOS_MIGRATED_REVID=102988766
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
index e966e7f..bf94236 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
@@ -350,18 +350,21 @@
     return getConfiguredTarget(packageManager.getLoadedTarget(label), config);
   }
 
-  public Iterable<ConfiguredTarget> getDirectPrerequisites(ConfiguredTarget ct) {
+  public Iterable<ConfiguredTarget> getDirectPrerequisites(ConfiguredTarget ct)
+      throws InterruptedException {
     return getDirectPrerequisites(ct, null);
   }
 
   public Iterable<ConfiguredTarget> getDirectPrerequisites(
-      ConfiguredTarget ct, @Nullable final LoadingCache<Label, Target> targetCache) {
+      ConfiguredTarget ct, @Nullable final LoadingCache<Label, Target> targetCache)
+      throws InterruptedException {
     return skyframeExecutor.getConfiguredTargets(ct.getConfiguration(),
         getDirectPrerequisiteDependencies(ct, targetCache), false);
   }
 
   public Iterable<Dependency> getDirectPrerequisiteDependencies(
-      ConfiguredTarget ct, @Nullable final LoadingCache<Label, Target> targetCache) {
+      ConfiguredTarget ct, @Nullable final LoadingCache<Label, Target> targetCache)
+      throws InterruptedException {
     if (!(ct.getTarget() instanceof Rule)) {
       return ImmutableList.of();
     }
@@ -858,7 +861,8 @@
   }
 
   @VisibleForTesting
-  ListMultimap<Attribute, ConfiguredTarget> getPrerequisiteMapForTesting(ConfiguredTarget target) {
+  ListMultimap<Attribute, ConfiguredTarget> getPrerequisiteMapForTesting(ConfiguredTarget target)
+      throws InterruptedException {
     DependencyResolver resolver = new DependencyResolver() {
       @Override
       protected void invalidVisibilityReferenceHook(TargetAndConfiguration node, Label label) {
@@ -954,8 +958,8 @@
    * Returns a RuleContext which is the same as the original RuleContext of the target parameter.
    */
   @VisibleForTesting
-  public RuleContext getRuleContextForTesting(ConfiguredTarget target,
-      StoredEventHandler eventHandler) {
+  public RuleContext getRuleContextForTesting(
+      ConfiguredTarget target, StoredEventHandler eventHandler) throws InterruptedException {
     BuildConfiguration config = target.getConfiguration();
     CachingAnalysisEnvironment analysisEnvironment =
         new CachingAnalysisEnvironment(artifactFactory,
@@ -977,7 +981,8 @@
    * given configured target.
    */
   @VisibleForTesting
-  public RuleContext getRuleContextForTesting(ConfiguredTarget target, AnalysisEnvironment env) {
+  public RuleContext getRuleContextForTesting(ConfiguredTarget target, AnalysisEnvironment env)
+      throws InterruptedException {
     BuildConfiguration targetConfig = target.getConfiguration();
     return new RuleContext.Builder(
         env, (Rule) target.getTarget(), targetConfig, configurations.getHostConfiguration(),
@@ -996,7 +1001,8 @@
    */
   @VisibleForTesting
   public ConfiguredTarget getPrerequisiteConfiguredTargetForTesting(
-      ConfiguredTarget dependentTarget, ConfiguredTarget desiredTarget) {
+      ConfiguredTarget dependentTarget, ConfiguredTarget desiredTarget)
+      throws InterruptedException {
     Collection<ConfiguredTarget> configuredTargets =
         getPrerequisiteMapForTesting(dependentTarget).values();
     for (ConfiguredTarget ct : configuredTargets) {
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java b/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java
index debf6f4..05e302c 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java
@@ -219,7 +219,7 @@
   public final ListMultimap<Attribute, Dependency> dependentNodeMap(
       TargetAndConfiguration node, BuildConfiguration hostConfig, AspectDefinition aspect,
       AspectParameters aspectParameters, Set<ConfigMatchingProvider> configConditions)
-      throws EvalException {
+      throws EvalException, InterruptedException {
     Target target = node.getTarget();
     BuildConfiguration config = node.getConfiguration();
     ListMultimap<Attribute, Dependency> outgoingEdges = ArrayListMultimap.create();
@@ -250,7 +250,7 @@
   private ListMultimap<Attribute, LabelAndConfiguration> resolveAttributes(
       Rule rule, AspectDefinition aspect, BuildConfiguration configuration,
       BuildConfiguration hostConfiguration, Set<ConfigMatchingProvider> configConditions)
-      throws EvalException {
+      throws EvalException, InterruptedException {
     ConfiguredAttributeMapper attributeMap = ConfiguredAttributeMapper.of(rule, configConditions);
     attributeMap.validateAttributes();
     List<Attribute> attributes;
@@ -431,7 +431,7 @@
       AttributeMap attributeMap,
       Iterable<Attribute> attributes,
       ImmutableSortedKeyListMultimap.Builder<Attribute, LabelAndConfiguration> builder)
-      throws EvalException {
+      throws EvalException, InterruptedException {
     for (Attribute attribute : attributes) {
       if (!attribute.isLateBound() || !attribute.getCondition().apply(attributeMap)) {
         continue;
@@ -501,7 +501,7 @@
    */
   public final Collection<Dependency> dependentNodes(
       TargetAndConfiguration node, BuildConfiguration hostConfig,
-      Set<ConfigMatchingProvider> configConditions) {
+      Set<ConfigMatchingProvider> configConditions) throws InterruptedException {
     try {
       return ImmutableSet.copyOf(dependentNodeMap(node, hostConfig, /*aspect=*/null,
           AspectParameters.EMPTY, configConditions).values());
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index 0cfb114..74616c9 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -1082,7 +1082,8 @@
    * Returns the implicit output artifact for a given template function. If multiple or no artifacts
    * can be found as a result of the template, an exception is thrown.
    */
-  public Artifact getImplicitOutputArtifact(ImplicitOutputsFunction function) {
+  public Artifact getImplicitOutputArtifact(ImplicitOutputsFunction function)
+      throws InterruptedException {
     Iterable<String> result;
     try {
       result = function.getImplicitOutputs(RawAttributeMapper.of(rule));
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Attribute.java b/src/main/java/com/google/devtools/build/lib/packages/Attribute.java
index c181a7e..1f30820 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Attribute.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Attribute.java
@@ -865,7 +865,7 @@
      * configuration. Note that configurations transitions are applied after the late-bound
      * attribute was evaluated.
      */
-    Object getDefault(Rule rule, T o) throws EvalException;
+    Object getDefault(Rule rule, T o) throws EvalException, InterruptedException;
   }
 
   /**
@@ -982,7 +982,7 @@
     }
 
     @Override
-    public Object getDefault(Rule rule, Object o) throws EvalException {
+    public Object getDefault(Rule rule, Object o) throws EvalException, InterruptedException {
       Map<String, Object> attrValues = new HashMap<>();
       // TODO(bazel-team): support configurable attributes here. RawAttributeMapper will throw
       // an exception on any instance of configurable attributes.
diff --git a/src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java b/src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java
index 49852ee..cfb8143 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java
@@ -111,7 +111,7 @@
 
     public void addBindRule(
         RuleClass bindRuleClass, Label virtual, Label actual, Location location)
-        throws InvalidRuleException, NameConflictException {
+        throws InvalidRuleException, NameConflictException, InterruptedException {
 
       Map<String, Object> attributes = Maps.newHashMap();
       // Bound rules don't have a name field, but this works because we don't want more than one
@@ -133,7 +133,7 @@
      */
     public Builder createAndAddRepositoryRule(RuleClass ruleClass, RuleClass bindRuleClass,
         Map<String, Object> kwargs, FuncallExpression ast, Environment env)
-        throws InvalidRuleException, NameConflictException, SyntaxException {
+        throws InvalidRuleException, NameConflictException, SyntaxException, InterruptedException {
       StoredEventHandler eventHandler = new StoredEventHandler();
       Rule tempRule = RuleFactory.createRule(
           this, ruleClass, kwargs, eventHandler, ast, ast.getLocation(), env);
diff --git a/src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java b/src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java
index 12d02c6..eb3badd 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java
@@ -59,10 +59,11 @@
   public abstract static class SkylarkImplicitOutputsFunction extends ImplicitOutputsFunction {
 
     public abstract ImmutableMap<String, String> calculateOutputs(AttributeMap map)
-        throws EvalException;
+        throws EvalException, InterruptedException;
 
     @Override
-    public Iterable<String> getImplicitOutputs(AttributeMap map) throws EvalException {
+    public Iterable<String> getImplicitOutputs(AttributeMap map)
+        throws EvalException, InterruptedException {
       return calculateOutputs(map).values();
     }
   }
@@ -83,7 +84,8 @@
     }
 
     @Override
-    public ImmutableMap<String, String> calculateOutputs(AttributeMap map) throws EvalException {
+    public ImmutableMap<String, String> calculateOutputs(AttributeMap map)
+        throws EvalException, InterruptedException {
       Map<String, Object> attrValues = new HashMap<>();
       for (String attrName : map.getAttributeNames()) {
         Type<?> attrType = map.getAttributeType(attrName);
@@ -175,7 +177,8 @@
    * Given a newly-constructed Rule instance (with attributes populated),
    * returns the list of output files that this rule produces implicitly.
    */
-  public abstract Iterable<String> getImplicitOutputs(AttributeMap rule) throws EvalException;
+  public abstract Iterable<String> getImplicitOutputs(AttributeMap rule)
+      throws EvalException, InterruptedException;
 
   /**
    * The implicit output function that returns no files.
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java
index 2a6945c..256aab0 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Package.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java
@@ -240,7 +240,7 @@
     }
   }
 
-  private void readObject(ObjectInputStream in) throws IOException {
+  private void readObject(ObjectInputStream in) throws IOException, InterruptedException {
     try {
       deserializedPkg = new PackageDeserializer().deserialize(in);
     } catch (PackageDeserializationException e) {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java b/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java
index 2537693..2f0715c 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java
@@ -166,7 +166,7 @@
   }
 
   private void deserializeRule(DeserializationContext context, Build.Rule rulePb)
-      throws PackageDeserializationException {
+      throws PackageDeserializationException, InterruptedException {
     Location ruleLocation = EmptyLocation.INSTANCE;
     RuleClass ruleClass = packageDeserializationEnvironment.getRuleClass(rulePb, ruleLocation);
     Map<String, ParsedAttributeValue> attributeValues = new HashMap<>();
@@ -326,9 +326,11 @@
    * Deserialize a package from its representation as a protocol message. The inverse of
    * {@link PackageSerializer#serialize}.
    * @throws IOException
+   * @throws InterruptedException 
    */
   private void deserializeInternal(Build.Package packagePb, StoredEventHandler eventHandler,
-      Package.Builder builder, InputStream in) throws PackageDeserializationException, IOException {
+      Package.Builder builder, InputStream in)
+      throws PackageDeserializationException, IOException, InterruptedException {
     Path buildFile = packageDeserializationEnvironment.getPath(packagePb.getBuildFilePath());
     Preconditions.checkNotNull(buildFile);
     DeserializationContext context = new DeserializationContext(builder);
@@ -394,7 +396,7 @@
   }
 
   private void deserializeTargets(InputStream in, DeserializationContext context)
-      throws IOException, PackageDeserializationException {
+      throws IOException, PackageDeserializationException, InterruptedException {
     Build.TargetOrTerminator tot;
     while (!(tot = Build.TargetOrTerminator.parseDelimitedFrom(in)).getIsTerminator()) {
       Build.Target target = tot.getTarget();
@@ -428,8 +430,10 @@
    * @return a new {@link Package} as read from {@code in}
    * @throws PackageDeserializationException on failures deserializing the input
    * @throws IOException on failures reading from {@code in}
+   * @throws InterruptedException 
    */
-  public Package deserialize(InputStream in) throws PackageDeserializationException, IOException {
+  public Package deserialize(InputStream in)
+      throws PackageDeserializationException, IOException, InterruptedException {
     try {
       return deserializeInternal(in);
     } catch (PackageDeserializationException | RuntimeException e) {
@@ -439,7 +443,7 @@
   }
 
   private Package deserializeInternal(InputStream in)
-      throws PackageDeserializationException, IOException {
+      throws PackageDeserializationException, IOException, InterruptedException {
     // Read the initial Package message so we have the data to initialize the builder. We will read
     // the Targets in individually later.
     Build.Package packagePb = Build.Package.parseDelimitedFrom(in);
diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
index 6cb807f..4fd5428 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
@@ -900,7 +900,7 @@
                               Map<String, Object> kwargs,
                               FuncallExpression ast,
                               Environment env)
-      throws RuleFactory.InvalidRuleException, Package.NameConflictException {
+      throws RuleFactory.InvalidRuleException, Package.NameConflictException, InterruptedException {
     RuleClass ruleClass = getBuiltInRuleClass(ruleClassName, ruleFactory);
     RuleFactory.createAndAddRule(context, ruleClass, kwargs, ast, env);
   }
@@ -938,7 +938,7 @@
       @SuppressWarnings({"unchecked", "unused"})
       public Runtime.NoneType invoke(Map<String, Object> kwargs,
           FuncallExpression ast, Environment env)
-          throws EvalException {
+          throws EvalException, InterruptedException {
         env.checkLoadingPhase(ruleClass, ast.getLocation());
         try {
           addRule(ruleFactory, ruleClass, getContext(env, ast), kwargs, ast, env);
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Rule.java b/src/main/java/com/google/devtools/build/lib/packages/Rule.java
index a4a46bc..da1c804 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Rule.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Rule.java
@@ -483,8 +483,8 @@
    * first, followed by any explicit files. Additionally both implicit and explicit output files
    * will retain the relative order in which they were declared.
    */
-  void populateOutputFiles(EventHandler eventHandler,
-      Package.Builder pkgBuilder) throws SyntaxException {
+  void populateOutputFiles(EventHandler eventHandler, Package.Builder pkgBuilder)
+      throws SyntaxException, InterruptedException {
     Preconditions.checkState(outputFiles == null);
     // Order is important here: implicit before explicit
     outputFiles = Lists.newArrayList();
@@ -519,8 +519,8 @@
    * Implicit output files come from rule-specific patterns, and are a function
    * of the rule's "name", "srcs", and other attributes.
    */
-  private void populateImplicitOutputFiles(EventHandler eventHandler,
-      Package.Builder pkgBuilder) {
+  private void populateImplicitOutputFiles(EventHandler eventHandler, Package.Builder pkgBuilder)
+      throws InterruptedException {
     try {
       for (String out : ruleClass.getImplicitOutputsFunction().getImplicitOutputs(attributeMap)) {
         try {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
index 91723d0..1e7dd2a 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
@@ -1315,7 +1315,7 @@
    */
   Rule createRuleWithLabel(Package.Builder pkgBuilder, Label ruleLabel,
       Map<String, Object> attributeValues, EventHandler eventHandler, FuncallExpression ast,
-      Location location) throws SyntaxException {
+      Location location) throws SyntaxException, InterruptedException {
     Rule rule = pkgBuilder.newRuleWithLabel(ruleLabel, this, null, location);
     createRuleCommon(rule, pkgBuilder, attributeValues, eventHandler, ast);
     return rule;
@@ -1323,7 +1323,7 @@
 
   private void createRuleCommon(Rule rule, Package.Builder pkgBuilder,
       Map<String, Object> attributeValues, EventHandler eventHandler, FuncallExpression ast)
-          throws SyntaxException {
+      throws SyntaxException, InterruptedException {
     populateRuleAttributeValues(
         rule, pkgBuilder, attributeValues, eventHandler, ast);
     rule.populateOutputFiles(eventHandler, pkgBuilder);
@@ -1365,7 +1365,7 @@
   Rule createRuleWithParsedAttributeValues(Label label,
       Package.Builder pkgBuilder, Location ruleLocation,
       Map<String, ParsedAttributeValue> attributeValues, EventHandler eventHandler)
-          throws SyntaxException{
+          throws SyntaxException, InterruptedException {
     Rule rule = pkgBuilder.newRuleWithLabel(label, this, null, ruleLocation);
     rule.checkValidityPredicate(eventHandler);
 
@@ -1404,7 +1404,8 @@
                                            Package.Builder pkgBuilder,
                                            Map<String, Object> attributeValues,
                                            EventHandler eventHandler,
-                                           FuncallExpression ast) {
+                                           FuncallExpression ast)
+                                               throws InterruptedException {
     BitSet definedAttrs = new BitSet(); //  set of attr indices
 
     for (Map.Entry<String, Object> entry : attributeValues.entrySet()) {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java b/src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java
index 8c073d2..9c3516e 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java
@@ -83,7 +83,7 @@
       FuncallExpression ast,
       Location location,
       @Nullable Environment env)
-      throws InvalidRuleException {
+      throws InvalidRuleException, InterruptedException {
     Preconditions.checkNotNull(ruleClass);
     String ruleClassName = ruleClass.getName();
     Object nameObject = attributeValues.get("name");
@@ -149,7 +149,7 @@
       FuncallExpression ast,
       Location location,
       Environment env)
-      throws InvalidRuleException, NameConflictException {
+      throws InvalidRuleException, NameConflictException, InterruptedException {
     Rule rule = createRule(
         pkgBuilder, ruleClass, attributeValues, eventHandler, ast, location, env);
     pkgBuilder.addRule(rule);
@@ -162,7 +162,7 @@
       Map<String, Object> attributeValues,
       FuncallExpression ast,
       Environment env)
-      throws InvalidRuleException, NameConflictException {
+      throws InvalidRuleException, NameConflictException, InterruptedException {
     return createAndAddRule(
         context.pkgBuilder,
         ruleClass,
diff --git a/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java b/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java
index abbbdf8..74def59 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java
@@ -140,7 +140,7 @@
     return new BuiltinFunction(ruleClassName,
         FunctionSignature.KWARGS, BuiltinFunction.USE_AST_ENV) {
       public Object invoke(Map<String, Object> kwargs, FuncallExpression ast, Environment env)
-          throws EvalException {
+          throws EvalException, InterruptedException {
         try {
           RuleClass ruleClass = ruleFactory.getRuleClass(ruleClassName);
           RuleClass bindRuleClass = ruleFactory.getRuleClass("bind");
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleConfiguredTargetBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleConfiguredTargetBuilder.java
index 3b1a24c..f2bb02c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleConfiguredTargetBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleConfiguredTargetBuilder.java
@@ -52,8 +52,8 @@
   /**
    * Create a Rule Configured Target from the ruleContext and the ruleImplementation.
    */
-  public static ConfiguredTarget buildRule(RuleContext ruleContext,
-      BaseFunction ruleImplementation) {
+  public static ConfiguredTarget buildRule(RuleContext ruleContext, BaseFunction ruleImplementation)
+      throws InterruptedException {
     String expectFailure = ruleContext.attributes().get("expect_failure", Type.STRING);
     try (Mutability mutability = Mutability.create("configured target")) {
       SkylarkRuleContext skylarkRuleContext = new SkylarkRuleContext(ruleContext);
@@ -81,9 +81,6 @@
       ConfiguredTarget configuredTarget = createTarget(ruleContext, target);
       checkOrphanArtifacts(ruleContext);
       return configuredTarget;
-    } catch (InterruptedException e) {
-      ruleContext.ruleError(e.getMessage());
-      return null;
     } catch (EvalException e) {
       addRuleToStackTrace(e, ruleContext.getRule(), ruleImplementation);
       // If the error was expected, return an empty target.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java
index 13a6533..5c13375 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java
@@ -120,8 +120,9 @@
 
   /**
    * Creates a new SkylarkRuleContext using ruleContext.
+   * @throws InterruptedException 
    */
-  public SkylarkRuleContext(RuleContext ruleContext) throws EvalException {
+  public SkylarkRuleContext(RuleContext ruleContext) throws EvalException, InterruptedException {
     this.ruleContext = Preconditions.checkNotNull(ruleContext);
     fragments = new FragmentCollection(ruleContext, ConfigurationTransition.NONE);
     hostFragments = new FragmentCollection(ruleContext, ConfigurationTransition.HOST);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
index e65f28f..dc47023 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
@@ -78,7 +78,7 @@
   protected abstract AndroidSemantics createAndroidSemantics();
 
   @Override
-  public ConfiguredTarget create(RuleContext ruleContext) {
+  public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException {
     JavaSemantics javaSemantics = createJavaSemantics();
     AndroidSemantics androidSemantics = createAndroidSemantics();
     if (!AndroidSdkProvider.verifyPresence(ruleContext)) {
@@ -118,7 +118,7 @@
       AndroidCommon androidCommon,
       JavaSemantics javaSemantics,
       AndroidSemantics androidSemantics,
-      List<String> depsAttributes) {
+      List<String> depsAttributes) throws InterruptedException {
     // TODO(bazel-team): Find a way to simplify this code.
     // treeKeys() means that the resulting map sorts the entries by key, which is necessary to
     // ensure determinism.
@@ -297,7 +297,7 @@
       ResourceApk splitResourceApk,
       JavaTargetAttributes resourceClasses,
       ImmutableList<Artifact> apksUnderTest,
-      Artifact proguardMapping) {
+      Artifact proguardMapping) throws InterruptedException {
 
     ImmutableList<Artifact> proguardSpecs =
         getTransitiveProguardSpecs(
@@ -712,7 +712,7 @@
       Artifact deployJarArtifact,
       NestedSetBuilder<Artifact> filesBuilder,
       ImmutableList<Artifact> proguardSpecs,
-      Artifact proguardMapping) {
+      Artifact proguardMapping) throws InterruptedException {
     Artifact proguardOutputJar =
         ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_PROGUARD_JAR);
 
@@ -731,8 +731,8 @@
         proguardSpecs, proguardMapping, sdk.getAndroidJar(), proguardOutputJar, filesBuilder);
   }
 
-  private static ProguardOutput createEmptyProguardAction(
-      RuleContext ruleContext, Artifact proguardOutputJar, Artifact deployJarArtifact) {
+  private static ProguardOutput createEmptyProguardAction(RuleContext ruleContext,
+      Artifact proguardOutputJar, Artifact deployJarArtifact) throws InterruptedException {
     ImmutableList.Builder<Artifact> failures =
         ImmutableList.<Artifact>builder().add(proguardOutputJar);
     if (ruleContext.attributes().get("proguard_generate_mapping", Type.BOOLEAN)) {
@@ -751,7 +751,7 @@
       FilesToRunProvider proguard,
       Artifact jar, ImmutableList<Artifact> proguardSpecs,
       Artifact proguardMapping, Artifact androidJar, Artifact proguardOutputJar,
-      NestedSetBuilder<Artifact> filesBuilder) {
+      NestedSetBuilder<Artifact> filesBuilder) throws InterruptedException {
     Iterable<Artifact> libraryJars = NestedSetBuilder.<Artifact>naiveLinkOrder()
         .add(androidJar)
         .addTransitive(common.getTransitiveNeverLinkLibraries())
@@ -837,7 +837,7 @@
   /** Dexes the ProguardedJar to generate ClassesDex that has a reference classes.dex. */
   static DexingOutput dex(RuleContext ruleContext, MultidexMode multidexMode, List<String> dexopts,
       Artifact deployJar,  Artifact proguardedJar, AndroidCommon common,
-      JavaTargetAttributes attributes) {
+      JavaTargetAttributes attributes) throws InterruptedException {
     String classesDexFileName = getMultidexMode(ruleContext).getOutputDexFilename();
     Artifact classesDex = AndroidBinary.getDxArtifact(ruleContext, classesDexFileName);
     if (!AndroidBinary.supportsMultidexMode(ruleContext, multidexMode)) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
index f90d2ad..b65014d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
@@ -241,7 +241,7 @@
       JavaCompilationArtifacts.Builder artifactsBuilder,
       JavaTargetAttributes.Builder attributes,
       NestedSet<ResourceContainer> resourceContainers,
-      ResourceContainer updatedResources) {
+      ResourceContainer updatedResources) throws InterruptedException {
       Artifact binaryResourcesJar =
           ruleContext.getImplicitOutputArtifact(JavaSemantics.JAVA_BINARY_CLASS_JAR);
       compileResourceJar(javaSemantics, binaryResourcesJar, updatedResources.getJavaSourceJar());
@@ -335,7 +335,7 @@
       JavaSemantics javaSemantics, AndroidSemantics androidSemantics,
       ResourceApk resourceApk, AndroidIdlProvider transitiveIdlImportData,
       boolean addCoverageSupport, boolean collectJavaCompilationArgs,
-      SafeImplicitOutputsFunction genClassJarImplicitOutput) {
+      SafeImplicitOutputsFunction genClassJarImplicitOutput) throws InterruptedException {
     ImmutableList<Artifact> extraSources =
         resourceApk.isLegacy() || resourceApk.getResourceJavaSrcJar() == null
             ? ImmutableList.<Artifact>of()
@@ -427,7 +427,8 @@
     return (strict != DEFAULT && strict != STRICT) ? strict : ERROR;
   }
 
-  JackCompilationHelper initJack(JavaTargetAttributes attributes, JavaSemantics javaSemantics) {
+  JackCompilationHelper initJack(JavaTargetAttributes attributes, JavaSemantics javaSemantics)
+      throws InterruptedException {
     Map<PathFragment, Artifact> resourcesMap = new LinkedHashMap<>();
     for (Artifact resource : attributes.getResources()) {
       resourcesMap.put(javaSemantics.getJavaResourcePath(resource.getRootRelativePath()), resource);
@@ -459,7 +460,7 @@
       JavaCompilationArtifacts.Builder javaArtifactsBuilder,
       boolean collectJavaCompilationArgs,
       @Nullable Artifact additionalSourceJar,
-      SafeImplicitOutputsFunction genClassJarImplicitOutput) {
+      SafeImplicitOutputsFunction genClassJarImplicitOutput) throws InterruptedException {
     NestedSetBuilder<Artifact> filesBuilder = NestedSetBuilder.<Artifact>stableOrder();
     if (additionalSourceJar != null) {
       filesBuilder.add(additionalSourceJar);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java
index 2bacf57..f6d113e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java
@@ -57,7 +57,7 @@
   protected abstract AndroidSemantics createAndroidSemantics();
 
   @Override
-  public ConfiguredTarget create(RuleContext ruleContext) {
+  public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException {
     JavaSemantics javaSemantics = createJavaSemantics();
     AndroidSemantics androidSemantics = createAndroidSemantics();
     if (!AndroidSdkProvider.verifyPresence(ruleContext)) {
@@ -261,8 +261,10 @@
     }
   }
 
-  private static Artifact mergeJarsFromSrcs(RuleContext ruleContext, Artifact inputJar) {
-    ImmutableList<Artifact> jarSources = ruleContext
+  private static Artifact mergeJarsFromSrcs(RuleContext ruleContext, Artifact inputJar)
+      throws InterruptedException {
+    ImmutableList<Artifact> jarSources =
+        ruleContext
         .getPrerequisiteArtifacts("srcs", Mode.TARGET).filter(JavaSemantics.JAR).list();
     if (jarSources.isEmpty()) {
       return inputJar;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceContainerBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceContainerBuilder.java
index 338e424..89a5496 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceContainerBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceContainerBuilder.java
@@ -53,8 +53,10 @@
     return this;
   }
 
-  /** Creates a {@link ResourceContainer} from a {@link RuleContext}. */
-  public ResourceContainer buildFromRule(RuleContext ruleContext, Artifact apk) {
+  /** Creates a {@link ResourceContainer} from a {@link RuleContext}. 
+   * @throws InterruptedException */
+  public ResourceContainer buildFromRule(RuleContext ruleContext, Artifact apk)
+      throws InterruptedException {
     Preconditions.checkNotNull(this.manifest);
     Preconditions.checkNotNull(this.data);
     return new AndroidResourcesProvider.ResourceContainer(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java
index 343b6f1..f86fd57 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java
@@ -32,16 +32,18 @@
 public interface AndroidSemantics {
   /**
    * Adds transitive info providers for {@code android_binary} and {@code android_library} rules.
+   * @throws InterruptedException 
    */
   void addTransitiveInfoProviders(RuleConfiguredTargetBuilder builder,
       RuleContext ruleContext, JavaCommon javaCommon, AndroidCommon androidCommon,
       Artifact jarWithAllClasses, ResourceApk resourceApk, Artifact zipAlignedApk,
-      Iterable<Artifact> apksUnderTest);
+      Iterable<Artifact> apksUnderTest) throws InterruptedException;
 
   /**
    * Returns the manifest to be used when compiling a given rule.
+   * @throws InterruptedException 
    */
-  ApplicationManifest getManifestForRule(RuleContext ruleContext);
+  ApplicationManifest getManifestForRule(RuleContext ruleContext) throws InterruptedException;
 
   /**
    * Returns the name of the file in which the file names of native dependencies are listed.
@@ -71,8 +73,9 @@
 
   /**
    * Add coverage instrumentation to the Java compilation of an Android binary.
+   * @throws InterruptedException 
    */
   void addCoverageSupport(RuleContext ruleContext, AndroidCommon common,
-      JavaSemantics javaSemantics, boolean forAndroidTest,
-      JavaTargetAttributes.Builder attributes, JavaCompilationArtifacts.Builder artifactsBuilder);
+      JavaSemantics javaSemantics, boolean forAndroidTest, JavaTargetAttributes.Builder attributes,
+      JavaCompilationArtifacts.Builder artifactsBuilder) throws InterruptedException;
 }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java b/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java
index 2b5e999..0e79f5f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java
@@ -99,7 +99,8 @@
     }
   }
 
-  public ApplicationManifest addStubApplication(RuleContext ruleContext) {
+  public ApplicationManifest addStubApplication(RuleContext ruleContext)
+      throws InterruptedException {
 
     Artifact stubManifest =
         ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.STUB_APPLICATON_MANIFEST);
@@ -199,14 +200,15 @@
     return builder.build();
   }
 
-  /** Packages up the manifest with assets from the rule and dependent resources. */
+  /** Packages up the manifest with assets from the rule and dependent resources. 
+   * @throws InterruptedException */
   public ResourceApk packWithAssets(
       Artifact resourceApk,
       RuleContext ruleContext,
       NestedSet<ResourceContainer> resourceContainers,
       Artifact rTxt,
       boolean incremental,
-      Artifact proguardCfg) {
+      Artifact proguardCfg) throws InterruptedException {
     try {
       LocalResourceContainer data = new LocalResourceContainer.Builder()
           .withAssets(
@@ -237,7 +239,8 @@
     }
   }
 
-  /** Packages up the manifest with resource and assets from the rule and dependent resources. */
+  /** Packages up the manifest with resource and assets from the rule and dependent resources. 
+   * @throws InterruptedException */
   public ResourceApk packWithDataAndResources(
       Artifact resourceApk,
       RuleContext ruleContext,
@@ -250,7 +253,7 @@
       String applicationId,
       String versionCode,
       String versionName,
-      boolean incremental, Artifact proguardCfg) {
+      boolean incremental, Artifact proguardCfg) throws InterruptedException {
     try {
       LocalResourceContainer data = new LocalResourceContainer.Builder()
           .withAssets(
@@ -301,7 +304,7 @@
       String versionCode,
       String versionName,
       boolean incremental,
-      LocalResourceContainer data, Artifact proguardCfg) {
+      LocalResourceContainer data, Artifact proguardCfg) throws InterruptedException {
     ResourceContainer resourceContainer = checkForInlinedResources(
         new AndroidResourceContainerBuilder()
             .withData(data)
@@ -395,6 +398,7 @@
 
   /**
    * Packages up the manifest with resources, and generates the R.java.
+   * @throws InterruptedException 
    *
    * @deprecated in favor of {@link ApplicationManifest#packWithDataAndResources}.
    */
@@ -404,7 +408,7 @@
       RuleContext ruleContext,
       NestedSet<ResourceContainer> resourceContainers,
       boolean createSource,
-      Artifact proguardCfg) {
+      Artifact proguardCfg) throws InterruptedException {
 
     TransitiveInfoCollection resourcesPrerequisite =
         ruleContext.getPrerequisite("resources", Mode.TARGET);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
index 2e4d497..663532b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
@@ -145,12 +145,12 @@
   }
 
   @Override
-  public ConfiguredTarget create(RuleContext context) {
+  public ConfiguredTarget create(RuleContext context) throws InterruptedException {
     return CcBinary.init(semantics, context, /*fake =*/ false, /*useTestOnlyFlags =*/ false);
   }
 
   public static ConfiguredTarget init(CppSemantics semantics, RuleContext ruleContext, boolean fake,
-      boolean useTestOnlyFlags) {
+      boolean useTestOnlyFlags) throws InterruptedException {
     ruleContext.checkSrcsSamePackage(true);
     FeatureConfiguration featureConfiguration = CcCommon.configureFeatures(ruleContext);
     CcCommon common = new CcCommon(ruleContext, featureConfiguration);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
index 63a2320..48423fc 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
@@ -57,7 +57,7 @@
   }
 
   @Override
-  public ConfiguredTarget create(RuleContext ruleContext) {
+  public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException {
     final JavaCommon common = new JavaCommon(ruleContext, semantics);
     DeployArchiveBuilder deployArchiveBuilder =  new DeployArchiveBuilder(semantics, ruleContext);
     Runfiles.Builder runfilesBuilder = new Runfiles.Builder(ruleContext.getWorkspaceName());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaImport.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaImport.java
index 0b86405..64d1b9b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaImport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaImport.java
@@ -46,7 +46,7 @@
   }
 
   @Override
-  public ConfiguredTarget create(RuleContext ruleContext) {
+  public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException {
     ImmutableList<Artifact> srcJars = ImmutableList.of();
     ImmutableList<Artifact> jars = collectJars(ruleContext);
     Artifact srcJar = ruleContext.getPrerequisiteArtifact("srcjar", Mode.TARGET);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaLibrary.java
index 5dcb16d..2991afe 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaLibrary.java
@@ -51,13 +51,14 @@
   }
 
   @Override
-  public ConfiguredTarget create(RuleContext ruleContext) {
+  public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException {
     JavaCommon common = new JavaCommon(ruleContext, semantics);
     RuleConfiguredTargetBuilder builder = init(ruleContext, common);
     return builder != null ? builder.build() : null;
   }
 
-  public RuleConfiguredTargetBuilder init(RuleContext ruleContext, final JavaCommon common) {
+  public RuleConfiguredTargetBuilder init(RuleContext ruleContext, final JavaCommon common)
+      throws InterruptedException {
     common.initializeJavacOpts();
     JavaTargetAttributes.Builder attributesBuilder = common.initCommon();
 
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
index bb7cc83..3bcbd73 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
@@ -288,6 +288,7 @@
 
   /**
    * Adds extra providers to a Java target.
+   * @throws InterruptedException 
    */
   void addProviders(RuleContext ruleContext,
       JavaCommon javaCommon,
@@ -299,7 +300,7 @@
       ImmutableMap<Artifact, Artifact> compilationToRuntimeJarMap,
       JavaCompilationHelper helper,
       NestedSetBuilder<Artifact> filesBuilder,
-      RuleConfiguredTargetBuilder ruleBuilder);
+      RuleConfiguredTargetBuilder ruleBuilder) throws InterruptedException;
 
   /**
    * Tell if a build with the given configuration should use strict java dependencies. This method
@@ -324,10 +325,12 @@
    * @param attributesBuilder the builder to construct the list of attributes of this target
    *        (mutable).
    * @return the launcher as an artifact
+   * @throws InterruptedException 
    */
   Artifact getLauncher(final RuleContext ruleContext, final JavaCommon common,
       DeployArchiveBuilder deployArchiveBuilder, Runfiles.Builder runfilesBuilder,
-      List<String> jvmFlags, JavaTargetAttributes.Builder attributesBuilder, boolean shouldStrip);
+      List<String> jvmFlags, JavaTargetAttributes.Builder attributesBuilder, boolean shouldStrip)
+      throws InterruptedException;
 
   /**
    * Add extra dependencies for runfiles of a Java binary.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java
index 335acb8..d287b62 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java
@@ -49,7 +49,7 @@
 
   @Override
   protected void configureTarget(RuleConfiguredTargetBuilder target, RuleContext ruleContext,
-      ReleaseBundlingSupport releaseBundlingSupport) {
+      ReleaseBundlingSupport releaseBundlingSupport) throws InterruptedException {
     // If this is an application built for the simulator, make it runnable.
     ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext);
     if (objcConfiguration.getBundlingPlatform() == Platform.SIMULATOR) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosExtension.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosExtension.java
index 821fa5e..f90654d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosExtension.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosExtension.java
@@ -59,7 +59,7 @@
   }
 
   @Override
-  protected ObjcProvider exposedObjcProvider(RuleContext ruleContext) {
+  protected ObjcProvider exposedObjcProvider(RuleContext ruleContext) throws InterruptedException {
     // Nest this target's bundle under final IPA
     return new ObjcProvider.Builder()
         .add(MERGE_ZIP, ruleContext.getImplicitOutputArtifact(ReleaseBundlingSupport.IPA))
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFramework.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosFramework.java
index 0774559..d823621 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFramework.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosFramework.java
@@ -100,7 +100,7 @@
   }
 
   @Override
-  protected ObjcProvider exposedObjcProvider(RuleContext ruleContext) {
+  protected ObjcProvider exposedObjcProvider(RuleContext ruleContext) throws InterruptedException {
     // Assemble framework binary and headers in the label-scoped location, so that it's possible to
     // pass -F X.framework to the compiler and -framework X to the linker. This mimics usage of
     // frameworks when built from Xcode.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
index 61d22ad..a7a476b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
@@ -229,8 +229,9 @@
    * multi-architecture binary.
    *
    * @return this application support
+   * @throws InterruptedException 
    */
-  ReleaseBundlingSupport registerActions() {
+  ReleaseBundlingSupport registerActions() throws InterruptedException {
     bundleSupport.registerActions(objcProvider);
 
     registerCombineArchitecturesAction();
@@ -329,7 +330,7 @@
         .build(ruleContext));
   }
 
-  private Artifact registerBundleSigningActions(Artifact ipaOutput) {
+  private Artifact registerBundleSigningActions(Artifact ipaOutput) throws InterruptedException {
     IntermediateArtifacts intermediateArtifacts =
         ObjcRuleClasses.intermediateArtifacts(ruleContext);
     Artifact teamPrefixFile =
@@ -371,10 +372,13 @@
    * top level target in a blaze invocation.
    *
    * @return this application support
+   * @throws InterruptedException 
    */
-  ReleaseBundlingSupport addFilesToBuild(NestedSetBuilder<Artifact> filesToBuild) {
-    NestedSetBuilder<Artifact> debugSymbolBuilder = NestedSetBuilder.<Artifact>stableOrder()
-        .addTransitive(objcProvider.get(ObjcProvider.DEBUG_SYMBOLS));
+  ReleaseBundlingSupport addFilesToBuild(NestedSetBuilder<Artifact> filesToBuild)
+      throws InterruptedException {
+    NestedSetBuilder<Artifact> debugSymbolBuilder =
+        NestedSetBuilder.<Artifact>stableOrder().addTransitive(
+            objcProvider.get(ObjcProvider.DEBUG_SYMBOLS));
 
     for (Artifact breakpadFile : getBreakpadFiles().values()) {
       filesToBuild.add(breakpadFile);
@@ -399,8 +403,9 @@
   /**
    * Creates the {@link XcTestAppProvider} that can be used if this application is used as an
    * {@code xctest_app}.
+   * @throws InterruptedException 
    */
-  XcTestAppProvider xcTestAppProvider() {
+  XcTestAppProvider xcTestAppProvider() throws InterruptedException {
     // We want access to #import-able things from our test rig's dependency graph, but we don't
     // want to link anything since that stuff is shared automatically by way of the
     // -bundle_loader linker flag.
@@ -445,8 +450,9 @@
 
   /**
    * Returns a {@link RunfilesSupport} that uses the provided runner script as the executable.
+   * @throws InterruptedException 
    */
-  RunfilesSupport runfilesSupport(Artifact runnerScript) {
+  RunfilesSupport runfilesSupport(Artifact runnerScript) throws InterruptedException {
     Artifact ipaFile = ruleContext.getImplicitOutputArtifact(ReleaseBundlingSupport.IPA);
     Runfiles runfiles = new Runfiles.Builder(ruleContext.getWorkspaceName())
         .addArtifact(ipaFile)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingTargetFactory.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingTargetFactory.java
index b1d26cc..54aeb67 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingTargetFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingTargetFactory.java
@@ -112,9 +112,10 @@
   /**
    * Performs additional configuration of the target. The default implementation does nothing, but
    * subclasses may override it to add logic.
+   * @throws InterruptedException 
    */
   protected void configureTarget(RuleConfiguredTargetBuilder target, RuleContext ruleContext,
-      ReleaseBundlingSupport releaseBundlingSupport) {}
+      ReleaseBundlingSupport releaseBundlingSupport) throws InterruptedException {}
 
   /**
    * Returns the name of this target's bundle.
@@ -125,9 +126,10 @@
 
   /**
    * Returns an exposed {@code ObjcProvider} object.
+   * @throws InterruptedException 
    */
   @Nullable
-  protected ObjcProvider exposedObjcProvider(RuleContext ruleContext) {
+  protected ObjcProvider exposedObjcProvider(RuleContext ruleContext) throws InterruptedException {
     return null;
   }
 
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/TestSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/TestSupport.java
index 4a5cb16..0b91cf4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/TestSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/TestSupport.java
@@ -55,8 +55,9 @@
 
   /**
    * Registers actions to create all files needed in order to actually run the test.
+   * @throws InterruptedException 
    */
-  public TestSupport registerTestRunnerActions() {
+  public TestSupport registerTestRunnerActions() throws InterruptedException {
     registerTestScriptSubstitutionAction();
     return this;
   }
@@ -68,7 +69,7 @@
     return ObjcRuleClasses.artifactByAppendingToBaseName(ruleContext, "_test_script");
   }
 
-  private void registerTestScriptSubstitutionAction() {
+  private void registerTestScriptSubstitutionAction() throws InterruptedException {
     // testIpa is the app actually containing the tests
     Artifact testIpa = testIpa();
 
@@ -130,7 +131,7 @@
         "target_device", Mode.TARGET, IosTestSubstitutionProvider.class);
   }
 
-  private Artifact testIpa() {
+  private Artifact testIpa() throws InterruptedException {
     return ruleContext.getImplicitOutputArtifact(ReleaseBundlingSupport.IPA);
   }
 
@@ -198,8 +199,10 @@
    * Adds all files needed to run this test to the passed Runfiles builder.
    *
    * @param objcProvider common information about this rule's attributes and its dependencies
+   * @throws InterruptedException 
    */
-  public TestSupport addRunfiles(Builder runfilesBuilder, ObjcProvider objcProvider) {
+  public TestSupport addRunfiles(Builder runfilesBuilder, ObjcProvider objcProvider)
+      throws InterruptedException {
     runfilesBuilder
         .addArtifact(testIpa())
         .addArtifacts(xctestIpa().asSet())
@@ -304,8 +307,10 @@
 
   /**
    * Adds files which must be built in order to run this test to builder.
+   * @throws InterruptedException 
    */
-  public TestSupport addFilesToBuild(NestedSetBuilder<Artifact> builder) {
+  public TestSupport addFilesToBuild(NestedSetBuilder<Artifact> builder)
+      throws InterruptedException {
     builder.add(testIpa()).addAll(xctestIpa().asSet());
     return this;
   }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
index 45f9726..d3979dcd 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
@@ -63,8 +63,10 @@
    * Adds xcode project files to the given builder.
    *
    * @return this xcode support
+   * @throws InterruptedException 
    */
-  XcodeSupport addFilesToBuild(NestedSetBuilder<Artifact> filesToBuild) {
+  XcodeSupport addFilesToBuild(NestedSetBuilder<Artifact> filesToBuild)
+      throws InterruptedException {
     filesToBuild.add(ruleContext.getImplicitOutputArtifact(PBXPROJ));
     return this;
   }
@@ -94,8 +96,9 @@
    *
    * @param xcodeProvider information about this rule's xcode settings and that of its dependencies
    * @return this xcode support
+   * @throws InterruptedException 
    */
-  XcodeSupport registerActions(XcodeProvider xcodeProvider) {
+  XcodeSupport registerActions(XcodeProvider xcodeProvider) throws InterruptedException {
     registerXcodegenActions(XcodeProvider.Project.fromTopLevelTarget(xcodeProvider));
     return this;
   }
@@ -105,8 +108,9 @@
    *
    * @param xcodeProviders information about several rules' xcode settings
    * @return this xcode support
+   * @throws InterruptedException 
    */
-  XcodeSupport registerActions(Iterable<XcodeProvider> xcodeProviders) {
+  XcodeSupport registerActions(Iterable<XcodeProvider> xcodeProviders) throws InterruptedException {
     registerXcodegenActions(Project.fromTopLevelTargets(xcodeProviders));
     return this;
   }
@@ -199,7 +203,7 @@
     return this;
   }
 
-  private void registerXcodegenActions(XcodeProvider.Project project) {
+  private void registerXcodegenActions(XcodeProvider.Project project) throws InterruptedException {
     Artifact controlFile =
         ObjcRuleClasses.intermediateArtifacts(ruleContext).pbxprojControlArtifact();
 
@@ -220,7 +224,8 @@
         .build(ruleContext));
   }
 
-  private ByteSource xcodegenControlFileBytes(final XcodeProvider.Project project) {
+  private ByteSource xcodegenControlFileBytes(final XcodeProvider.Project project)
+      throws InterruptedException {
     final Artifact pbxproj = ruleContext.getImplicitOutputArtifact(XcodeSupport.PBXPROJ);
     final ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext);
     return new ByteSource() {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
index a60e0d7..9cd591a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
@@ -40,7 +40,7 @@
   protected abstract PythonSemantics createSemantics();
 
   @Override
-  public ConfiguredTarget create(RuleContext ruleContext) {
+  public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException {
     PyCommon common = new PyCommon(ruleContext);
     common.initCommon(common.getDefaultPythonVersion());
 
@@ -51,8 +51,8 @@
     return builder.build();
   }
 
-  static RuleConfiguredTargetBuilder init(
-      RuleContext ruleContext, PythonSemantics semantics, PyCommon common) {
+  static RuleConfiguredTargetBuilder init(RuleContext ruleContext, PythonSemantics semantics,
+      PyCommon common) throws InterruptedException {
     CcLinkParamsStore ccLinkParamsStore = initializeCcLinkParamStore(ruleContext);
 
     List<Artifact> srcs = common.validateSrcs();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyTest.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyTest.java
index f433eb8..076005a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PyTest.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyTest.java
@@ -30,7 +30,7 @@
 protected abstract PythonSemantics createSemantics();
 
   @Override
-  public ConfiguredTarget create(RuleContext ruleContext) {
+  public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException {
     PythonSemantics semantics = createSemantics();
     PyCommon common = new PyCommon(ruleContext);
     common.initCommon(getDefaultPythonVersion(ruleContext));
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java
index 3570200..55d421d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java
@@ -65,7 +65,8 @@
 
   /**
    * Called at the end of the analysis of {@code py_binary} rules.
+   * @throws InterruptedException 
    */
   void postInitBinary(RuleContext ruleContext, RunfilesSupport runfilesSupport,
-      PyCommon common);
+      PyCommon common) throws InterruptedException;
 }
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 87523c1..ede34cf 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
@@ -61,7 +61,7 @@
   @Nullable
   @Override
   public SkyValue compute(SkyKey skyKey, Environment env)
-      throws AspectFunctionException {
+      throws AspectFunctionException, InterruptedException {
     SkyframeBuildView view = buildViewProvider.getSkyframeBuildView();
     NestedSetBuilder<Package> transitivePackages = NestedSetBuilder.stableOrder();
     AspectKey key = (AspectKey) skyKey.argument();
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 7fe19c5..ebc1fa7 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
@@ -227,8 +227,7 @@
       AspectDefinition aspectDefinition, AspectParameters aspectParameters, 
       Set<ConfigMatchingProvider> configConditions, RuleClassProvider ruleClassProvider,
       BuildConfiguration hostConfiguration, NestedSetBuilder<Package> transitivePackages)
-      throws DependencyEvaluationException, AspectCreationException {
-
+      throws DependencyEvaluationException, AspectCreationException, InterruptedException {
     // Create the map from attributes to list of (target, configuration) pairs.
     ListMultimap<Attribute, Dependency> depValueNames;
     try {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java
index 315d965..a9b226f 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java
@@ -71,7 +71,8 @@
 
   @Nullable
   @Override
-  public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException {
+  public SkyValue compute(SkyKey skyKey, Environment env)
+      throws SkyFunctionException, InterruptedException {
     ImmutableMap<Action, ConflictException> badActions = PrecomputedValue.BAD_ACTIONS.get(env);
     ConfiguredTargetValue ctValue = (ConfiguredTargetValue)
         env.getValue(ConfiguredTargetValue.key((ConfiguredTargetKey) skyKey.argument()));
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/ASTNode.java b/src/main/java/com/google/devtools/build/lib/syntax/ASTNode.java
index 754035e..0ec6a98 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/ASTNode.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/ASTNode.java
@@ -41,16 +41,16 @@
   protected final EvalException handleException(Exception original) {
     // If there is already a non-empty stack trace, we only add this node iff it describes a
     // new scope (e.g. FuncallExpression).
-    if (original instanceof EvalExceptionWithStackTrace && isNewScope()) {
+    if (original instanceof EvalExceptionWithStackTrace) {
       EvalExceptionWithStackTrace real = (EvalExceptionWithStackTrace) original;
-      real.registerNode(this);
+      if (isNewScope()) {
+        real.registerNode(this);
+      }
       return real;
     }
 
-    // If the exception is an instance of a subclass of EvalException (such as
-    // ReturnStatement.ReturnException and FlowStatement.FlowException), we just return it
-    // unchanged.
-    if (original instanceof EvalException && !original.getClass().equals(EvalException.class)) {
+    // Returns the original exception if it cannot be attached to a stack trace.
+    if (original instanceof EvalException && !((EvalException) original).canBeAddedToStackTrace()) {
       return (EvalException) original;
     }
 
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BaseFunction.java b/src/main/java/com/google/devtools/build/lib/syntax/BaseFunction.java
index 450791d..8ca1d1a 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BaseFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BaseFunction.java
@@ -410,7 +410,7 @@
    * @param ast the expression for this function's definition
    * @param env the Environment in the function is called
    * @return the value resulting from evaluating the function with the given arguments
-   * @throws construction of EvalException-s containing source information.
+   * @throws EvalException-s containing source information.
    */
   public Object call(List<Object> args,
       @Nullable Map<String, Object> kwargs,
@@ -435,6 +435,7 @@
    * @param args an array of argument values sorted as per the signature.
    * @param ast the source code for the function if user-defined
    * @param env the lexical environment of the function call
+   * @throws InterruptedException may be thrown in the function implementations.
    */
   // Don't make it abstract, so that subclasses may be defined that @Override the outer call() only.
   protected Object call(Object[] args,
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/EvalException.java b/src/main/java/com/google/devtools/build/lib/syntax/EvalException.java
index 186153e..aec9f2b 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/EvalException.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/EvalException.java
@@ -159,6 +159,14 @@
   }
 
   /**
+   * Returns whether this exception can be added to a stack trace created by {@link
+   * EvalExceptionWithStackTrace}.
+   */
+  public boolean canBeAddedToStackTrace() {
+    return true;
+  }
+
+  /**
    * A class to support a special case of EvalException when the cause of the error is an
    * Exception during a direct Java call. Allow the throwing code to provide context in a message.
    */
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java b/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
index 7300e4b..9ec6860 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
@@ -34,6 +34,13 @@
     registerNode(culprit);
   }
 
+  @Override
+  public boolean canBeAddedToStackTrace() {
+    // Doesn't make any sense to add this exception to another instance of
+    // EvalExceptionWithStackTrace.
+    return false;
+  }
+
   /**
    * Returns the appropriate location for this exception.
    *
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/FlowStatement.java b/src/main/java/com/google/devtools/build/lib/syntax/FlowStatement.java
index 1af7bfa..32b61c9 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/FlowStatement.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/FlowStatement.java
@@ -82,5 +82,10 @@
     public boolean mustTerminateLoop() {
       return terminateLoop;
     }
+
+    @Override
+    public boolean canBeAddedToStackTrace() {
+      return false;
+    }
   }
 }
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java b/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
index b1ca1f6..04adc5e 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
@@ -1082,7 +1082,7 @@
   private static BuiltinFunction struct = new BuiltinFunction("struct") {
       @SuppressWarnings("unchecked")
     public SkylarkClassObject invoke(Map<String, Object> kwargs, Location loc)
-        throws EvalException, InterruptedException {
+        throws EvalException {
       return new SkylarkClassObject(kwargs, loc);
     }
   };
@@ -1183,7 +1183,7 @@
       useEnvironment = true)
   private static BuiltinFunction enumerate = new BuiltinFunction("enumerate") {
     public Object invoke(Object input, Location loc, Environment env)
-        throws EvalException, ConversionException, InterruptedException {
+        throws EvalException, ConversionException {
       int count = 0;
       List<SkylarkList> result = Lists.newArrayList();
       for (Object obj : Type.OBJECT_LIST.convert(input, "input")) {
@@ -1217,7 +1217,7 @@
   private static final BuiltinFunction range = new BuiltinFunction("range") {
       public Object invoke(Integer startOrStop, Object stopOrNone, Integer step, Location loc,
           Environment env)
-        throws EvalException, ConversionException, InterruptedException {
+        throws EvalException, ConversionException {
       int start;
       int stop;
       if (stopOrNone == Runtime.NONE) {
@@ -1255,7 +1255,7 @@
       mandatoryPositionals = {
         @Param(name = "x", type = Map.class, doc = "The parameter to convert.")})
   private static final BuiltinFunction select = new BuiltinFunction("select") {
-    public Object invoke(Map<?, ?> dict) throws EvalException, InterruptedException {
+    public Object invoke(Map<?, ?> dict) throws EvalException {
       return SelectorList.of(new SelectorValue(dict));
     }
   };
@@ -1412,7 +1412,7 @@
       returnType = SkylarkList.class, useLocation = true)
   private static final BuiltinFunction zip = new BuiltinFunction("zip") {
     public SkylarkList invoke(SkylarkList args, Location loc)
-        throws EvalException, InterruptedException {
+        throws EvalException {
       Iterator<?>[] iterators = new Iterator<?>[args.size()];
       for (int i = 0; i < args.size(); i++) {
         iterators[i] = EvalUtils.toIterable(args.get(i), loc).iterator();
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/ReturnStatement.java b/src/main/java/com/google/devtools/build/lib/syntax/ReturnStatement.java
index 0e377eb..d9302b6 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/ReturnStatement.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/ReturnStatement.java
@@ -34,6 +34,11 @@
     public Object getValue() {
       return value;
     }
+
+    @Override
+    public boolean canBeAddedToStackTrace() {
+      return false;
+    }
   }
 
   private final Expression returnExpression;
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkCallbackFunction.java b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkCallbackFunction.java
index 6140acb..b22c45a 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkCallbackFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkCallbackFunction.java
@@ -31,7 +31,8 @@
     this.funcallEnv = funcallEnv;
   }
 
-  public Object call(ClassObject ctx, Object... arguments) throws EvalException {
+  public Object call(ClassObject ctx, Object... arguments)
+      throws EvalException, InterruptedException {
     try (Mutability mutability = Mutability.create("callback %s", callback)) {
       Environment env = Environment.builder(mutability)
           .setSkylark()
@@ -40,7 +41,7 @@
           .build();
       return callback.call(
           ImmutableList.<Object>builder().add(ctx).add(arguments).build(), null, ast, env);
-    } catch (InterruptedException | ClassCastException | IllegalArgumentException e) {
+    } catch (ClassCastException | IllegalArgumentException e) {
       throw new EvalException(ast.getLocation(), e.getMessage());
     }
   }