aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/Action.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java31
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/BuildView.java34
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/ConfigurationCollectionFactory.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java84
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationEnvironment.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFactory.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFragmentFactory.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/PackageProviderForConfigurations.java29
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/GitRepositoryFunction.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java21
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/MavenServerFunction.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/NewGitRepositoryFunction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java52
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationCollection.java34
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java56
-rw-r--r--src/main/java/com/google/devtools/build/lib/concurrent/ForkJoinQuiescingExecutor.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java9
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java86
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/AttributeMap.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/DelegatingAttributeMapper.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/ExternalPackageBuilder.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Globber.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Package.java37
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Rule.java37
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/PackageProvider.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/RecursivePackageProvider.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/TargetEdgeObserver.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/TargetPatternResolverUtil.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/BlazeTargetAccessor.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/ErrorPrintingTargetEdgeErrorObserver.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/LabelVisitor.java35
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java51
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/TargetEdgeErrorObserver.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java34
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java19
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java26
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/NativeLibs.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfig.java68
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java23
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/ExtraLinkTimeLibrary.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaConfigurationLoader.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfigurationLoader.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/repository/LocalRepositoryFunction.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/repository/NewLocalRepositoryFunction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/repository/NewRepositoryBuildFileHandler.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryFunction.java64
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java27
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationFunction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/CollectPackagesUnderDirectoryFunction.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java21
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationCollectionFunction.java23
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java50
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingFunction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ExternalPackageFunction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/FileStateFunction.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunction.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java22
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageErrorFunction.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java32
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java21
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunction.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/RecursiveDirectoryTraversalFunction.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java21
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunction.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeAwareAction.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeDependencyResolver.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunction.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TargetMarkerFunction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternValue.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternsResultBuilder.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TestSuiteExpansionFunction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TestsInSuiteFunction.java19
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TransitiveBaseTraversalFunction.java32
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTargetFunction.java22
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTraversalFunction.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusFunction.java2
140 files changed, 1034 insertions, 993 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
index 00f918a17a..8bd3f4428a 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
@@ -32,10 +32,8 @@ import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.Symlinks;
-
import java.io.IOException;
import java.util.Collection;
-
import javax.annotation.Nullable;
/**
@@ -154,9 +152,11 @@ public abstract class AbstractAction implements Action, SkylarkValue {
@Nullable
@Override
- public Iterable<Artifact> resolveInputsFromCache(ArtifactResolver artifactResolver,
- PackageRootResolver resolver, Collection<PathFragment> inputPaths)
- throws PackageRootResolutionException {
+ public Iterable<Artifact> resolveInputsFromCache(
+ ArtifactResolver artifactResolver,
+ PackageRootResolver resolver,
+ Collection<PathFragment> inputPaths)
+ throws PackageRootResolutionException, InterruptedException {
throw new IllegalStateException(
"Method must be overridden for actions that may have unknown inputs.");
}
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Action.java b/src/main/java/com/google/devtools/build/lib/actions/Action.java
index 01cf55472f..d7623de017 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/Action.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/Action.java
@@ -19,10 +19,8 @@ import com.google.devtools.build.lib.concurrent.ThreadSafety.ConditionallyThread
import com.google.devtools.build.lib.profiler.Describable;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.io.IOException;
import java.util.Collection;
-
import javax.annotation.Nullable;
/**
@@ -154,25 +152,25 @@ public interface Action extends ActionExecutionMetadata, Describable {
throws ActionExecutionException, InterruptedException;
/**
- * Method used to resolve action inputs based on the information contained in
- * the action cache. It will be called iff inputsKnown() is false for the
- * given action instance and there is a related cache entry in the action
- * cache.
+ * Method used to resolve action inputs based on the information contained in the action cache. It
+ * will be called iff inputsKnown() is false for the given action instance and there is a related
+ * cache entry in the action cache.
*
- * Method must be redefined for any action that may return
- * inputsKnown() == false.
+ * <p>Method must be redefined for any action that may return inputsKnown() == false.
*
* @param artifactResolver the artifact factory that can be used to manufacture artifacts
* @param resolver object which helps to resolve some of the artifacts
* @param inputPaths List of relative (to the execution root) input paths
* @return List of Artifacts corresponding to inputPaths, or null if some dependencies were
- * missing and we need to try again later.
+ * missing and we need to try again later.
* @throws PackageRootResolutionException on failure to determine package roots of inputPaths
*/
@Nullable
Iterable<Artifact> resolveInputsFromCache(
- ArtifactResolver artifactResolver, PackageRootResolver resolver,
- Collection<PathFragment> inputPaths) throws PackageRootResolutionException;
+ ArtifactResolver artifactResolver,
+ PackageRootResolver resolver,
+ Collection<PathFragment> inputPaths)
+ throws PackageRootResolutionException, InterruptedException;
/**
* Informs the action that its inputs are {@code inputs}, and that its inputs are now known. Can
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java b/src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java
index 86cbd0a07f..b96a9e4111 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java
@@ -27,13 +27,11 @@ import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.EventKind;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -242,7 +240,7 @@ public class ActionCacheChecker {
@Nullable
public Iterable<Artifact> getCachedInputs(Action action, PackageRootResolver resolver)
- throws PackageRootResolutionException {
+ throws PackageRootResolutionException, InterruptedException {
ActionCache.Entry entry = getCacheEntry(action);
if (entry == null || entry.isCorrupted()) {
return ImmutableList.of();
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
index 1606c0e783..941ea1554c 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
@@ -26,13 +26,11 @@ import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
-
import javax.annotation.Nullable;
/**
@@ -369,7 +367,7 @@ public class ArtifactFactory implements ArtifactResolver, ArtifactSerializer, Ar
@Override
public synchronized Map<PathFragment, Artifact> resolveSourceArtifacts(
Iterable<PathFragment> execPaths, PackageRootResolver resolver)
- throws PackageRootResolutionException {
+ throws PackageRootResolutionException, InterruptedException {
Map<PathFragment, Artifact> result = new HashMap<>();
ArrayList<PathFragment> unresolvedPaths = new ArrayList<>();
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java b/src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java
index e7ea2f2c5f..58b36c9371 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java
@@ -15,9 +15,7 @@
package com.google.devtools.build.lib.actions;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -69,12 +67,13 @@ public interface ArtifactResolver {
* @param execPaths list of exec paths of the artifacts to resolve
* @param resolver object that helps to resolve package root of given paths
* @return map which contains list of execPaths and corresponding Artifacts. Map can contain
- * existing or new source Artifacts for the given execPaths. The artifact is null if the
- * root cannot be determined and the artifact did not exist before. Return null if any
- * dependencies are missing.
+ * existing or new source Artifacts for the given execPaths. The artifact is null if the root
+ * cannot be determined and the artifact did not exist before. Return null if any dependencies
+ * are missing.
* @throws PackageRootResolutionException failure to determine package roots of {@code execPaths}
*/
@Nullable
- Map<PathFragment, Artifact> resolveSourceArtifacts(Iterable<PathFragment> execPaths,
- PackageRootResolver resolver) throws PackageRootResolutionException;
+ Map<PathFragment, Artifact> resolveSourceArtifacts(
+ Iterable<PathFragment> execPaths, PackageRootResolver resolver)
+ throws PackageRootResolutionException, InterruptedException;
}
diff --git a/src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java b/src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java
index 0db0075ddc..2b7a3ca4d5 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java
@@ -15,9 +15,7 @@
package com.google.devtools.build.lib.actions;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -26,34 +24,33 @@ import javax.annotation.Nullable;
public interface PackageRootResolver {
/**
- * Returns mapping from execPath to Root. Root will be null if the path has no containing
- * package.
+ * Returns mapping from execPath to Root. Root will be null if the path has no containing package.
*
* @param execPaths the paths to find {@link Root}s for. The search for a containing package will
- * start with the path's parent directory, since the path is assumed to be a file.
- * @return mappings from {@code execPath} to {@link Root}, or null if for some reason we
- * cannot determine the result at this time (such as when used within a SkyFunction)
+ * start with the path's parent directory, since the path is assumed to be a file.
+ * @return mappings from {@code execPath} to {@link Root}, or null if for some reason we cannot
+ * determine the result at this time (such as when used within a SkyFunction)
* @throws PackageRootResolutionException if unable to determine package roots or lack thereof,
- * typically caused by exceptions encountered while attempting to locate BUILD files
+ * typically caused by exceptions encountered while attempting to locate BUILD files
*/
@Nullable
Map<PathFragment, Root> findPackageRootsForFiles(Iterable<PathFragment> execPaths)
- throws PackageRootResolutionException;
+ throws PackageRootResolutionException, InterruptedException;
/**
- * Returns mapping from execPath to Root. Root will be null if the path has no containing
- * package. Unlike {@link #findPackageRootsForFiles(Iterable)}, this function allows directories
- * in the list of exec paths.
+ * Returns mapping from execPath to Root. Root will be null if the path has no containing package.
+ * Unlike {@link #findPackageRootsForFiles(Iterable)}, this function allows directories in the
+ * list of exec paths.
*
* @param execPaths the paths to find {@link Root}s for. The search for a containing package will
- * start with the path's parent directory, since the path is assumed to be a file.
- * @return mappings from {@code execPath} to {@link Root}, or null if for some reason we
- * cannot determine the result at this time (such as when used within a SkyFunction)
+ * start with the path's parent directory, since the path is assumed to be a file.
+ * @return mappings from {@code execPath} to {@link Root}, or null if for some reason we cannot
+ * determine the result at this time (such as when used within a SkyFunction)
* @throws PackageRootResolutionException if unable to determine package roots or lack thereof,
- * typically caused by exceptions encountered while attempting to locate BUILD files
+ * typically caused by exceptions encountered while attempting to locate BUILD files
*/
// TODO(bazel-team): Remove this once we don't need to find package roots for directories.
@Nullable
Map<PathFragment, Root> findPackageRoots(Iterable<PathFragment> execPaths)
- throws PackageRootResolutionException;
+ throws PackageRootResolutionException, InterruptedException;
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java
index fcdc3ec4c6..9f9a655069 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java
@@ -127,13 +127,13 @@ public interface AnalysisEnvironment extends ActionRegistry {
* Returns the Artifact that is used to hold the non-volatile workspace status for the current
* build request.
*/
- Artifact getStableWorkspaceStatusArtifact();
+ Artifact getStableWorkspaceStatusArtifact() throws InterruptedException;
/**
- * Returns the Artifact that is used to hold the volatile workspace status (e.g. build
- * changelist) for the current build request.
+ * Returns the Artifact that is used to hold the volatile workspace status (e.g. build changelist)
+ * for the current build request.
*/
- Artifact getVolatileWorkspaceStatusArtifact();
+ Artifact getVolatileWorkspaceStatusArtifact() throws InterruptedException;
/**
* Returns the Artifacts that contain the workspace status for the current build request.
@@ -142,7 +142,8 @@ public interface AnalysisEnvironment extends ActionRegistry {
* @param config the current build configuration.
*/
ImmutableList<Artifact> getBuildInfo(
- RuleContext ruleContext, BuildInfoKey key, BuildConfiguration config);
+ RuleContext ruleContext, BuildInfoKey key, BuildConfiguration config)
+ throws InterruptedException;
/**
* Returns the set of orphan Artifacts (i.e. Artifacts without generating action). Should only be
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 5fed4a32fa..8b5eb241b8 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
@@ -81,7 +81,6 @@ import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.WalkableGraph;
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionsBase;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -568,19 +567,26 @@ public class BuildView {
String error = createErrorMessage(loadingResult, skyframeAnalysisResult);
final WalkableGraph graph = skyframeAnalysisResult.getWalkableGraph();
- final ActionGraph actionGraph = new ActionGraph() {
- @Nullable
- @Override
- public ActionAnalysisMetadata getGeneratingAction(Artifact artifact) {
- ArtifactOwner artifactOwner = artifact.getArtifactOwner();
- if (artifactOwner instanceof ActionLookupValue.ActionLookupKey) {
- SkyKey key = ActionLookupValue.key((ActionLookupValue.ActionLookupKey) artifactOwner);
- ActionLookupValue val = (ActionLookupValue) graph.getValue(key);
- return val == null ? null : val.getGeneratingAction(artifact);
- }
- return null;
- }
- };
+ final ActionGraph actionGraph =
+ new ActionGraph() {
+ @Nullable
+ @Override
+ public ActionAnalysisMetadata getGeneratingAction(Artifact artifact) {
+ ArtifactOwner artifactOwner = artifact.getArtifactOwner();
+ if (artifactOwner instanceof ActionLookupValue.ActionLookupKey) {
+ SkyKey key = ActionLookupValue.key((ActionLookupValue.ActionLookupKey) artifactOwner);
+ ActionLookupValue val;
+ try {
+ val = (ActionLookupValue) graph.getValue(key);
+ } catch (InterruptedException e) {
+ throw new IllegalStateException(
+ "Interruption not expected from this graph: " + key, e);
+ }
+ return val == null ? null : val.getGeneratingAction(artifact);
+ }
+ return null;
+ }
+ };
return new AnalysisResult(
configuredTargets,
aspects,
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java b/src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java
index 5fd3d43822..5aed23d0f9 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java
@@ -37,7 +37,6 @@ import com.google.devtools.build.lib.skyframe.WorkspaceStatusValue;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunction;
-
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
@@ -49,7 +48,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-
import javax.annotation.Nullable;
/**
@@ -287,21 +285,21 @@ public class CachingAnalysisEnvironment implements AnalysisEnvironment {
}
@Override
- public Artifact getStableWorkspaceStatusArtifact() {
+ public Artifact getStableWorkspaceStatusArtifact() throws InterruptedException {
return ((WorkspaceStatusValue) skyframeEnv.getValue(WorkspaceStatusValue.SKY_KEY))
.getStableArtifact();
}
@Override
- public Artifact getVolatileWorkspaceStatusArtifact() {
+ public Artifact getVolatileWorkspaceStatusArtifact() throws InterruptedException {
return ((WorkspaceStatusValue) skyframeEnv.getValue(WorkspaceStatusValue.SKY_KEY))
.getVolatileArtifact();
}
// See SkyframeBuildView#getWorkspaceStatusValues for the code that this method is attempting to
// verify.
- private NullPointerException collectDebugInfoAndCrash(
- BuildInfoKey key, BuildConfiguration config) {
+ private NullPointerException collectDebugInfoAndCrash(BuildInfoKey key, BuildConfiguration config)
+ throws InterruptedException {
String debugInfo = key + " " + config;
Preconditions.checkState(skyframeEnv.valuesMissing(), debugInfo);
Map<BuildInfoKey, BuildInfoFactory> buildInfoFactories = Preconditions.checkNotNull(
@@ -314,7 +312,8 @@ public class CachingAnalysisEnvironment implements AnalysisEnvironment {
@Override
public ImmutableList<Artifact> getBuildInfo(
- RuleContext ruleContext, BuildInfoKey key, BuildConfiguration config) {
+ RuleContext ruleContext, BuildInfoKey key, BuildConfiguration config)
+ throws InterruptedException {
boolean stamp = AnalysisUtils.isStampingEnabled(ruleContext, config);
BuildInfoCollectionValue collectionValue =
(BuildInfoCollectionValue) skyframeEnv.getValue(BuildInfoCollectionValue.key(
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ConfigurationCollectionFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/ConfigurationCollectionFactory.java
index 77c51d9e44..75ac3a0d53 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/ConfigurationCollectionFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/ConfigurationCollectionFactory.java
@@ -21,7 +21,6 @@ import com.google.devtools.build.lib.analysis.config.ConfigurationFactory;
import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException;
import com.google.devtools.build.lib.analysis.config.PackageProviderForConfigurations;
import com.google.devtools.build.lib.events.EventHandler;
-
import javax.annotation.Nullable;
/**
@@ -31,9 +30,10 @@ public interface ConfigurationCollectionFactory {
/**
* Creates the top-level configuration for a build.
*
- * <p>Also it may create a set of BuildConfigurations and define a transition table over them.
- * All configurations during a build should be accessible from this top-level configuration
- * via configuration transitions.
+ * <p>Also it may create a set of BuildConfigurations and define a transition table over them. All
+ * configurations during a build should be accessible from this top-level configuration via
+ * configuration transitions.
+ *
* @param configurationFactory the configuration factory
* @param cache a cache for BuildConfigurations
* @param loadedPackageProvider the package provider
@@ -48,7 +48,8 @@ public interface ConfigurationCollectionFactory {
Cache<String, BuildConfiguration> cache,
PackageProviderForConfigurations loadedPackageProvider,
BuildOptions buildOptions,
- EventHandler errorEventListener) throws InvalidConfigurationException;
+ EventHandler errorEventListener)
+ throws InvalidConfigurationException, InterruptedException;
/**
* Returns the module the given configuration should use for choosing dynamic transitions.
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 6816b42e8d..10703ba8eb 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
@@ -45,14 +45,12 @@ import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.syntax.EvalUtils;
import com.google.devtools.build.lib.util.OrderedSetMultimap;
import com.google.devtools.build.lib.util.Preconditions;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -232,12 +230,15 @@ public abstract class DependencyResolver {
}
}
- private void resolveExplicitAttributes(final RuleResolver depResolver) {
+ private void resolveExplicitAttributes(final RuleResolver depResolver)
+ throws InterruptedException {
depResolver.attributeMap.visitLabels(
new AttributeMap.AcceptsLabelAttribute() {
@Override
- public void acceptLabelAttribute(Label label, Attribute attribute) {
- if (attribute.getType() == BuildType.NODEP_LABEL || attribute.isImplicit()
+ public void acceptLabelAttribute(Label label, Attribute attribute)
+ throws InterruptedException {
+ if (attribute.getType() == BuildType.NODEP_LABEL
+ || attribute.isImplicit()
|| attribute.isLateBound()) {
return;
}
@@ -246,10 +247,8 @@ public abstract class DependencyResolver {
});
}
- /**
- * Resolves the dependencies for all implicit attributes in this rule.
- */
- private void resolveImplicitAttributes(RuleResolver depResolver) {
+ /** Resolves the dependencies for all implicit attributes in this rule. */
+ private void resolveImplicitAttributes(RuleResolver depResolver) throws InterruptedException {
// Since the attributes that come from aspects do not appear in attributeMap, we have to get
// their values from somewhere else. This incidentally means that aspects attributes are not
// configurable. It would be nice if that wasn't the case, but we'd have to revamp how
@@ -455,7 +454,8 @@ public abstract class DependencyResolver {
* @param attrName the name of the attribute to add dependency labels to
* @param labels the dependencies to add
*/
- private void addExplicitDeps(RuleResolver depResolver, String attrName, Iterable<Label> labels) {
+ private void addExplicitDeps(RuleResolver depResolver, String attrName, Iterable<Label> labels)
+ throws InterruptedException {
Rule rule = depResolver.rule;
if (!rule.isAttrDefined(attrName, BuildType.LABEL_LIST)
&& !rule.isAttrDefined(attrName, BuildType.NODEP_LABEL_LIST)) {
@@ -468,13 +468,16 @@ public abstract class DependencyResolver {
}
/**
- * Converts the given multimap of attributes to labels into a multi map of attributes to
- * {@link Dependency} objects using the proper configuration transition for each attribute.
+ * Converts the given multimap of attributes to labels into a multi map of attributes to {@link
+ * Dependency} objects using the proper configuration transition for each attribute.
*
* @throws IllegalArgumentException if the {@code node} does not refer to a {@link Rule} instance
*/
- public final Collection<Dependency> resolveRuleLabels(TargetAndConfiguration node,
- OrderedSetMultimap<Attribute, Label> depLabels, NestedSetBuilder<Label> rootCauses) {
+ public final Collection<Dependency> resolveRuleLabels(
+ TargetAndConfiguration node,
+ OrderedSetMultimap<Attribute, Label> depLabels,
+ NestedSetBuilder<Label> rootCauses)
+ throws InterruptedException {
Preconditions.checkArgument(node.getTarget() instanceof Rule);
Rule rule = (Rule) node.getTarget();
OrderedSetMultimap<Attribute, Dependency> outgoingEdges = OrderedSetMultimap.create();
@@ -489,8 +492,12 @@ public abstract class DependencyResolver {
return outgoingEdges.values();
}
- private void visitPackageGroup(TargetAndConfiguration node, PackageGroup packageGroup,
- NestedSetBuilder<Label> rootCauses, Collection<Dependency> outgoingEdges) {
+ private void visitPackageGroup(
+ TargetAndConfiguration node,
+ PackageGroup packageGroup,
+ NestedSetBuilder<Label> rootCauses,
+ Collection<Dependency> outgoingEdges)
+ throws InterruptedException {
for (Label label : packageGroup.getIncludes()) {
Target target = getTarget(packageGroup, label, rootCauses);
if (target == null) {
@@ -508,7 +515,7 @@ public abstract class DependencyResolver {
}
}
- private ImmutableSet<AspectDescriptor> requiredAspects(
+ private static ImmutableSet<AspectDescriptor> requiredAspects(
@Nullable Aspect aspect, Attribute attribute, final Target target, Rule originalRule) {
if (!(target instanceof Rule)) {
return ImmutableSet.of();
@@ -613,10 +620,10 @@ public abstract class DependencyResolver {
}
/**
- * Resolves the given dep for the given attribute, including determining which
- * configurations to apply to it.
+ * Resolves the given dep for the given attribute, including determining which configurations to
+ * apply to it.
*/
- void resolveDep(Attribute attribute, Label depLabel) {
+ void resolveDep(Attribute attribute, Label depLabel) throws InterruptedException {
Target toTarget = getTarget(rule, depLabel, rootCauses);
if (toTarget == null) {
return; // Skip this round: we still need to Skyframe-evaluate the dep's target.
@@ -633,13 +640,14 @@ public abstract class DependencyResolver {
/**
* Resolves the given dep for the given attribute using a pre-prepared configuration.
*
- * <p>Use this method with care: it skips Bazel's standard config transition semantics
- * ({@link BuildConfiguration#evaluateTransition}). That means attributes passed through here
- * won't obey standard rules on which configurations apply to their deps. This should only
- * be done for special circumstances that really justify the difference. When in doubt, use
- * {@link #resolveDep(Attribute, Label)}.
+ * <p>Use this method with care: it skips Bazel's standard config transition semantics ({@link
+ * BuildConfiguration#evaluateTransition}). That means attributes passed through here won't obey
+ * standard rules on which configurations apply to their deps. This should only be done for
+ * special circumstances that really justify the difference. When in doubt, use {@link
+ * #resolveDep(Attribute, Label)}.
*/
- void resolveDep(Attribute attribute, Label depLabel, BuildConfiguration config) {
+ void resolveDep(Attribute attribute, Label depLabel, BuildConfiguration config)
+ throws InterruptedException {
Target toTarget = getTarget(rule, depLabel, rootCauses);
if (toTarget == null) {
return; // Skip this round: this is either a loading error or unevaluated Skyframe dep.
@@ -686,8 +694,11 @@ public abstract class DependencyResolver {
}
}
- private void visitTargetVisibility(TargetAndConfiguration node,
- NestedSetBuilder<Label> rootCauses, Collection<Dependency> outgoingEdges) {
+ private void visitTargetVisibility(
+ TargetAndConfiguration node,
+ NestedSetBuilder<Label> rootCauses,
+ Collection<Dependency> outgoingEdges)
+ throws InterruptedException {
Target target = node.getTarget();
for (Label label : target.getVisibility().getDependencyLabels()) {
Target visibilityTarget = getTarget(target, label, rootCauses);
@@ -733,22 +744,24 @@ public abstract class DependencyResolver {
* @param to the missing target
* @param e the exception that was thrown, e.g., by {@link #getTarget}
*/
- protected abstract void missingEdgeHook(Target from, Label to, NoSuchThingException e);
+ protected abstract void missingEdgeHook(Target from, Label to, NoSuchThingException e)
+ throws InterruptedException;
/**
* Returns the target by the given label.
*
* <p>Returns null if the target is not ready to be returned at this moment. If getTarget returns
* null once or more during a {@link #dependentNodeMap} call, the results of that call will be
- * incomplete. For use within Skyframe, where several iterations may be needed to discover
- * all dependencies.
+ * incomplete. For use within Skyframe, where several iterations may be needed to discover all
+ * dependencies.
*/
@Nullable
- protected abstract Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses);
+ protected abstract Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses)
+ throws InterruptedException;
/**
- * Returns the build configurations with the given options and fragments, in the same order as
- * the input options.
+ * Returns the build configurations with the given options and fragments, in the same order as the
+ * input options.
*
* <p>Returns null if any configurations aren't ready to be returned at this moment. If
* getConfigurations returns null once or more during a {@link #dependentNodeMap} call, the
@@ -758,5 +771,6 @@ public abstract class DependencyResolver {
@Nullable
protected abstract List<BuildConfiguration> getConfigurations(
Set<Class<? extends BuildConfiguration.Fragment>> fragments,
- Iterable<BuildOptions> buildOptions) throws InvalidConfigurationException;
+ Iterable<BuildOptions> buildOptions)
+ throws InvalidConfigurationException, InterruptedException;
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java b/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java
index a908ada500..6a27b5c2a1 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java
@@ -71,7 +71,7 @@ public final class RedirectChaser {
*/
@Nullable
public static Label followRedirects(ConfigurationEnvironment env, Label label, String name)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
Label oldLabel = null;
Set<Label> visitedLabels = new HashSet<>();
visitedLabels.add(label);
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 321c385d07..a829195965 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
@@ -391,7 +391,7 @@ public final class RuleContext extends TargetContext
return getAnalysisEnvironment().getOwner();
}
- public ImmutableList<Artifact> getBuildInfo(BuildInfoKey key) {
+ public ImmutableList<Artifact> getBuildInfo(BuildInfoKey key) throws InterruptedException {
return getAnalysisEnvironment().getBuildInfo(this, key, getConfiguration());
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationEnvironment.java b/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationEnvironment.java
index d2439acf6d..ec55f60e8e 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationEnvironment.java
@@ -24,9 +24,7 @@ import com.google.devtools.build.lib.packages.Package;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.pkgcache.LoadedPackageProvider;
import com.google.devtools.build.lib.pkgcache.PackageProvider;
-import com.google.devtools.build.lib.pkgcache.TargetProvider;
import com.google.devtools.build.lib.vfs.Path;
-
import javax.annotation.Nullable;
/**
@@ -48,18 +46,19 @@ public interface ConfigurationEnvironment {
*
* @see TargetProvider#getTarget
*/
- Target getTarget(Label label) throws NoSuchPackageException, NoSuchTargetException;
+ Target getTarget(Label label)
+ throws NoSuchPackageException, NoSuchTargetException, InterruptedException;
/** Returns a path for the given file within the given package. */
- Path getPath(Package pkg, String fileName);
-
+ Path getPath(Package pkg, String fileName) throws InterruptedException;
+
/** Returns fragment based on fragment class and build options. */
- <T extends Fragment> T getFragment(BuildOptions buildOptions, Class<T> fragmentType)
- throws InvalidConfigurationException;
+ <T extends Fragment> T getFragment(BuildOptions buildOptions, Class<T> fragmentType)
+ throws InvalidConfigurationException, InterruptedException;
/** Returns global value of BlazeDirectories. */
@Nullable
- BlazeDirectories getBlazeDirectories();
+ BlazeDirectories getBlazeDirectories() throws InterruptedException;
/**
* An implementation backed by a {@link PackageProvider} instance.
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFactory.java
index 31eb150cab..595f5271d2 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFactory.java
@@ -22,11 +22,9 @@ import com.google.devtools.build.lib.analysis.config.BuildConfiguration.Fragment
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadCompatible;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.util.Preconditions;
-
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -69,23 +67,27 @@ public final class ConfigurationFactory {
@Nullable
public BuildConfiguration createConfigurations(
Cache<String, BuildConfiguration> cache,
- PackageProviderForConfigurations loadedPackageProvider, BuildOptions buildOptions,
+ PackageProviderForConfigurations loadedPackageProvider,
+ BuildOptions buildOptions,
EventHandler errorEventListener)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
return configurationCollectionFactory.createConfigurations(this, cache,
loadedPackageProvider, buildOptions, errorEventListener);
}
/**
- * Returns a {@link com.google.devtools.build.lib.analysis.config.BuildConfiguration} based on
- * the given set of build options.
+ * Returns a {@link com.google.devtools.build.lib.analysis.config.BuildConfiguration} based on the
+ * given set of build options.
*
* <p>If the configuration has already been created, re-uses it, otherwise, creates a new one.
*/
@Nullable
- public BuildConfiguration getConfiguration(PackageProviderForConfigurations loadedPackageProvider,
- BuildOptions buildOptions, boolean actionsDisabled, Cache<String, BuildConfiguration> cache)
- throws InvalidConfigurationException {
+ public BuildConfiguration getConfiguration(
+ PackageProviderForConfigurations loadedPackageProvider,
+ BuildOptions buildOptions,
+ boolean actionsDisabled,
+ Cache<String, BuildConfiguration> cache)
+ throws InvalidConfigurationException, InterruptedException {
String cacheKey = buildOptions.computeCacheKey();
BuildConfiguration result = cache.getIfPresent(cacheKey);
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFragmentFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFragmentFactory.java
index 1ae9a66bb0..0c19502324 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFragmentFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/ConfigurationFragmentFactory.java
@@ -15,7 +15,6 @@ package com.google.devtools.build.lib.analysis.config;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration.Fragment;
-
import javax.annotation.Nullable;
/**
@@ -31,7 +30,7 @@ public interface ConfigurationFragmentFactory {
*/
@Nullable
BuildConfiguration.Fragment create(ConfigurationEnvironment env, BuildOptions buildOptions)
- throws InvalidConfigurationException;
+ throws InvalidConfigurationException, InterruptedException;
/**
* @return the exact type of the fragment this factory creates.
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/PackageProviderForConfigurations.java b/src/main/java/com/google/devtools/build/lib/analysis/config/PackageProviderForConfigurations.java
index dddc786209..e493e482b4 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/PackageProviderForConfigurations.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/PackageProviderForConfigurations.java
@@ -22,7 +22,6 @@ import com.google.devtools.build.lib.packages.NoSuchPackageException;
import com.google.devtools.build.lib.packages.NoSuchTargetException;
import com.google.devtools.build.lib.packages.Package;
import com.google.devtools.build.lib.packages.Target;
-
import java.io.IOException;
/**
@@ -35,18 +34,15 @@ public interface PackageProviderForConfigurations {
* Adds dependency to fileName if needed. Used only in skyframe, for creating correct dependencies
* for {@link com.google.devtools.build.lib.skyframe.ConfigurationCollectionValue}.
*/
- void addDependency(Package pkg, String fileName) throws LabelSyntaxException, IOException;
-
- /**
- * Returns fragment based on fragment type and build options.
- */
- <T extends Fragment> T getFragment(BuildOptions buildOptions, Class<T> fragmentType)
- throws InvalidConfigurationException;
-
- /**
- * Returns blaze directories and adds dependency to that value.
- */
- BlazeDirectories getDirectories();
+ void addDependency(Package pkg, String fileName)
+ throws LabelSyntaxException, IOException, InterruptedException;
+
+ /** Returns fragment based on fragment type and build options. */
+ <T extends Fragment> T getFragment(BuildOptions buildOptions, Class<T> fragmentType)
+ throws InvalidConfigurationException, InterruptedException;
+
+ /** Returns blaze directories and adds dependency to that value. */
+ BlazeDirectories getDirectories() throws InterruptedException;
/**
* Returns true if any dependency is missing (value of some node hasn't been evaluated yet).
@@ -59,8 +55,9 @@ public interface PackageProviderForConfigurations {
* function evaluation.
*
* @throws NoSuchPackageException if the package could not be found
- * @throws NoSuchTargetException if the package was loaded successfully, but
- * the specified {@link Target} was not found in it
+ * @throws NoSuchTargetException if the package was loaded successfully, but the specified {@link
+ * Target} was not found in it
*/
- Target getTarget(Label label) throws NoSuchPackageException, NoSuchTargetException;
+ Target getTarget(Label label)
+ throws NoSuchPackageException, NoSuchTargetException, InterruptedException;
}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/GitRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/GitRepositoryFunction.java
index 0ba5c0f5e5..55c30dd316 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/GitRepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/GitRepositoryFunction.java
@@ -23,10 +23,8 @@ import com.google.devtools.build.lib.rules.repository.RepositoryFunction;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
-import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
/**
@@ -42,14 +40,13 @@ public class GitRepositoryFunction extends RepositoryFunction {
@Override
public SkyValue fetch(
Rule rule, Path outputDirectory, BlazeDirectories directories, Environment env)
- throws SkyFunctionException {
+ throws InterruptedException, RepositoryFunctionException {
createDirectory(outputDirectory, rule);
GitCloner.clone(rule, outputDirectory, env.getListener(), clientEnvironment);
return RepositoryDirectoryValue.create(outputDirectory);
}
- protected void createDirectory(Path path, Rule rule)
- throws RepositoryFunctionException {
+ protected static void createDirectory(Path path, Rule rule) throws RepositoryFunctionException {
try {
FileSystemUtils.createDirectoryAndParents(path);
} catch (IOException e) {
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java
index 28c4a00dcc..a18b4e089c 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java
@@ -23,12 +23,10 @@ import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.bazel.repository.downloader.HttpDownloader;
import com.google.devtools.build.lib.bazel.rules.workspace.MavenJarRule;
-import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.packages.AggregatingAttributeMapper;
import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.rules.repository.RepositoryDirectoryValue;
-import com.google.devtools.build.lib.rules.repository.RepositoryFunction;
import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.Fingerprint;
@@ -36,7 +34,9 @@ import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyValue;
-
+import java.io.IOException;
+import java.util.Map;
+import javax.annotation.Nullable;
import org.apache.maven.settings.Server;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
@@ -50,11 +50,6 @@ import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
-import java.io.IOException;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
/**
* Implementation of maven_jar.
*/
@@ -68,7 +63,7 @@ public class MavenJarFunction extends HttpArchiveFunction {
@Override
protected byte[] getRuleSpecificMarkerData(Rule rule, Environment env)
- throws RepositoryFunctionException {
+ throws RepositoryFunctionException, InterruptedException {
MavenServerValue serverValue = getServer(rule, env);
if (env.valuesMissing()) {
return null;
@@ -80,11 +75,11 @@ public class MavenJarFunction extends HttpArchiveFunction {
.digestAndReset();
}
- private MavenServerValue getServer(Rule rule, Environment env)
- throws RepositoryFunctionException {
+ private static MavenServerValue getServer(Rule rule, Environment env)
+ throws RepositoryFunctionException, InterruptedException {
AggregatingAttributeMapper mapper = AggregatingAttributeMapper.of(rule);
- boolean hasRepository = mapper.has("repository", Type.STRING)
- && !mapper.get("repository", Type.STRING).isEmpty();
+ boolean hasRepository =
+ mapper.has("repository", Type.STRING) && !mapper.get("repository", Type.STRING).isEmpty();
boolean hasServer = mapper.has("server", Type.STRING)
&& !mapper.get("server", Type.STRING).isEmpty();
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenServerFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenServerFunction.java
index 73bfe2682c..ea85f50c80 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenServerFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenServerFunction.java
@@ -31,12 +31,14 @@ import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction;
-import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Map;
+import javax.annotation.Nullable;
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.building.DefaultSettingsBuilder;
@@ -45,12 +47,6 @@ import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
import org.apache.maven.settings.building.SettingsBuildingException;
import org.apache.maven.settings.building.SettingsBuildingResult;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
/**
* Implementation of maven_repository.
*/
@@ -66,7 +62,7 @@ public class MavenServerFunction implements SkyFunction {
@Nullable
@Override
public SkyValue compute(SkyKey skyKey, Environment env)
- throws SkyFunctionException {
+ throws InterruptedException, RepositoryFunctionException {
String repository = (String) skyKey.argument();
Rule repositoryRule = null;
try {
@@ -175,7 +171,7 @@ public class MavenServerFunction implements SkyFunction {
}
private Map<String, FileValue> getDefaultSettingsFile(
- BlazeDirectories directories, Environment env) {
+ BlazeDirectories directories, Environment env) throws InterruptedException {
// The system settings file is at $M2_HOME/conf/settings.xml.
String m2Home = System.getenv("M2_HOME");
ImmutableList.Builder<SkyKey> settingsFilesBuilder = ImmutableList.builder();
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/NewGitRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/NewGitRepositoryFunction.java
index 4a8c56fb5c..e41695f5ea 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/NewGitRepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/NewGitRepositoryFunction.java
@@ -20,7 +20,6 @@ import com.google.devtools.build.lib.rules.repository.NewRepositoryBuildFileHand
import com.google.devtools.build.lib.rules.repository.RepositoryDirectoryValue;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
-import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyValue;
/**
@@ -30,7 +29,7 @@ public class NewGitRepositoryFunction extends GitRepositoryFunction {
@Override
public SkyValue fetch(
Rule rule, Path outputDirectory, BlazeDirectories directories, Environment env)
- throws SkyFunctionException {
+ throws InterruptedException, RepositoryFunctionException {
NewRepositoryBuildFileHandler buildFileHandler =
new NewRepositoryBuildFileHandler(directories.getWorkspace());
if (!buildFileHandler.prepareBuildFile(rule, env)) {
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
index 4ed66e965b..bfe4aec0a0 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
@@ -142,11 +142,12 @@ public class SkylarkRepositoryContext {
+ "during the analysis phase and thus cannot depends on a target result (the "
+ "label should point to a non-generated file)."
)
- public SkylarkPath path(Object path) throws EvalException {
+ public SkylarkPath path(Object path) throws EvalException, InterruptedException {
return getPath("path()", path);
}
- private SkylarkPath getPath(String method, Object path) throws EvalException {
+ private SkylarkPath getPath(String method, Object path)
+ throws EvalException, InterruptedException {
if (path instanceof String) {
PathFragment pathFragment = new PathFragment(path.toString());
return new SkylarkPath(pathFragment.isAbsolute()
@@ -171,7 +172,8 @@ public class SkylarkRepositoryContext {
"Create a symlink on the filesystem, the destination of the symlink should be in the "
+ "output directory. <code>from</code> can also be a label to a file."
)
- public void symlink(Object from, Object to) throws RepositoryFunctionException, EvalException {
+ public void symlink(Object from, Object to)
+ throws RepositoryFunctionException, EvalException, InterruptedException {
SkylarkPath fromPath = getPath("symlink()", from);
SkylarkPath toPath = getPath("symlink()", to);
try {
@@ -198,26 +200,25 @@ public class SkylarkRepositoryContext {
}
@SkylarkCallable(name = "file", documented = false)
- public void createFile(Object path) throws RepositoryFunctionException, EvalException {
+ public void createFile(Object path)
+ throws RepositoryFunctionException, EvalException, InterruptedException {
createFile(path, "");
}
- @SkylarkCallable(
- name = "file",
- documented = false
- )
+ @SkylarkCallable(name = "file", documented = false)
public void createFile(Object path, String content)
- throws RepositoryFunctionException, EvalException {
+ throws RepositoryFunctionException, EvalException, InterruptedException {
createFile(path, content, true);
}
@SkylarkCallable(
name = "file",
- doc = "Generate a file in the output directory with the provided content. An optional third "
- + "argument set the executable bit to on or off (default to True)."
+ doc =
+ "Generate a file in the output directory with the provided content. An optional third "
+ + "argument set the executable bit to on or off (default to True)."
)
public void createFile(Object path, String content, Boolean executable)
- throws RepositoryFunctionException, EvalException {
+ throws RepositoryFunctionException, EvalException, InterruptedException {
SkylarkPath p = getPath("file()", path);
try {
checkInOutputDirectory(p);
@@ -233,28 +234,25 @@ public class SkylarkRepositoryContext {
}
}
- @SkylarkCallable(
- name = "template",
- documented = false
- )
+ @SkylarkCallable(name = "template", documented = false)
public void createFileFromTemplate(
Object path, Object template, Map<String, String> substitutions)
- throws RepositoryFunctionException, EvalException {
+ throws RepositoryFunctionException, EvalException, InterruptedException {
createFileFromTemplate(path, template, substitutions, true);
}
@SkylarkCallable(
- name = "template",
- doc =
- "Generate a new file using a <code>template</code>. Every occurrence in "
- + "<code>template</code> of a key of <code>substitutions</code> will be replaced by "
- + "the corresponding value. The result is written in <code>path</code>. An optional"
- + "<code>executable</code> argument (default to true) can be set to turn on or off"
- + "the executable bit."
+ name = "template",
+ doc =
+ "Generate a new file using a <code>template</code>. Every occurrence in "
+ + "<code>template</code> of a key of <code>substitutions</code> will be replaced by "
+ + "the corresponding value. The result is written in <code>path</code>. An optional"
+ + "<code>executable</code> argument (default to true) can be set to turn on or off"
+ + "the executable bit."
)
public void createFileFromTemplate(
- Object path, Object template, Map<String, String> substitutions, Boolean executable)
- throws RepositoryFunctionException, EvalException {
+ Object path, Object template, Map<String, String> substitutions, Boolean executable)
+ throws RepositoryFunctionException, EvalException, InterruptedException {
SkylarkPath p = getPath("template()", path);
SkylarkPath t = getPath("template()", template);
try {
@@ -522,7 +520,7 @@ public class SkylarkRepositoryContext {
}
// Resolve the label given by value into a file path.
- private SkylarkPath getPathFromLabel(Label label) throws EvalException {
+ private SkylarkPath getPathFromLabel(Label label) throws EvalException, InterruptedException {
// Look for package.
if (label.getPackageIdentifier().getRepository().isDefault()) {
try {
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationCollection.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationCollection.java
index 4db1a92b53..0bc74f4948 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationCollection.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationCollection.java
@@ -35,11 +35,9 @@ import com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition;
import com.google.devtools.build.lib.packages.Attribute.SplitTransition;
import com.google.devtools.build.lib.packages.Attribute.Transition;
import com.google.devtools.build.lib.rules.cpp.CppRuleClasses.LipoTransition;
-
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -53,7 +51,8 @@ public class BazelConfigurationCollection implements ConfigurationCollectionFact
Cache<String, BuildConfiguration> cache,
PackageProviderForConfigurations packageProvider,
BuildOptions buildOptions,
- EventHandler eventHandler) throws InvalidConfigurationException {
+ EventHandler eventHandler)
+ throws InvalidConfigurationException, InterruptedException {
// Target configuration
BuildConfiguration targetConfiguration = configurationFactory.getConfiguration(
packageProvider, buildOptions, false, cache);
@@ -114,29 +113,28 @@ public class BazelConfigurationCollection implements ConfigurationCollectionFact
}
/**
- * Gets the correct host configuration for this build. The behavior
- * depends on the value of the --distinct_host_configuration flag.
+ * Gets the correct host configuration for this build. The behavior depends on the value of the
+ * --distinct_host_configuration flag.
*
- * <p>With --distinct_host_configuration=false, we use identical configurations
- * for the host and target, and you can ignore everything below. But please
- * note: if you're cross-compiling for k8 on a piii machine, your build will
- * fail. This is a stopgap measure.
+ * <p>With --distinct_host_configuration=false, we use identical configurations for the host and
+ * target, and you can ignore everything below. But please note: if you're cross-compiling for k8
+ * on a piii machine, your build will fail. This is a stopgap measure.
*
- * <p>Currently, every build is (in effect) a cross-compile, in the strict
- * sense that host and target configurations are unequal, thus we do not
- * issue a "cross-compiling" warning. (Perhaps we should?)
- * *
- * @param requestConfig the requested target (not host!) configuration for
- * this build.
+ * <p>Currently, every build is (in effect) a cross-compile, in the strict sense that host and
+ * target configurations are unequal, thus we do not issue a "cross-compiling" warning. (Perhaps
+ * we should?) *
+ *
+ * @param requestConfig the requested target (not host!) configuration for this build.
* @param buildOptions the configuration options used for the target configuration
*/
@Nullable
- private BuildConfiguration getHostConfigurationFromRequest(
+ private static BuildConfiguration getHostConfigurationFromRequest(
ConfigurationFactory configurationFactory,
PackageProviderForConfigurations loadedPackageProvider,
- BuildConfiguration requestConfig, BuildOptions buildOptions,
+ BuildConfiguration requestConfig,
+ BuildOptions buildOptions,
Cache<String, BuildConfiguration> cache)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
BuildConfiguration.Options commonOptions = buildOptions.get(BuildConfiguration.Options.class);
if (!commonOptions.useDistinctHostConfiguration) {
return requestConfig;
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java
index b30dae6afb..f26bfc93c2 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java
@@ -44,11 +44,9 @@ import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.CTool
import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.CrosstoolRelease;
import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.ToolPath;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
-import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -80,7 +78,7 @@ public class AndroidNdkRepositoryFunction extends RepositoryFunction {
@Override
public SkyValue fetch(
Rule rule, Path outputDirectory, BlazeDirectories directories, Environment env)
- throws SkyFunctionException {
+ throws InterruptedException, RepositoryFunctionException {
prepareLocalRepositorySymlinkTree(rule, outputDirectory);
PathFragment pathFragment = getTargetPath(rule, directories.getWorkspace());
Path ndkSymlinkTreeDirectory = outputDirectory.getRelative("ndk");
@@ -267,7 +265,7 @@ public class AndroidNdkRepositoryFunction extends RepositoryFunction {
}
private static NdkRelease getNdkRelease(Path directory, Environment env)
- throws RepositoryFunctionException {
+ throws RepositoryFunctionException, InterruptedException {
// For NDK r11+
Path releaseFilePath = directory.getRelative("ndk/source.properties");
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java
index 7285c056bf..5852a19012 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java
@@ -33,7 +33,6 @@ import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
import java.util.Properties;
@@ -49,7 +48,7 @@ public class AndroidSdkRepositoryFunction extends RepositoryFunction {
@Override
public SkyValue fetch(
Rule rule, Path outputDirectory, BlazeDirectories directories, Environment env)
- throws SkyFunctionException {
+ throws SkyFunctionException, InterruptedException {
prepareLocalRepositorySymlinkTree(rule, outputDirectory);
PathFragment pathFragment = getTargetPath(rule, directories.getWorkspace());
@@ -111,7 +110,7 @@ public class AndroidSdkRepositoryFunction extends RepositoryFunction {
private static Properties getBuildToolsSourceProperties(
Path directory, String buildToolsDirectory, Environment env)
- throws RepositoryFunctionException {
+ throws RepositoryFunctionException, InterruptedException {
Path sourcePropertiesFilePath = directory.getRelative(
"build-tools/" + buildToolsDirectory + "/source.properties");
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java
index 418130b9eb..479bfce47f 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java
@@ -42,7 +42,6 @@ import com.google.devtools.build.lib.packages.TargetUtils;
import com.google.devtools.build.lib.rules.RuleConfiguredTargetFactory;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.List;
import java.util.Map;
@@ -62,7 +61,8 @@ public class GenRule implements RuleConfiguredTargetFactory {
}
@Override
- public ConfiguredTarget create(RuleContext ruleContext) throws RuleErrorException {
+ public ConfiguredTarget create(RuleContext ruleContext)
+ throws RuleErrorException, InterruptedException {
final List<Artifact> resolvedSrcs = Lists.newArrayList();
final NestedSet<Artifact> filesToBuild =
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java b/src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java
index 8dc0f0a76a..a3aea666c7 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java
@@ -95,7 +95,7 @@ public interface TargetPatternResolver<T> {
* Returns true, if and only if the given package identifier corresponds to a package, i.e., a
* file with the name {@code packageName/BUILD} exists in the appropriat repository.
*/
- boolean isPackage(PackageIdentifier packageIdentifier);
+ boolean isPackage(PackageIdentifier packageIdentifier) throws InterruptedException;
/**
* Returns the target kind of the given target, for example {@code cc_library rule}.
diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java b/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java
index baab8847e7..01cdca1d3e 100644
--- a/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java
+++ b/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java
@@ -20,7 +20,6 @@ import com.google.common.util.concurrent.AtomicLongMap;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.devtools.build.lib.concurrent.ErrorClassifier.ErrorClassification;
import com.google.devtools.build.lib.util.Preconditions;
-
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
@@ -29,7 +28,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import javax.annotation.Nullable;
/** A {@link QuiescingExecutor} implementation that wraps an {@link ExecutorService}. */
@@ -143,7 +141,6 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
private final boolean ownExecutorService;
private final ErrorClassifier errorClassifier;
- private final ErrorHandler errorHandler;
private static final Logger LOG = Logger.getLogger(AbstractQueueVisitor.class.getName());
@@ -176,25 +173,23 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
failFastOnException,
poolName,
EXECUTOR_FACTORY,
- ErrorClassifier.DEFAULT,
- ErrorHandler.NullHandler.INSTANCE);
+ ErrorClassifier.DEFAULT);
}
/**
* Create the {@link AbstractQueueVisitor}.
*
* @param concurrent {@code true} if concurrency should be enabled. Only set to {@code false} for
- * debugging.
+ * debugging.
* @param parallelism a measure of parallelism for the {@link ExecutorService}, such as {@code
- * parallelism} in {@link java.util.concurrent.ForkJoinPool}, or both {@code
- * corePoolSize} and {@code maximumPoolSize} in {@link ThreadPoolExecutor}.
+ * parallelism} in {@link java.util.concurrent.ForkJoinPool}, or both {@code corePoolSize} and
+ * {@code maximumPoolSize} in {@link ThreadPoolExecutor}.
* @param keepAliveTime the keep-alive time for the {@link ExecutorService}, if applicable.
* @param units the time units of keepAliveTime.
* @param failFastOnException if {@code true}, don't run new actions after an uncaught exception.
* @param poolName sets the name of threads spawned by the {@link ExecutorService}. If {@code
- * null}, default thread naming will be used.
+ * null}, default thread naming will be used.
* @param errorClassifier an error classifier used to determine whether to log and/or stop jobs.
- * @param errorHandler a handler for classified errors.
*/
public AbstractQueueVisitor(
boolean concurrent,
@@ -203,8 +198,7 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
TimeUnit units,
boolean failFastOnException,
String poolName,
- ErrorClassifier errorClassifier,
- ErrorHandler errorHandler) {
+ ErrorClassifier errorClassifier) {
this(
concurrent,
parallelism,
@@ -213,27 +207,25 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
failFastOnException,
poolName,
EXECUTOR_FACTORY,
- errorClassifier,
- errorHandler);
+ errorClassifier);
}
/**
* Create the {@link AbstractQueueVisitor}.
*
* @param concurrent {@code true} if concurrency should be enabled. Only set to {@code false} for
- * debugging.
+ * debugging.
* @param parallelism a measure of parallelism for the {@link ExecutorService}, such as {@code
- * parallelism} in {@link java.util.concurrent.ForkJoinPool}, or both {@code
- * corePoolSize} and {@code maximumPoolSize} in {@link ThreadPoolExecutor}.
+ * parallelism} in {@link java.util.concurrent.ForkJoinPool}, or both {@code corePoolSize} and
+ * {@code maximumPoolSize} in {@link ThreadPoolExecutor}.
* @param keepAliveTime the keep-alive time for the {@link ExecutorService}, if applicable.
* @param units the time units of keepAliveTime.
* @param failFastOnException if {@code true}, don't run new actions after an uncaught exception.
* @param poolName sets the name of threads spawned by the {@link ExecutorService}. If {@code
- * null}, default thread naming will be used.
+ * null}, default thread naming will be used.
* @param executorFactory the factory for constructing the executor service if {@code concurrent}
- * is {@code true}.
+ * is {@code true}.
* @param errorClassifier an error classifier used to determine whether to log and/or stop jobs.
- * @param errorHandler a handler for classified errors.
*/
public AbstractQueueVisitor(
boolean concurrent,
@@ -243,8 +235,7 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
boolean failFastOnException,
String poolName,
Function<ExecutorParams, ? extends ExecutorService> executorFactory,
- ErrorClassifier errorClassifier,
- ErrorHandler errorHandler) {
+ ErrorClassifier errorClassifier) {
Preconditions.checkNotNull(poolName);
Preconditions.checkNotNull(executorFactory);
Preconditions.checkNotNull(errorClassifier);
@@ -258,7 +249,6 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
parallelism, keepAliveTime, units, poolName, new BlockingStack<Runnable>()))
: null;
this.errorClassifier = errorClassifier;
- this.errorHandler = errorHandler;
}
/**
@@ -278,8 +268,7 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
executorService,
shutdownOnCompletion,
failFastOnException,
- ErrorClassifier.DEFAULT,
- ErrorHandler.NullHandler.INSTANCE);
+ ErrorClassifier.DEFAULT);
}
/**
@@ -305,37 +294,32 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
this.ownExecutorService = shutdownOnCompletion;
this.executorService = executorService;
this.errorClassifier = ErrorClassifier.DEFAULT;
- this.errorHandler = ErrorHandler.NullHandler.INSTANCE;
}
/**
* Create the AbstractQueueVisitor.
*
* @param concurrent if {@code false}, run tasks inline instead of using the {@link
- * ExecutorService}.
+ * ExecutorService}.
* @param executorService The {@link ExecutorService} to use.
* @param shutdownOnCompletion If {@code true}, pass ownership of the {@link ExecutorService} to
- * this class. The service will be shut down after a
- * call to {@link #awaitQuiescence}. Callers must not shut down the
- * {@link ExecutorService} while queue visitors use it.
+ * this class. The service will be shut down after a call to {@link #awaitQuiescence}. Callers
+ * must not shut down the {@link ExecutorService} while queue visitors use it.
* @param failFastOnException if {@code true}, don't run new actions after an uncaught exception.
* @param errorClassifier an error classifier used to determine whether to log and/or stop jobs.
- * @param errorHandler a handler for classified errors.
*/
public AbstractQueueVisitor(
boolean concurrent,
ExecutorService executorService,
boolean shutdownOnCompletion,
boolean failFastOnException,
- ErrorClassifier errorClassifier,
- ErrorHandler errorHandler) {
+ ErrorClassifier errorClassifier) {
Preconditions.checkArgument(executorService != null || !concurrent);
this.concurrent = concurrent;
this.failFastOnException = failFastOnException;
this.ownExecutorService = shutdownOnCompletion;
this.executorService = executorService;
this.errorClassifier = errorClassifier;
- this.errorHandler = errorHandler;
}
/**
@@ -358,8 +342,7 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
false,
poolName,
EXECUTOR_FACTORY,
- ErrorClassifier.DEFAULT,
- ErrorHandler.NullHandler.INSTANCE);
+ ErrorClassifier.DEFAULT);
}
@@ -437,7 +420,6 @@ public class AbstractQueueVisitor implements QuiescingExecutor {
default:
break;
}
- errorHandler.handle(e, errorClassification);
if (unhandled == null
|| errorClassification.compareTo(errorClassifier.classify(unhandled)) > 0) {
// Save the most severe error.
diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/ForkJoinQuiescingExecutor.java b/src/main/java/com/google/devtools/build/lib/concurrent/ForkJoinQuiescingExecutor.java
index 54bb572665..45132a1cb7 100644
--- a/src/main/java/com/google/devtools/build/lib/concurrent/ForkJoinQuiescingExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/concurrent/ForkJoinQuiescingExecutor.java
@@ -23,15 +23,13 @@ import java.util.concurrent.ForkJoinTask;
// maintaining AQV.remainingTasks.
public class ForkJoinQuiescingExecutor extends AbstractQueueVisitor {
- public ForkJoinQuiescingExecutor(ForkJoinPool forkJoinPool, ErrorClassifier errorClassifier,
- ErrorHandler errorHandler) {
+ public ForkJoinQuiescingExecutor(ForkJoinPool forkJoinPool, ErrorClassifier errorClassifier) {
super(
/*concurrent=*/ true,
forkJoinPool,
/*shutdownOnCompletion=*/ true,
/*failFastOnException=*/ true,
- errorClassifier,
- errorHandler);
+ errorClassifier);
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java b/src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java
index f37613fd04..d89e278ab7 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java
@@ -136,7 +136,7 @@ public abstract class AbstractAttributeMapper implements AttributeMap {
}
@Override
- public void visitLabels(AcceptsLabelAttribute observer) {
+ public void visitLabels(AcceptsLabelAttribute observer) throws InterruptedException {
for (Attribute attribute : ruleClass.getAttributes()) {
Type<?> type = attribute.getType();
// TODO(bazel-team): clean up the typing / visitation interface so we don't have to
@@ -148,10 +148,9 @@ public abstract class AbstractAttributeMapper implements AttributeMap {
}
}
- /**
- * Visits all labels reachable from the given attribute.
- */
- protected void visitLabels(Attribute attribute, AcceptsLabelAttribute observer) {
+ /** Visits all labels reachable from the given attribute. */
+ protected void visitLabels(Attribute attribute, AcceptsLabelAttribute observer)
+ throws InterruptedException {
Type<?> type = attribute.getType();
Object value = get(attribute.getName(), type);
if (value != null) { // null values are particularly possible for computed defaults.
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java b/src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java
index 454cd71bf9..4fab639d96 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java
@@ -86,8 +86,7 @@ public class AggregatingAttributeMapper extends AbstractAttributeMapper {
}
/**
- * Override that also visits the rule's configurable attribute keys (which are
- * themselves labels).
+ * Override that also visits the rule's configurable attribute keys (which are themselves labels).
*
* <p>Note that we directly parse the selectors rather than just calling {@link #visitAttribute}
* to iterate over all possible values. That's because {@link #visitAttribute} can grow
@@ -96,12 +95,14 @@ public class AggregatingAttributeMapper extends AbstractAttributeMapper {
* path whenever actual value iteration isn't specifically needed.
*/
@Override
- protected void visitLabels(Attribute attribute, AcceptsLabelAttribute observer) {
+ protected void visitLabels(Attribute attribute, AcceptsLabelAttribute observer)
+ throws InterruptedException {
visitLabels(attribute, true, observer);
}
- private void visitLabels(Attribute attribute, boolean includeSelectKeys,
- AcceptsLabelAttribute observer) {
+ private void visitLabels(
+ Attribute attribute, boolean includeSelectKeys, AcceptsLabelAttribute observer)
+ throws InterruptedException {
Type<?> type = attribute.getType();
SelectorList<?> selectorList = getSelectorList(attribute.getName(), type);
if (selectorList == null) {
@@ -137,12 +138,13 @@ public class AggregatingAttributeMapper extends AbstractAttributeMapper {
}
/**
- * Returns all labels reachable via the given attribute. If a label is listed multiple times,
- * each instance appears in the returned list.
+ * Returns all labels reachable via the given attribute. If a label is listed multiple times, each
+ * instance appears in the returned list.
*
* @param includeSelectKeys whether to include config_setting keys for configurable attributes
*/
- public List<Label> getReachableLabels(String attributeName, boolean includeSelectKeys) {
+ public List<Label> getReachableLabels(String attributeName, boolean includeSelectKeys)
+ throws InterruptedException {
final ImmutableList.Builder<Label> builder = ImmutableList.builder();
visitLabels(getAttributeDefinition(attributeName), includeSelectKeys,
new AcceptsLabelAttribute() {
@@ -520,8 +522,10 @@ public class AggregatingAttributeMapper extends AbstractAttributeMapper {
return owner.get(attributeName, type);
}
if (!directMap.containsKey(attributeName)) {
- throw new IllegalArgumentException("attribute \"" + attributeName
- + "\" isn't available in this computed default context");
+ throw new IllegalArgumentException(
+ "attribute \""
+ + attributeName
+ + "\" isn't available in this computed default context");
}
return type.cast(directMap.get(attributeName));
}
@@ -531,34 +535,70 @@ public class AggregatingAttributeMapper extends AbstractAttributeMapper {
return owner.isConfigurable(attributeName, type);
}
- @Override public String getName() { return owner.getName(); }
- @Override public Label getLabel() { return owner.getLabel(); }
- @Override public Iterable<String> getAttributeNames() {
+ @Override
+ public String getName() {
+ return owner.getName();
+ }
+
+ @Override
+ public Label getLabel() {
+ return owner.getLabel();
+ }
+
+ @Override
+ public Iterable<String> getAttributeNames() {
return ImmutableList.<String>builder()
- .addAll(directMap.keySet()).addAll(nonConfigurableAttributes).build();
+ .addAll(directMap.keySet())
+ .addAll(nonConfigurableAttributes)
+ .build();
}
+
@Override
- public void visitLabels(AcceptsLabelAttribute observer) { owner.visitLabels(observer); }
+ public void visitLabels(AcceptsLabelAttribute observer) throws InterruptedException {
+ owner.visitLabels(observer);
+ }
+
@Override
- public String getPackageDefaultHdrsCheck() { return owner.getPackageDefaultHdrsCheck(); }
+ public String getPackageDefaultHdrsCheck() {
+ return owner.getPackageDefaultHdrsCheck();
+ }
+
@Override
- public Boolean getPackageDefaultTestOnly() { return owner.getPackageDefaultTestOnly(); }
+ public Boolean getPackageDefaultTestOnly() {
+ return owner.getPackageDefaultTestOnly();
+ }
+
@Override
- public String getPackageDefaultDeprecation() { return owner.getPackageDefaultDeprecation(); }
+ public String getPackageDefaultDeprecation() {
+ return owner.getPackageDefaultDeprecation();
+ }
+
@Override
public ImmutableList<String> getPackageDefaultCopts() {
return owner.getPackageDefaultCopts();
}
- @Nullable @Override
- public Type<?> getAttributeType(String attrName) { return owner.getAttributeType(attrName); }
- @Nullable @Override public Attribute getAttributeDefinition(String attrName) {
+
+ @Nullable
+ @Override
+ public Type<?> getAttributeType(String attrName) {
+ return owner.getAttributeType(attrName);
+ }
+
+ @Nullable
+ @Override
+ public Attribute getAttributeDefinition(String attrName) {
return owner.getAttributeDefinition(attrName);
}
- @Override public boolean isAttributeValueExplicitlySpecified(String attributeName) {
+
+ @Override
+ public boolean isAttributeValueExplicitlySpecified(String attributeName) {
return owner.isAttributeValueExplicitlySpecified(attributeName);
}
+
@Override
- public boolean has(String attrName, Type<?> type) { return owner.has(attrName, type); }
+ public boolean has(String attrName, Type<?> type) {
+ return owner.has(attrName, type);
+ }
};
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AttributeMap.java b/src/main/java/com/google/devtools/build/lib/packages/AttributeMap.java
index b5c4508be5..3e62f2947d 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/AttributeMap.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/AttributeMap.java
@@ -16,7 +16,6 @@ package com.google.devtools.build.lib.packages;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.syntax.Type;
-
import javax.annotation.Nullable;
/**
@@ -91,19 +90,19 @@ public interface AttributeMap {
/**
* Accept a (Label, Attribute) pair describing a dependency edge.
*
- * @param label the target node of the (Rule, Label) edge.
- * The source node should already be known.
+ * @param label the target node of the (Rule, Label) edge. The source node should already be
+ * known.
* @param attribute the attribute.
*/
- void acceptLabelAttribute(Label label, Attribute attribute);
+ void acceptLabelAttribute(Label label, Attribute attribute) throws InterruptedException;
}
/**
- * For all attributes that contain labels in their values (either by *being* a label or
- * being a collection that includes labels), visits every label and notifies the
- * specified observer at each visit.
+ * For all attributes that contain labels in their values (either by *being* a label or being a
+ * collection that includes labels), visits every label and notifies the specified observer at
+ * each visit.
*/
- void visitLabels(AcceptsLabelAttribute observer);
+ void visitLabels(AcceptsLabelAttribute observer) throws InterruptedException;
// TODO(bazel-team): These methods are here to support computed defaults that inherit
// package-level default values. Instead, we should auto-inherit and remove the computed
diff --git a/src/main/java/com/google/devtools/build/lib/packages/DelegatingAttributeMapper.java b/src/main/java/com/google/devtools/build/lib/packages/DelegatingAttributeMapper.java
index 174b9b9848..e57476c551 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/DelegatingAttributeMapper.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/DelegatingAttributeMapper.java
@@ -17,7 +17,6 @@ import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.Preconditions;
-
import javax.annotation.Nullable;
/**
@@ -74,7 +73,7 @@ public class DelegatingAttributeMapper implements AttributeMap {
}
@Override
- public void visitLabels(AcceptsLabelAttribute observer) {
+ public void visitLabels(AcceptsLabelAttribute observer) throws InterruptedException {
delegate.visitLabels(observer);
}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/ExternalPackageBuilder.java b/src/main/java/com/google/devtools/build/lib/packages/ExternalPackageBuilder.java
index c6b000459b..dd9678a733 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/ExternalPackageBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/ExternalPackageBuilder.java
@@ -24,7 +24,6 @@ import com.google.devtools.build.lib.packages.Package.Builder;
import com.google.devtools.build.lib.packages.RuleFactory.BuildLangTypedAttributeValuesMap;
import com.google.devtools.build.lib.syntax.FuncallExpression;
import com.google.devtools.build.lib.util.Preconditions;
-
import java.util.Map;
/**
@@ -69,7 +68,7 @@ public class ExternalPackageBuilder {
return rule;
}
- void addBindRule(
+ static void addBindRule(
Builder pkg,
RuleClass bindRuleClass,
Label virtual,
@@ -102,7 +101,8 @@ public class ExternalPackageBuilder {
rule.setVisibility(ConstantRuleVisibility.PUBLIC);
}
- private void overwriteRule(Package.Builder pkg, Rule rule) throws Package.NameConflictException {
+ private static void overwriteRule(Package.Builder pkg, Rule rule)
+ throws Package.NameConflictException, InterruptedException {
Preconditions.checkArgument(rule.getOutputFiles().isEmpty());
Target old = pkg.targets.get(rule.getName());
if (old != null) {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Globber.java b/src/main/java/com/google/devtools/build/lib/packages/Globber.java
index 64d61796d3..a2f980c7ad 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Globber.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Globber.java
@@ -29,14 +29,13 @@ public interface Globber {
}
/**
- * Asynchronously starts the given glob computation and returns a token for fetching the
- * result.
+ * Asynchronously starts the given glob computation and returns a token for fetching the result.
*
* @throws BadGlobException if any of the patterns in {@code includes} or {@code excludes} are
* invalid.
*/
Token runAsync(List<String> includes, List<String> excludes, boolean excludeDirs)
- throws BadGlobException;
+ throws BadGlobException, InterruptedException;
/**
* Fetches the result of a previously started glob computation. The returned list must be ordered
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 90e3b59516..f1d9b51878 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
@@ -1265,12 +1265,12 @@ public class Package {
}
}
- void addRule(Rule rule) throws NameConflictException {
+ void addRule(Rule rule) throws NameConflictException, InterruptedException {
checkForConflicts(rule);
addRuleUnchecked(rule);
}
- private Builder beforeBuild() {
+ private Builder beforeBuild() throws InterruptedException {
Preconditions.checkNotNull(pkg);
Preconditions.checkNotNull(filename);
Preconditions.checkNotNull(buildFileLabel);
@@ -1323,7 +1323,7 @@ public class Package {
}
/** Intended for use by {@link com.google.devtools.build.lib.skyframe.PackageFunction} only. */
- public Builder buildPartial() {
+ public Builder buildPartial() throws InterruptedException {
if (alreadyBuilt) {
return this;
}
@@ -1371,7 +1371,7 @@ public class Package {
return externalPackageData;
}
- public Package build() {
+ public Package build() throws InterruptedException {
if (alreadyBuilt) {
return pkg;
}
@@ -1399,14 +1399,15 @@ public class Package {
}
/**
- * Precondition check for addRule. We must maintain these invariants of the
- * package:
- * - Each name refers to at most one target.
- * - No rule with errors is inserted into the package.
- * - The generating rule of every output file in the package must itself be
- * in the package.
+ * Precondition check for addRule. We must maintain these invariants of the package:
+ *
+ * <ul>
+ * <li>Each name refers to at most one target.
+ * <li>No rule with errors is inserted into the package.
+ * <li>The generating rule of every output file in the package must itself be in the package.
+ * </ul>
*/
- private void checkForConflicts(Rule rule) throws NameConflictException {
+ private void checkForConflicts(Rule rule) throws NameConflictException, InterruptedException {
String name = rule.getName();
Target existing = targets.get(name);
if (existing != null) {
@@ -1451,17 +1452,15 @@ public class Package {
}
/**
- * A utility method that checks for conflicts between
- * input file names and output file names for a rule from a build
- * file.
- * @param rule the rule whose inputs and outputs are
- * to be checked for conflicts.
- * @param outputFiles a set containing the names of output
- * files to be generated by the rule.
+ * A utility method that checks for conflicts between input file names and output file names for
+ * a rule from a build file.
+ *
+ * @param rule the rule whose inputs and outputs are to be checked for conflicts.
+ * @param outputFiles a set containing the names of output files to be generated by the rule.
* @throws NameConflictException if a conflict is found.
*/
private void checkForInputOutputConflicts(Rule rule, Set<String> outputFiles)
- throws NameConflictException {
+ throws NameConflictException, InterruptedException {
PathFragment packageFragment = rule.getLabel().getPackageFragment();
for (Label inputLabel : rule.getLabels()) {
if (packageFragment.equals(inputLabel.getPackageFragment())
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 dd5df33055..29af9a54c9 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
@@ -398,10 +398,8 @@ public final class Rule implements Target, DependencyFilter.AttributeInfoProvide
return false;
}
- /**
- * Returns a new List instance containing all direct dependencies (all types).
- */
- public Collection<Label> getLabels() {
+ /** Returns a new List instance containing all direct dependencies (all types). */
+ public Collection<Label> getLabels() throws InterruptedException {
final List<Label> labels = Lists.newArrayList();
AggregatingAttributeMapper.of(this).visitLabels(new AttributeMap.AcceptsLabelAttribute() {
@Override
@@ -413,29 +411,30 @@ public final class Rule implements Target, DependencyFilter.AttributeInfoProvide
}
/**
- * Returns a new Collection containing all Labels that match a given Predicate,
- * not including outputs.
+ * Returns a new Collection containing all Labels that match a given Predicate, not including
+ * outputs.
*
- * @param predicate A binary predicate that determines if a label should be
- * included in the result. The predicate is evaluated with this rule and
- * the attribute that contains the label. The label will be contained in the
- * result iff (the predicate returned {@code true} and the labels are not outputs)
+ * @param predicate A binary predicate that determines if a label should be included in the
+ * result. The predicate is evaluated with this rule and the attribute that contains the
+ * label. The label will be contained in the result iff (the predicate returned {@code true}
+ * and the labels are not outputs)
*/
- public Collection<Label> getLabels(BinaryPredicate<? super Rule, Attribute> predicate) {
+ public Collection<Label> getLabels(BinaryPredicate<? super Rule, Attribute> predicate)
+ throws InterruptedException {
return ImmutableSortedSet.copyOf(getTransitions(predicate).values());
}
/**
- * Returns a new Multimap containing all attributes that match a given Predicate and
- * corresponding labels, not including outputs.
+ * Returns a new Multimap containing all attributes that match a given Predicate and corresponding
+ * labels, not including outputs.
*
- * @param predicate A binary predicate that determines if a label should be
- * included in the result. The predicate is evaluated with this rule and
- * the attribute that contains the label. The label will be contained in the
- * result iff (the predicate returned {@code true} and the labels are not outputs)
+ * @param predicate A binary predicate that determines if a label should be included in the
+ * result. The predicate is evaluated with this rule and the attribute that contains the
+ * label. The label will be contained in the result iff (the predicate returned {@code true}
+ * and the labels are not outputs)
*/
public Multimap<Attribute, Label> getTransitions(
- final BinaryPredicate<? super Rule, Attribute> predicate) {
+ final BinaryPredicate<? super Rule, Attribute> predicate) throws InterruptedException {
final Multimap<Attribute, Label> transitions = HashMultimap.create();
// TODO(bazel-team): move this to AttributeMap, too. Just like visitLabels, which labels should
// be visited may depend on the calling context. We shouldn't implicitly decide this for
@@ -651,7 +650,7 @@ public final class Rule implements Target, DependencyFilter.AttributeInfoProvide
// null-valued, with a packageFragment that is null...). The bug that prompted
// the introduction of this code is #2210848 (NullPointerException in
// Package.checkForConflicts() ).
- void checkForNullLabels() {
+ void checkForNullLabels() throws InterruptedException {
AggregatingAttributeMapper.of(this).visitLabels(
new AttributeMap.AcceptsLabelAttribute() {
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java b/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java
index 8a90c10ff5..85dc32044d 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java
@@ -18,10 +18,8 @@ import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.syntax.Type;
-
import java.util.HashMap;
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -185,7 +183,7 @@ public final class TargetUtils {
return index != -1 ? ruleClass.substring(0, index) : ruleClass;
}
- private static boolean isExplicitDependency(Rule rule, Label label) {
+ private static boolean isExplicitDependency(Rule rule, Label label) throws InterruptedException {
if (rule.getVisibility().getDependencyLabels().contains(label)) {
return true;
}
@@ -227,11 +225,11 @@ public final class TargetUtils {
}
/**
- * Return nicely formatted error message that {@link Label} label that was pointed to by
- * {@link Target} target did not exist, due to {@link NoSuchThingException} e.
+ * Return nicely formatted error message that {@link Label} label that was pointed to by {@link
+ * Target} target did not exist, due to {@link NoSuchThingException} e.
*/
- public static String formatMissingEdge(@Nullable Target target, Label label,
- NoSuchThingException e) {
+ public static String formatMissingEdge(
+ @Nullable Target target, Label label, NoSuchThingException e) throws InterruptedException {
// instanceof returns false if target is null (which is exploited here)
if (target instanceof Rule) {
Rule rule = (Rule) target;
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/PackageProvider.java b/src/main/java/com/google/devtools/build/lib/pkgcache/PackageProvider.java
index b99d797608..23464b4f8f 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/PackageProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/PackageProvider.java
@@ -47,17 +47,19 @@ public interface PackageProvider extends TargetProvider {
/**
* Returns whether a package with the given name exists. That is, returns whether all the
* following hold
+ *
* <ol>
- * <li>{@code packageName} is a valid package name</li>
- * <li>there is a BUILD file for the package</li>
- * <li>the package is not considered deleted via --deleted_packages</li>
+ * <li>{@code packageName} is a valid package name
+ * <li>there is a BUILD file for the package
+ * <li>the package is not considered deleted via --deleted_packages
* </ol>
*
- * <p> If these don't hold, then attempting to read the package with {@link #getPackage} may fail
+ * <p>If these don't hold, then attempting to read the package with {@link #getPackage} may fail
* or may return a package containing errors.
*
* @param eventHandler the eventHandler on which to report warnings and errors
* @param packageName the name of the package.
*/
- boolean isPackage(EventHandler eventHandler, PackageIdentifier packageName);
+ boolean isPackage(EventHandler eventHandler, PackageIdentifier packageName)
+ throws InterruptedException;
}
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/RecursivePackageProvider.java b/src/main/java/com/google/devtools/build/lib/pkgcache/RecursivePackageProvider.java
index 37c81b0c52..bdf3baaee8 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/RecursivePackageProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/RecursivePackageProvider.java
@@ -21,7 +21,6 @@ import com.google.devtools.build.lib.packages.NoSuchPackageException;
import com.google.devtools.build.lib.packages.Package;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.RootedPath;
-
import java.util.Map;
/**
@@ -32,16 +31,18 @@ public interface RecursivePackageProvider extends PackageProvider {
/**
* Returns the names of all the packages under a given directory.
*
- * <p>Packages returned by this method and passed into
- * {@link #bulkGetPackages(EventHandler, Iterable)} are expected to return successful
- * {@link Package} values.
+ * <p>Packages returned by this method and passed into {@link #bulkGetPackages(EventHandler,
+ * Iterable)} are expected to return successful {@link Package} values.
*
* @param directory a {@link RootedPath} specifying the directory to search
- * @param excludedSubdirectories a set of {@link PathFragment}s, all of which are beneath
- * {@code directory}, specifying transitive subdirectories to exclude
+ * @param excludedSubdirectories a set of {@link PathFragment}s, all of which are beneath {@code
+ * directory}, specifying transitive subdirectories to exclude
*/
- Iterable<PathFragment> getPackagesUnderDirectory(RepositoryName repository,
- PathFragment directory, ImmutableSet<PathFragment> excludedSubdirectories);
+ Iterable<PathFragment> getPackagesUnderDirectory(
+ RepositoryName repository,
+ PathFragment directory,
+ ImmutableSet<PathFragment> excludedSubdirectories)
+ throws InterruptedException;
/**
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/TargetEdgeObserver.java b/src/main/java/com/google/devtools/build/lib/pkgcache/TargetEdgeObserver.java
index 294920a526..9e30d9219d 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/TargetEdgeObserver.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/TargetEdgeObserver.java
@@ -18,7 +18,6 @@ import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.packages.Attribute;
import com.google.devtools.build.lib.packages.NoSuchThingException;
import com.google.devtools.build.lib.packages.Target;
-
import javax.annotation.Nullable;
/**
@@ -41,13 +40,13 @@ public interface TargetEdgeObserver {
/**
* Called when a Target has a reference to a non-existent target.
*
- * @param target the target. May be null (e.g. in the case of an implicit
- * dependency on a subincluded file).
- * @param to a label reference in the rule, which does not correspond
- * to a valid target.
+ * @param target the target. May be null (e.g. in the case of an implicit dependency on a
+ * subincluded file).
+ * @param to a label reference in the rule, which does not correspond to a valid target.
* @param e the corresponding exception thrown
*/
- void missingEdge(@Nullable Target target, Label to, NoSuchThingException e);
+ void missingEdge(@Nullable Target target, Label to, NoSuchThingException e)
+ throws InterruptedException;
/**
* Called when a node is discovered. May be called
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/TargetPatternResolverUtil.java b/src/main/java/com/google/devtools/build/lib/pkgcache/TargetPatternResolverUtil.java
index d00db1e1e7..d8534caf52 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/TargetPatternResolverUtil.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/TargetPatternResolverUtil.java
@@ -49,9 +49,9 @@ public final class TargetPatternResolverUtil {
return builder.build();
}
- public static void validatePatternPackage(String originalPattern,
- PathFragment packageNameFragment, TargetPatternResolver<?> resolver)
- throws TargetParsingException {
+ public static void validatePatternPackage(
+ String originalPattern, PathFragment packageNameFragment, TargetPatternResolver<?> resolver)
+ throws TargetParsingException, InterruptedException {
String packageName = packageNameFragment.toString();
// It's possible for this check to pass, but for
// Label.validatePackageNameFull to report an error because the
diff --git a/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java
index 07df0c6ce0..5df559945e 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java
@@ -33,7 +33,6 @@ import com.google.devtools.build.lib.query2.engine.QueryExpression;
import com.google.devtools.build.lib.query2.engine.QueryUtil.AggregateAllCallback;
import com.google.devtools.build.lib.query2.engine.VariableContext;
import com.google.devtools.build.lib.util.Preconditions;
-
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
@@ -165,7 +164,8 @@ public abstract class AbstractBlazeQueryEnvironment<T>
}
}
- public abstract Target getTarget(Label label) throws TargetNotFoundException, QueryException;
+ public abstract Target getTarget(Label label)
+ throws TargetNotFoundException, QueryException, InterruptedException;
protected boolean validateScope(Label label, boolean strict) throws QueryException {
if (!labelFilter.apply(label)) {
@@ -181,7 +181,7 @@ public abstract class AbstractBlazeQueryEnvironment<T>
}
public Set<T> evalTargetPattern(QueryExpression caller, String pattern)
- throws QueryException {
+ throws QueryException, InterruptedException {
try {
preloadOrThrow(caller, ImmutableList.of(pattern));
} catch (TargetParsingException e) {
diff --git a/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
index a29c2c6093..ad6b54002a 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
@@ -48,7 +48,6 @@ import com.google.devtools.build.lib.query2.engine.Uniquifier;
import com.google.devtools.build.lib.query2.engine.VariableContext;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -136,7 +135,8 @@ public class BlazeQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
@Override
public void getTargetsMatchingPattern(
- QueryExpression caller, String pattern, Callback<Target> callback) throws QueryException {
+ QueryExpression caller, String pattern, Callback<Target> callback)
+ throws QueryException, InterruptedException {
// We can safely ignore the boolean error flag. The evaluateQuery() method above wraps the
// entire query computation in an error sensor.
diff --git a/src/main/java/com/google/devtools/build/lib/query2/BlazeTargetAccessor.java b/src/main/java/com/google/devtools/build/lib/query2/BlazeTargetAccessor.java
index 81de429aa0..d345a27194 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/BlazeTargetAccessor.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/BlazeTargetAccessor.java
@@ -38,7 +38,6 @@ import com.google.devtools.build.lib.query2.engine.QueryExpression;
import com.google.devtools.build.lib.query2.engine.QueryVisibility;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.Preconditions;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -71,8 +70,9 @@ final class BlazeTargetAccessor implements TargetAccessor<Target> {
}
@Override
- public List<Target> getLabelListAttr(QueryExpression caller, Target target, String attrName,
- String errorMsgPrefix) throws QueryException {
+ public List<Target> getLabelListAttr(
+ QueryExpression caller, Target target, String attrName, String errorMsgPrefix)
+ throws QueryException, InterruptedException {
Preconditions.checkArgument(target instanceof Rule);
List<Target> result = new ArrayList<>();
@@ -163,7 +163,8 @@ final class BlazeTargetAccessor implements TargetAccessor<Target> {
}
@Override
- public Set<QueryVisibility<Target>> getVisibility(Target target) throws QueryException {
+ public Set<QueryVisibility<Target>> getVisibility(Target target)
+ throws QueryException, InterruptedException {
ImmutableSet.Builder<QueryVisibility<Target>> result = ImmutableSet.builder();
result.add(QueryVisibility.samePackage(target, this));
convertVisibility(result, target);
@@ -172,9 +173,8 @@ final class BlazeTargetAccessor implements TargetAccessor<Target> {
// CAUTION: keep in sync with ConfiguredTargetFactory#convertVisibility()
private void convertVisibility(
- ImmutableSet.Builder<QueryVisibility<Target>> packageSpecifications,
- Target target)
- throws QueryException {
+ ImmutableSet.Builder<QueryVisibility<Target>> packageSpecifications, Target target)
+ throws QueryException, InterruptedException {
RuleVisibility ruleVisibility = target.getVisibility();
if (ruleVisibility instanceof ConstantRuleVisibility) {
if (((ConstantRuleVisibility) ruleVisibility).isPubliclyVisible()) {
@@ -203,7 +203,7 @@ final class BlazeTargetAccessor implements TargetAccessor<Target> {
private void convertGroupVisibility(
PackageGroup group, ImmutableSet.Builder<QueryVisibility<Target>> packageSpecifications)
- throws QueryException, TargetNotFoundException {
+ throws QueryException, TargetNotFoundException, InterruptedException {
for (Label include : group.getIncludes()) {
convertGroupVisibility((PackageGroup) queryEnvironment.getTarget(include),
packageSpecifications);
diff --git a/src/main/java/com/google/devtools/build/lib/query2/ErrorPrintingTargetEdgeErrorObserver.java b/src/main/java/com/google/devtools/build/lib/query2/ErrorPrintingTargetEdgeErrorObserver.java
index b129d59c2b..11b6f790d5 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/ErrorPrintingTargetEdgeErrorObserver.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/ErrorPrintingTargetEdgeErrorObserver.java
@@ -45,7 +45,8 @@ class ErrorPrintingTargetEdgeErrorObserver extends TargetEdgeErrorObserver {
@ThreadSafety.ThreadSafe
@Override
- public void missingEdge(Target target, Label label, NoSuchThingException e) {
+ public void missingEdge(Target target, Label label, NoSuchThingException e)
+ throws InterruptedException {
eventHandler.handle(Event.error(TargetUtils.getLocationMaybe(target),
TargetUtils.formatMissingEdge(target, label, e)));
super.missingEdge(target, label, e);
diff --git a/src/main/java/com/google/devtools/build/lib/query2/LabelVisitor.java b/src/main/java/com/google/devtools/build/lib/query2/LabelVisitor.java
index 84098386fd..c0236010f2 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/LabelVisitor.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/LabelVisitor.java
@@ -41,7 +41,6 @@ import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.pkgcache.PackageProvider;
import com.google.devtools.build.lib.pkgcache.TargetEdgeObserver;
-
import java.util.Collection;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
@@ -292,13 +291,12 @@ final class LabelVisitor {
}
/**
- * Visit the specified labels and follow the transitive closure of their
- * outbound dependencies.
+ * Visit the specified labels and follow the transitive closure of their outbound dependencies.
*
* @param targets the targets to visit
*/
@ThreadSafe
- public void visitTargets(Iterable<Target> targets) {
+ public void visitTargets(Iterable<Target> targets) throws InterruptedException {
for (Target target : targets) {
visit(null, null, target, 0, 0);
}
@@ -340,13 +338,15 @@ final class LabelVisitor {
private Runnable newVisitRunnable(final Target from, final Attribute attr, final Label label,
final int depth, final int count) {
- return new Runnable () {
+ return new Runnable() {
@Override
public void run() {
try {
- visit(from, attr, packageProvider.getTarget(eventHandler, label), depth + 1, count);
- } catch (NoSuchThingException e) {
- observeError(from, label, e);
+ try {
+ visit(from, attr, packageProvider.getTarget(eventHandler, label), depth + 1, count);
+ } catch (NoSuchThingException e) {
+ observeError(from, label, e);
+ }
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
@@ -381,7 +381,8 @@ final class LabelVisitor {
* @param rule the rule to visit
*/
@ThreadSafe
- private void visitRule(final Rule rule, final int depth, final int count) {
+ private void visitRule(final Rule rule, final int depth, final int count)
+ throws InterruptedException {
// Follow all labels defined by this rule:
AggregatingAttributeMapper.of(rule).visitLabels(new AttributeMap.AcceptsLabelAttribute() {
@Override
@@ -404,11 +405,11 @@ final class LabelVisitor {
/**
* Visits the target and its package.
*
- * <p>Potentially blocking invocations into the package cache are
- * enqueued in the worker pool if CONCURRENT.
+ * <p>Potentially blocking invocations into the package cache are enqueued in the worker pool if
+ * CONCURRENT.
*/
- private void visit(
- Target from, Attribute attribute, final Target target, int depth, int count) {
+ private void visit(Target from, Attribute attribute, final Target target, int depth, int count)
+ throws InterruptedException {
if (target == null) {
throw new NullPointerException(
String.format("'%s' attribute '%s'",
@@ -439,12 +440,11 @@ final class LabelVisitor {
}
/**
- * Visit the specified target.
- * Called in a worker thread if CONCURRENT.
+ * Visit the specified target. Called in a worker thread if CONCURRENT.
*
* @param target the target to visit
*/
- private void visitTargetNode(Target target, int depth, int count) {
+ private void visitTargetNode(Target target, int depth, int count) throws InterruptedException {
Integer minTargetDepth = visitedTargets.putIfAbsent(target.getLabel(), depth);
if (minTargetDepth != null) {
// The target was already visited at a greater depth.
@@ -493,7 +493,8 @@ final class LabelVisitor {
}
}
- private void observeError(Target from, Label label, NoSuchThingException e) {
+ private void observeError(Target from, Label label, NoSuchThingException e)
+ throws InterruptedException {
for (TargetEdgeObserver observer : observers) {
observer.missingEdge(from, label, e);
}
diff --git a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
index 40d8a89810..2260282eb8 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
@@ -18,8 +18,6 @@ import com.google.common.base.Ascii;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
@@ -82,6 +80,7 @@ import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.EvaluationResult;
+import com.google.devtools.build.skyframe.InterruptibleSupplier;
import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
@@ -146,7 +145,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
// The following fields are set in the #beforeEvaluateQuery method.
protected WalkableGraph graph;
- private Supplier<ImmutableSet<PathFragment>> blacklistPatternsSupplier;
+ private InterruptibleSupplier<ImmutableSet<PathFragment>> blacklistPatternsSupplier;
private RecursivePackageProviderBackedTargetPatternResolver resolver;
public SkyQueryEnvironment(
@@ -186,7 +185,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
checkEvaluationResult(result, universeKey);
graph = result.getWalkableGraph();
- blacklistPatternsSupplier = Suppliers.memoize(new BlacklistSupplier(graph));
+ blacklistPatternsSupplier = InterruptibleSupplier.Memoize.of(new BlacklistSupplier(graph));
ImmutableList<TargetPatternKey> universeTargetPatternKeys =
PrepareDepsOfPatternsFunction.getTargetPatternKeys(
@@ -345,7 +344,8 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
return new QueryEvalResult(!eventHandler.hasErrors(), empty.get());
}
- private Map<Target, Collection<Target>> makeTargetsMap(Map<SkyKey, Iterable<SkyKey>> input) {
+ private Map<Target, Collection<Target>> makeTargetsMap(Map<SkyKey, Iterable<SkyKey>> input)
+ throws InterruptedException {
ImmutableMap.Builder<Target, Collection<Target>> result = ImmutableMap.builder();
Map<SkyKey, Target> allTargets =
@@ -365,15 +365,17 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
return result.build();
}
- private Map<Target, Collection<Target>> getRawFwdDeps(Iterable<Target> targets) {
+ private Map<Target, Collection<Target>> getRawFwdDeps(Iterable<Target> targets)
+ throws InterruptedException {
return makeTargetsMap(graph.getDirectDeps(makeTransitiveTraversalKeys(targets)));
}
- private Map<Target, Collection<Target>> getRawReverseDeps(Iterable<Target> targets) {
+ private Map<Target, Collection<Target>> getRawReverseDeps(Iterable<Target> targets)
+ throws InterruptedException {
return makeTargetsMap(graph.getReverseDeps(makeTransitiveTraversalKeys(targets)));
}
- private Set<Label> getAllowedDeps(Rule rule) {
+ private Set<Label> getAllowedDeps(Rule rule) throws InterruptedException {
Set<Label> allowedLabels = new HashSet<>(rule.getTransitions(dependencyFilter).values());
allowedLabels.addAll(rule.getVisibility().getDependencyLabels());
// We should add deps from aspects, otherwise they are going to be filtered out.
@@ -381,7 +383,8 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
return allowedLabels;
}
- private Collection<Target> filterFwdDeps(Target target, Collection<Target> rawFwdDeps) {
+ private Collection<Target> filterFwdDeps(Target target, Collection<Target> rawFwdDeps)
+ throws InterruptedException {
if (!(target instanceof Rule)) {
return rawFwdDeps;
}
@@ -405,7 +408,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
}
@Override
- public Collection<Target> getFwdDeps(Iterable<Target> targets) {
+ public Collection<Target> getFwdDeps(Iterable<Target> targets) throws InterruptedException {
Set<Target> result = new HashSet<>();
Map<Target, Collection<Target>> rawFwdDeps = getRawFwdDeps(targets);
warnIfMissingTargets(targets, rawFwdDeps.keySet());
@@ -416,14 +419,15 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
}
@Override
- public Collection<Target> getReverseDeps(Iterable<Target> targets) {
+ public Collection<Target> getReverseDeps(Iterable<Target> targets) throws InterruptedException {
Map<Target, Collection<Target>> rawReverseDeps = getRawReverseDeps(targets);
warnIfMissingTargets(targets, rawReverseDeps.keySet());
return processRawReverseDeps(rawReverseDeps);
}
- private Collection<Target> processRawReverseDeps(Map<Target, Collection<Target>> rawReverseDeps) {
+ private Collection<Target> processRawReverseDeps(Map<Target, Collection<Target>> rawReverseDeps)
+ throws InterruptedException {
Set<Target> result = CompactHashSet.create();
CompactHashSet<Target> visited =
CompactHashSet.createWithExpectedSize(totalSizeOfCollections(rawReverseDeps.values()));
@@ -457,7 +461,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
}
@Override
- public Set<Target> getTransitiveClosure(Set<Target> targets) {
+ public Set<Target> getTransitiveClosure(Set<Target> targets) throws InterruptedException {
Set<Target> visited = new HashSet<>();
Collection<Target> current = targets;
while (!current.isEmpty()) {
@@ -471,7 +475,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
// Implemented with a breadth-first search.
@Override
- public Set<Target> getNodesOnPath(Target from, Target to) {
+ public Set<Target> getNodesOnPath(Target from, Target to) throws InterruptedException {
// Tree of nodes visited so far.
Map<Target, Target> nodeToParent = new HashMap<>();
// Contains all nodes left to visit in a (LIFO) stack.
@@ -595,7 +599,8 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
}
@Override
- public Target getTarget(Label label) throws TargetNotFoundException, QueryException {
+ public Target getTarget(Label label)
+ throws TargetNotFoundException, QueryException, InterruptedException {
SkyKey packageKey = PackageValue.key(label.getPackageIdentifier());
if (!graph.exists(packageKey)) {
throw new QueryException(packageKey + " does not exist in graph");
@@ -617,7 +622,8 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
}
}
- public Map<PackageIdentifier, Package> bulkGetPackages(Iterable<PackageIdentifier> pkgIds) {
+ public Map<PackageIdentifier, Package> bulkGetPackages(Iterable<PackageIdentifier> pkgIds)
+ throws InterruptedException {
Set<SkyKey> pkgKeys = ImmutableSet.copyOf(PackageValue.keys(pkgIds));
ImmutableMap.Builder<PackageIdentifier, Package> pkgResults = ImmutableMap.builder();
Map<SkyKey, SkyValue> packages = graph.getSuccessfulValues(pkgKeys);
@@ -631,7 +637,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
@Override
public void buildTransitiveClosure(QueryExpression caller, Set<Target> targets, int maxDepth)
- throws QueryException {
+ throws QueryException, InterruptedException {
// Everything has already been loaded, so here we just check for errors so that we can
// pre-emptively throw/report if needed.
Iterable<SkyKey> transitiveTraversalKeys = makeTransitiveTraversalKeys(targets);
@@ -694,7 +700,8 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
}
};
- private Map<SkyKey, Target> makeTargetsFromSkyKeys(Iterable<SkyKey> keys) {
+ private Map<SkyKey, Target> makeTargetsFromSkyKeys(Iterable<SkyKey> keys)
+ throws InterruptedException {
Multimap<SkyKey, SkyKey> packageKeyToTargetKeyMap = ArrayListMultimap.create();
for (SkyKey key : keys) {
Label label = SKYKEY_TO_LABEL.apply(key);
@@ -776,7 +783,8 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
*
* <p>Note that there may not be nodes in the graph corresponding to the returned SkyKeys.
*/
- private Collection<SkyKey> getSkyKeysForFileFragments(Iterable<PathFragment> pathFragments) {
+ private Collection<SkyKey> getSkyKeysForFileFragments(Iterable<PathFragment> pathFragments)
+ throws InterruptedException {
Set<SkyKey> result = new HashSet<>();
Multimap<PathFragment, PathFragment> currentToOriginal = ArrayListMultimap.create();
for (PathFragment pathFragment : pathFragments) {
@@ -898,7 +906,8 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
.build();
}
- private static class BlacklistSupplier implements Supplier<ImmutableSet<PathFragment>> {
+ private static class BlacklistSupplier
+ implements InterruptibleSupplier<ImmutableSet<PathFragment>> {
private final WalkableGraph graph;
BlacklistSupplier(WalkableGraph graph) {
@@ -906,7 +915,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
}
@Override
- public ImmutableSet<PathFragment> get() {
+ public ImmutableSet<PathFragment> get() throws InterruptedException {
return ((BlacklistedPackagePrefixesValue)
graph.getValue(BlacklistedPackagePrefixesValue.key()))
.getPatterns();
diff --git a/src/main/java/com/google/devtools/build/lib/query2/TargetEdgeErrorObserver.java b/src/main/java/com/google/devtools/build/lib/query2/TargetEdgeErrorObserver.java
index 3e81571067..06c60ce5d2 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/TargetEdgeErrorObserver.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/TargetEdgeErrorObserver.java
@@ -43,15 +43,16 @@ class TargetEdgeErrorObserver implements TargetEdgeObserver {
private volatile boolean hasErrors = false;
/**
- * Reports an unresolved label error and records the fact that an error was
- * encountered.
+ * Reports an unresolved label error and records the fact that an error was encountered.
+ *
* @param target the target that referenced the unresolved label
* @param label the label that could not be resolved
* @param e the exception that was thrown when the label could not be resolved
*/
@ThreadSafety.ThreadSafe
@Override
- public void missingEdge(Target target, Label label, NoSuchThingException e) {
+ public void missingEdge(Target target, Label label, NoSuchThingException e)
+ throws InterruptedException {
hasErrors = true;
}
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java
index 88a2ea99f1..9653841b1b 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java
@@ -14,11 +14,9 @@
package com.google.devtools.build.lib.query2.engine;
import com.google.common.collect.ImmutableList;
-
import java.util.Collection;
import java.util.List;
import java.util.Set;
-
import javax.annotation.Nonnull;
/**
@@ -143,7 +141,7 @@ public interface QueryEnvironment<T> {
* pattern, in 'blaze build' syntax.
*/
void getTargetsMatchingPattern(QueryExpression owner, String pattern, Callback<T> callback)
- throws QueryException;
+ throws QueryException, InterruptedException;
/** Ensures the specified target exists. */
// NOTE(bazel-team): this method is left here as scaffolding from a previous refactoring. It may
@@ -151,17 +149,16 @@ public interface QueryEnvironment<T> {
T getOrCreate(T target);
/** Returns the direct forward dependencies of the specified targets. */
- Collection<T> getFwdDeps(Iterable<T> targets);
+ Collection<T> getFwdDeps(Iterable<T> targets) throws InterruptedException;
/** Returns the direct reverse dependencies of the specified targets. */
- Collection<T> getReverseDeps(Iterable<T> targets);
+ Collection<T> getReverseDeps(Iterable<T> targets) throws InterruptedException;
/**
- * Returns the forward transitive closure of all of the targets in
- * "targets". Callers must ensure that {@link #buildTransitiveClosure}
- * has been called for the relevant subgraph.
+ * Returns the forward transitive closure of all of the targets in "targets". Callers must ensure
+ * that {@link #buildTransitiveClosure} has been called for the relevant subgraph.
*/
- Set<T> getTransitiveClosure(Set<T> targets);
+ Set<T> getTransitiveClosure(Set<T> targets) throws InterruptedException;
/**
* Construct the dependency graph for a depth-bounded forward transitive closure
@@ -176,10 +173,8 @@ public interface QueryEnvironment<T> {
Set<T> targetNodes,
int maxDepth) throws QueryException, InterruptedException;
- /**
- * Returns the set of nodes on some path from "from" to "to".
- */
- Set<T> getNodesOnPath(T from, T to);
+ /** Returns the set of nodes on some path from "from" to "to". */
+ Set<T> getNodesOnPath(T from, T to) throws InterruptedException;
/**
* Eval an expression {@code expr} and pass the results to the {@code callback}.
@@ -201,12 +196,12 @@ public interface QueryEnvironment<T> {
void reportBuildFileError(QueryExpression expression, String msg) throws QueryException;
/**
- * Returns the set of BUILD, and optionally sub-included and Skylark files that define the given set of
- * targets. Each such file is itself represented as a target in the result.
+ * Returns the set of BUILD, and optionally sub-included and Skylark files that define the given
+ * set of targets. Each such file is itself represented as a target in the result.
*/
Set<T> getBuildFiles(
QueryExpression caller, Set<T> nodes, boolean buildFiles, boolean subincludes, boolean loads)
- throws QueryException;
+ throws QueryException, InterruptedException;
/**
* Returns an object that can be used to query information about targets. Implementations should
@@ -307,8 +302,9 @@ public interface QueryEnvironment<T> {
*
* @throws IllegalArgumentException if target is not a rule (according to {@link #isRule})
*/
- List<T> getLabelListAttr(QueryExpression caller, T target, String attrName,
- String errorMsgPrefix) throws QueryException;
+ List<T> getLabelListAttr(
+ QueryExpression caller, T target, String attrName, String errorMsgPrefix)
+ throws QueryException, InterruptedException;
/**
* If the attribute of the given name on the given target is a string list, then this method
@@ -347,7 +343,7 @@ public interface QueryEnvironment<T> {
* Returns the set of package specifications the given target is visible from, represented as
* {@link QueryVisibility}s.
*/
- Set<QueryVisibility<T>> getVisibility(T from) throws QueryException;
+ Set<QueryVisibility<T>> getVisibility(T from) throws QueryException, InterruptedException;
}
/** List of the default query functions. */
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java
index 02ce8cc405..77dc6b4899 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java
@@ -19,7 +19,6 @@ import com.google.devtools.build.lib.query2.engine.QueryEnvironment.Argument;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.ArgumentType;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.QueryFunction;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.Setting;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -161,12 +160,12 @@ class TestsFunction implements QueryFunction {
}
/**
- * Computes and returns the set of test rules in a particular suite. Uses
- * dynamic programming---a memoized version of {@link #computeTestsInSuite}.
+ * Computes and returns the set of test rules in a particular suite. Uses dynamic
+ * programming---a memoized version of {@link #computeTestsInSuite}.
*
* @precondition env.getAccessor().isTestSuite(testSuite)
*/
- private Set<T> getTestsInSuite(T testSuite) throws QueryException {
+ private Set<T> getTestsInSuite(T testSuite) throws QueryException, InterruptedException {
Set<T> tests = testsInSuite.get(testSuite);
if (tests == null) {
tests = Sets.newHashSet();
@@ -177,14 +176,15 @@ class TestsFunction implements QueryFunction {
}
/**
- * Populates 'result' with all the tests associated with the specified
- * 'testSuite'. Throws an exception if any target is missing.
+ * Populates 'result' with all the tests associated with the specified 'testSuite'. Throws an
+ * exception if any target is missing.
*
- * <p>CAUTION! Keep this logic consistent with {@code TestsSuiteConfiguredTarget}!
+ * <p>CAUTION! Keep this logic consistent with {@code TestsSuiteConfiguredTarget}!
*
* @precondition env.getAccessor().isTestSuite(testSuite)
*/
- private void computeTestsInSuite(T testSuite, Set<T> result) throws QueryException {
+ private void computeTestsInSuite(T testSuite, Set<T> result)
+ throws QueryException, InterruptedException {
List<T> testsAndSuites = new ArrayList<>();
// Note that testsAndSuites can contain input file targets; the test_suite rule does not
// restrict the set of targets that can appear in tests or suites.
@@ -231,7 +231,8 @@ class TestsFunction implements QueryFunction {
*
* @precondition env.getAccessor().isTestSuite(testSuite)
*/
- private List<T> getPrerequisites(T testSuite, String attrName) throws QueryException {
+ private List<T> getPrerequisites(T testSuite, String attrName)
+ throws QueryException, InterruptedException {
return env.getAccessor().getLabelListAttr(expression, testSuite, attrName,
"couldn't expand '" + attrName
+ "' attribute of test_suite " + env.getAccessor().getLabel(testSuite) + ": ");
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java
index 03a2ccf2bb..f69f134bc1 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java
@@ -18,7 +18,6 @@ import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.Argument;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.ArgumentType;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.QueryFunction;
-
import java.util.List;
import java.util.Set;
@@ -71,11 +70,9 @@ public class VisibleFunction implements QueryFunction {
});
}
- /**
- * Returns true if {@code target} is visible to all targets in {@code toSet}.
- */
- private static <T> boolean visibleToAll(
- QueryEnvironment<T> env, Set<T> toSet, T target) throws QueryException {
+ /** Returns true if {@code target} is visible to all targets in {@code toSet}. */
+ private static <T> boolean visibleToAll(QueryEnvironment<T> env, Set<T> toSet, T target)
+ throws QueryException, InterruptedException {
for (T to : toSet) {
if (!visible(env, to, target)) {
return false;
@@ -84,10 +81,9 @@ public class VisibleFunction implements QueryFunction {
return true;
}
- /**
- * Returns true if the target {@code from} is visible to the target {@code to}.
- */
- public static <T> boolean visible(QueryEnvironment<T> env, T to, T from) throws QueryException {
+ /** Returns true if the target {@code from} is visible to the target {@code to}. */
+ public static <T> boolean visible(QueryEnvironment<T> env, T to, T from)
+ throws QueryException, InterruptedException {
Set<QueryVisibility<T>> visiblePackages = env.getAccessor().getVisibility(from);
for (QueryVisibility<T> spec : visiblePackages) {
if (spec.contains(to)) {
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 8afd3849a6..5119a21119 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
@@ -653,17 +653,27 @@ public final class SkylarkRuleContext {
return attributesCollection.getExecutableRunfilesMap().get(executable);
}
- @SkylarkCallable(name = "info_file", structField = true, documented = false,
- doc = "Returns the file that is used to hold the non-volatile workspace status for the "
- + "current build request.")
- public Artifact getStableWorkspaceStatus() {
+ @SkylarkCallable(
+ name = "info_file",
+ structField = true,
+ documented = false,
+ doc =
+ "Returns the file that is used to hold the non-volatile workspace status for the "
+ + "current build request."
+ )
+ public Artifact getStableWorkspaceStatus() throws InterruptedException {
return ruleContext.getAnalysisEnvironment().getStableWorkspaceStatusArtifact();
}
- @SkylarkCallable(name = "version_file", structField = true, documented = false,
- doc = "Returns the file that is used to hold the volatile workspace status for the "
- + "current build request.")
- public Artifact getVolatileWorkspaceStatus() {
+ @SkylarkCallable(
+ name = "version_file",
+ structField = true,
+ documented = false,
+ doc =
+ "Returns the file that is used to hold the volatile workspace status for the "
+ + "current build request."
+ )
+ public Artifact getVolatileWorkspaceStatus() throws InterruptedException {
return ruleContext.getAnalysisEnvironment().getVolatileWorkspaceStatusArtifact();
}
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 97715cb689..42e911842b 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
@@ -68,14 +68,12 @@ import com.google.devtools.build.lib.rules.java.ProguardHelper.ProguardOutput;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -798,7 +796,8 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory {
}
private static Artifact getStubDex(
- RuleContext ruleContext, JavaSemantics javaSemantics, boolean split) {
+ RuleContext ruleContext, JavaSemantics javaSemantics, boolean split)
+ throws InterruptedException {
String attribute =
split ? "$incremental_split_stub_application" : "$incremental_stub_application";
@@ -868,8 +867,12 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory {
/** Generates an uncompressed _deploy.jar of all the runtime jars. */
public static Artifact createDeployJar(
- RuleContext ruleContext, JavaSemantics javaSemantics, AndroidCommon common,
- JavaTargetAttributes attributes, Artifact deployJar) {
+ RuleContext ruleContext,
+ JavaSemantics javaSemantics,
+ AndroidCommon common,
+ JavaTargetAttributes attributes,
+ Artifact deployJar)
+ throws InterruptedException {
new DeployArchiveBuilder(javaSemantics, ruleContext)
.setOutputJar(deployJar)
.setAttributes(attributes)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java
index 278606df1a..4b9c95003d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java
@@ -38,7 +38,6 @@ import com.google.devtools.common.options.Converters;
import com.google.devtools.common.options.EnumConverter;
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionsParsingException;
-
import java.util.List;
import java.util.Set;
@@ -375,7 +374,7 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
public static class Loader implements ConfigurationFragmentFactory {
@Override
public Fragment create(ConfigurationEnvironment env, BuildOptions buildOptions)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
AndroidConfiguration.Options androidOptions =
buildOptions.get(AndroidConfiguration.Options.class);
Label androidSdk = RedirectChaser.followRedirects(env, androidOptions.sdk, "android_sdk");
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/NativeLibs.java b/src/main/java/com/google/devtools/build/lib/rules/android/NativeLibs.java
index 4e582aa296..cbffcd8f0e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/NativeLibs.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/NativeLibs.java
@@ -65,7 +65,8 @@ public final class NativeLibs {
String nativeDepsFileName,
Multimap<String, TransitiveInfoCollection> depsByArchitecture,
Map<String, CcToolchainProvider> toolchainMap,
- Map<String, BuildConfiguration> configurationMap) {
+ Map<String, BuildConfiguration> configurationMap)
+ throws InterruptedException {
Map<String, Iterable<Artifact>> result = new LinkedHashMap<>();
for (Map.Entry<String, Collection<TransitiveInfoCollection>> entry :
depsByArchitecture.asMap().entrySet()) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
index c8fe054b50..740f5c00bf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
@@ -34,12 +34,10 @@ import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
import com.google.devtools.build.lib.util.Preconditions;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-
import javax.annotation.Nullable;
/** A configuration containing flags required for Apple platforms and tools. */
@@ -444,7 +442,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
public static class Loader implements ConfigurationFragmentFactory {
@Override
public AppleConfiguration create(ConfigurationEnvironment env, BuildOptions buildOptions)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
AppleCommandLineOptions appleOptions = buildOptions.get(AppleCommandLineOptions.class);
XcodeVersionProperties xcodeVersionProperties = getXcodeVersionProperties(env, appleOptions);
@@ -487,18 +485,19 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
}
/**
- * Uses the {@link AppleCommandLineOptions#xcodeVersion} and
- * {@link AppleCommandLineOptions#xcodeVersionConfig} command line options to determine and
- * return the effective xcode version properties. Returns absent if no explicit xcode version
- * is declared, and host system defaults should be used.
+ * Uses the {@link AppleCommandLineOptions#xcodeVersion} and {@link
+ * AppleCommandLineOptions#xcodeVersionConfig} command line options to determine and return the
+ * effective xcode version properties. Returns absent if no explicit xcode version is declared,
+ * and host system defaults should be used.
*
* @param env the current configuration environment
* @param appleOptions the command line options
* @throws InvalidConfigurationException if the options given (or configuration targets) were
* malformed and thus the xcode version could not be determined
*/
- private XcodeVersionProperties getXcodeVersionProperties(ConfigurationEnvironment env,
- AppleCommandLineOptions appleOptions) throws InvalidConfigurationException {
+ private static XcodeVersionProperties getXcodeVersionProperties(
+ ConfigurationEnvironment env, AppleCommandLineOptions appleOptions)
+ throws InvalidConfigurationException, InterruptedException {
Optional<DottedVersion> xcodeVersionCommandLineFlag =
Optional.fromNullable(appleOptions.xcodeVersion);
Label xcodeVersionConfigLabel = appleOptions.xcodeVersionConfig;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfig.java b/src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfig.java
index b4b28435eb..67a3d9e556 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfig.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfig.java
@@ -35,10 +35,8 @@ import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.rules.RuleConfiguredTargetFactory;
import com.google.devtools.build.lib.syntax.Type;
-
import java.util.List;
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -55,9 +53,9 @@ public class XcodeConfig implements RuleConfiguredTargetFactory {
}
/**
- * Uses the {@link AppleCommandLineOptions#xcodeVersion} and
- * {@link AppleCommandLineOptions#xcodeVersionConfig} command line options to determine and
- * return the effective xcode version and its properties.
+ * Uses the {@link AppleCommandLineOptions#xcodeVersion} and {@link
+ * AppleCommandLineOptions#xcodeVersionConfig} command line options to determine and return the
+ * effective xcode version and its properties.
*
* @param env the current configuration environment
* @param xcodeConfigLabel the label for the xcode_config target to parse
@@ -68,9 +66,12 @@ public class XcodeConfig implements RuleConfiguredTargetFactory {
* @throws InvalidConfigurationException if the options given (or configuration targets) were
* malformed and thus the xcode version could not be determined
*/
- public static XcodeVersionProperties resolveXcodeVersion(ConfigurationEnvironment env,
- Label xcodeConfigLabel, Optional<DottedVersion> xcodeVersionOverrideFlag,
- String errorDescription) throws InvalidConfigurationException {
+ static XcodeVersionProperties resolveXcodeVersion(
+ ConfigurationEnvironment env,
+ Label xcodeConfigLabel,
+ Optional<DottedVersion> xcodeVersionOverrideFlag,
+ String errorDescription)
+ throws InvalidConfigurationException, InterruptedException {
Rule xcodeConfigRule =
getRuleForLabel(xcodeConfigLabel, "xcode_config", env, errorDescription);
@@ -88,16 +89,18 @@ public class XcodeConfig implements RuleConfiguredTargetFactory {
/**
* Returns the {@link XcodeVersionRuleData} associated with the {@code xcode_version} target
- * explicitly defined in the {@code --xcode_version_config} build flag and selected by the
- * {@code --xcode_version} flag. If {@code --xcode_version} is unspecified, then this
- * will return the default rule data as specified in the {@code --xcode_version_config} target.
- * Returns null if either the {@code --xcode_version} did not match any {@code xcode_version}
- * target, or if {@code --xcode_version} is unspecified and {@code --xcode_version_config}
- * specified no default target.
+ * explicitly defined in the {@code --xcode_version_config} build flag and selected by the {@code
+ * --xcode_version} flag. If {@code --xcode_version} is unspecified, then this will return the
+ * default rule data as specified in the {@code --xcode_version_config} target. Returns null if
+ * either the {@code --xcode_version} did not match any {@code xcode_version} target, or if {@code
+ * --xcode_version} is unspecified and {@code --xcode_version_config} specified no default target.
*/
- @Nullable private static XcodeVersionRuleData resolveExplicitlyDefinedVersion(
- ConfigurationEnvironment env, Rule xcodeConfigTarget,
- Optional<DottedVersion> versionOverrideFlag) throws InvalidConfigurationException {
+ @Nullable
+ private static XcodeVersionRuleData resolveExplicitlyDefinedVersion(
+ ConfigurationEnvironment env,
+ Rule xcodeConfigTarget,
+ Optional<DottedVersion> versionOverrideFlag)
+ throws InvalidConfigurationException, InterruptedException {
Map<String, XcodeVersionRuleData> aliasesToVersionMap =
aliasesToVersionMap(env, xcodeConfigTarget);
@@ -129,11 +132,13 @@ public class XcodeConfig implements RuleConfiguredTargetFactory {
}
/**
- * Returns the default xcode version to use, if no {@code --xcode_version} command line flag
- * was specified.
+ * Returns the default xcode version to use, if no {@code --xcode_version} command line flag was
+ * specified.
*/
- @Nullable private static XcodeVersionRuleData getDefaultVersion(ConfigurationEnvironment env,
- Rule xcodeConfigTarget) throws InvalidConfigurationException {
+ @Nullable
+ private static XcodeVersionRuleData getDefaultVersion(
+ ConfigurationEnvironment env, Rule xcodeConfigTarget)
+ throws InvalidConfigurationException, InterruptedException {
Label defaultVersionLabel = NonconfigurableAttributeMapper.of(xcodeConfigTarget)
.get(XcodeConfigRule.DEFAULT_ATTR_NAME, BuildType.LABEL);
if (defaultVersionLabel != null) {
@@ -146,15 +151,15 @@ public class XcodeConfig implements RuleConfiguredTargetFactory {
}
/**
- * Returns a map where keys are "names" of xcode versions as defined by the configuration
- * target, and values are the rule data objects which contain information regarding that
- * xcode version.
+ * Returns a map where keys are "names" of xcode versions as defined by the configuration target,
+ * and values are the rule data objects which contain information regarding that xcode version.
*
* @throws InvalidConfigurationException if there are duplicate aliases (if two xcode versions
* were registered to the same alias)
*/
- private static Map<String, XcodeVersionRuleData> aliasesToVersionMap(ConfigurationEnvironment env,
- Rule xcodeConfigTarget) throws InvalidConfigurationException {
+ private static Map<String, XcodeVersionRuleData> aliasesToVersionMap(
+ ConfigurationEnvironment env, Rule xcodeConfigTarget)
+ throws InvalidConfigurationException, InterruptedException {
List<Label> xcodeVersionLabels = NonconfigurableAttributeMapper.of(xcodeConfigTarget)
.get(XcodeConfigRule.VERSIONS_ATTR_NAME, BuildType.LABEL_LIST);
ImmutableList.Builder<XcodeVersionRuleData> xcodeVersionRuleListBuilder =
@@ -206,12 +211,13 @@ public class XcodeConfig implements RuleConfiguredTargetFactory {
}
/**
- * If the given label (following redirects) is a target for a rule of type {@code type},
- * then returns the {@link Rule} representing that target. Otherwise, throws a
- * {@link InvalidConfigurationException}.
+ * If the given label (following redirects) is a target for a rule of type {@code type}, then
+ * returns the {@link Rule} representing that target. Otherwise, throws a {@link
+ * InvalidConfigurationException}.
*/
- private static Rule getRuleForLabel(Label label, String type, ConfigurationEnvironment env,
- String description) throws InvalidConfigurationException {
+ private static Rule getRuleForLabel(
+ Label label, String type, ConfigurationEnvironment env, String description)
+ throws InvalidConfigurationException, InterruptedException {
label = RedirectChaser.followRedirects(env, label, description);
if (label == null) {
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 1856b04a19..d49415f6a4 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
@@ -396,7 +396,8 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory {
boolean fake,
Artifact binary,
LinkStaticness linkStaticness,
- List<String> linkopts) {
+ List<String> linkopts)
+ throws InterruptedException {
CppLinkActionBuilder builder =
new CppLinkActionBuilder(context, binary)
.setCrosstoolInputs(CppHelper.getToolchain(context).getLink())
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java
index 8e2a5aa402..ead1c79d25 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java
@@ -24,13 +24,11 @@ import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.RunfilesProvider;
import com.google.devtools.build.lib.analysis.actions.CreateIncSymlinkAction;
-import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException;
import com.google.devtools.build.lib.rules.RuleConfiguredTargetFactory;
import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration;
import com.google.devtools.build.lib.rules.test.InstrumentedFilesProvider;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.ArrayList;
import java.util.Arrays;
@@ -58,7 +56,8 @@ public abstract class CcIncLibrary implements RuleConfiguredTargetFactory {
}
@Override
- public ConfiguredTarget create(final RuleContext ruleContext) throws RuleErrorException {
+ public ConfiguredTarget create(final RuleContext ruleContext)
+ throws RuleErrorException, InterruptedException {
FeatureConfiguration featureConfiguration = CcCommon.configureFeatures(ruleContext);
PathFragment packageFragment = ruleContext.getPackageDirectory();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
index 73fd7095b1..3dd3f96515 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
@@ -92,7 +92,8 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory {
}
@Override
- public ConfiguredTarget create(RuleContext context) throws RuleErrorException {
+ public ConfiguredTarget create(RuleContext context)
+ throws RuleErrorException, InterruptedException {
RuleConfiguredTargetBuilder builder = new RuleConfiguredTargetBuilder(context);
LinkTargetType linkType = getStaticLinkType(context);
boolean linkStatic = context.attributes().get("linkstatic", Type.BOOLEAN);
@@ -113,7 +114,7 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory {
boolean linkStatic,
boolean collectLinkstamp,
boolean addDynamicRuntimeInputArtifactsToRunfiles)
- throws RuleErrorException {
+ throws RuleErrorException, InterruptedException {
FeatureConfiguration featureConfiguration = CcCommon.configureFeatures(ruleContext);
final CcCommon common = new CcCommon(ruleContext);
PrecompiledFiles precompiledFiles = new PrecompiledFiles(ruleContext);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java
index 43d43dcc95..2b78db3c0b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java
@@ -868,7 +868,7 @@ public final class CcLibraryHelper {
*
* @throws RuleErrorException
*/
- public Info build() throws RuleErrorException {
+ public Info build() throws RuleErrorException, InterruptedException {
// Fail early if there is no lipo context collector on the rule - otherwise we end up failing
// in lipo optimization.
Preconditions.checkState(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
index f56ffdd2a4..f24432db98 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
@@ -62,7 +62,8 @@ public class CcToolchain implements RuleConfiguredTargetFactory {
new PathFragment("include/stdc-predef.h");
@Override
- public ConfiguredTarget create(RuleContext ruleContext) throws RuleErrorException {
+ public ConfiguredTarget create(RuleContext ruleContext)
+ throws RuleErrorException, InterruptedException {
TransitiveInfoCollection lipoContextCollector =
ruleContext.getPrerequisite(":lipo_context_collector", Mode.DONT_CHECK);
if (lipoContextCollector != null
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
index 91ff304ee0..3769518150 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
@@ -993,8 +993,10 @@ public class CppCompileAction extends AbstractAction
@Override
public Iterable<Artifact> resolveInputsFromCache(
- ArtifactResolver artifactResolver, PackageRootResolver resolver,
- Collection<PathFragment> inputPaths) throws PackageRootResolutionException {
+ ArtifactResolver artifactResolver,
+ PackageRootResolver resolver,
+ Collection<PathFragment> inputPaths)
+ throws PackageRootResolutionException, InterruptedException {
// Note that this method may trigger a violation of the desirable invariant that getInputs()
// is a superset of getMandatoryInputs(). See bug about an "action not in canonical form"
// error message and the integration test test_crosstool_change_and_failure().
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
index e5097f08d4..c59480fb96 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
@@ -39,7 +39,6 @@ import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig;
-
import javax.annotation.Nullable;
/**
@@ -69,7 +68,7 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
@Override
public CppConfiguration create(ConfigurationEnvironment env, BuildOptions options)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
CppConfigurationParameters params = createParameters(env, options);
if (params == null) {
return null;
@@ -113,7 +112,8 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
@Nullable
protected CppConfigurationParameters createParameters(
- ConfigurationEnvironment env, BuildOptions options) throws InvalidConfigurationException {
+ ConfigurationEnvironment env, BuildOptions options)
+ throws InvalidConfigurationException, InterruptedException {
BlazeDirectories directories = env.getBlazeDirectories();
if (directories == null) {
return null;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java
index ab0eb4163b..5268ff4fbd 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java
@@ -425,7 +425,7 @@ public class CppLinkActionBuilder {
}
/** Builds the Action as configured and returns it. */
- public CppLinkAction build() {
+ public CppLinkAction build() throws InterruptedException {
Preconditions.checkState(
(libraryIdentifier == null) == (linkType == LinkTargetType.EXECUTABLE));
if (interfaceOutput != null && (fake || linkType != LinkTargetType.DYNAMIC_LIBRARY)) {
@@ -1026,7 +1026,7 @@ public class CppLinkActionBuilder {
* #addLibraries}, and {@link #addLinkstamps}.
*/
public CppLinkActionBuilder addLinkParams(
- CcLinkParams linkParams, RuleErrorConsumer errorListener) {
+ CcLinkParams linkParams, RuleErrorConsumer errorListener) throws InterruptedException {
addLinkopts(linkParams.flattenedLinkopts());
addLibraries(linkParams.getLibraries());
ExtraLinkTimeLibraries extraLinkTimeLibraries = linkParams.getExtraLinkTimeLibraries();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
index ba76f3e56d..8e0120efe0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
@@ -823,8 +823,9 @@ public final class CppModel {
*
* @throws RuleErrorException
*/
- public CcLinkingOutputs createCcLinkActions(CcCompilationOutputs ccOutputs,
- Iterable<Artifact> nonCodeLinkerInputs) throws RuleErrorException {
+ public CcLinkingOutputs createCcLinkActions(
+ CcCompilationOutputs ccOutputs, Iterable<Artifact> nonCodeLinkerInputs)
+ throws RuleErrorException, InterruptedException {
// For now only handle static links. Note that the dynamic library link below ignores linkType.
// TODO(bazel-team): Either support non-static links or move this check to setLinkType().
Preconditions.checkState(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java
index 0a15404699..d8fbe78555 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java
@@ -41,14 +41,12 @@ import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.Cross
import com.google.protobuf.TextFormat;
import com.google.protobuf.TextFormat.ParseException;
import com.google.protobuf.UninitializedMessageException;
-
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
-
import javax.annotation.Nullable;
/**
@@ -171,7 +169,7 @@ public class CrosstoolConfigurationLoader {
}
private static CrosstoolProto getCrosstoolProtofromBuildFile(
- ConfigurationEnvironment env, Label crosstoolTop) {
+ ConfigurationEnvironment env, Label crosstoolTop) throws InterruptedException {
Target target;
try {
target = env.getTarget(crosstoolTop);
@@ -202,7 +200,7 @@ public class CrosstoolConfigurationLoader {
private static CrosstoolProto getCrosstoolProtoFromCrosstoolFile(
ConfigurationEnvironment env, Label crosstoolTop)
- throws IOException, InvalidConfigurationException {
+ throws IOException, InvalidConfigurationException, InterruptedException {
final Path path;
try {
Package containingPackage = env.getTarget(crosstoolTop.getLocalTargetLabel("BUILD"))
@@ -234,7 +232,7 @@ public class CrosstoolConfigurationLoader {
private static CrosstoolFile findCrosstoolConfiguration(
ConfigurationEnvironment env, Label crosstoolTop)
- throws IOException, InvalidConfigurationException {
+ throws IOException, InvalidConfigurationException, InterruptedException {
CrosstoolProto crosstoolProto = getCrosstoolProtofromBuildFile(env, crosstoolTop);
if (crosstoolProto == null) {
@@ -267,12 +265,11 @@ public class CrosstoolConfigurationLoader {
}
}
- /**
- * Reads a crosstool file.
- */
+ /** Reads a crosstool file. */
@Nullable
public static CrosstoolConfigurationLoader.CrosstoolFile readCrosstool(
- ConfigurationEnvironment env, Label crosstoolTop) throws InvalidConfigurationException {
+ ConfigurationEnvironment env, Label crosstoolTop)
+ throws InvalidConfigurationException, InterruptedException {
crosstoolTop = RedirectChaser.followRedirects(env, crosstoolTop, "crosstool_top");
if (crosstoolTop == null) {
return null;
@@ -400,9 +397,11 @@ public class CrosstoolConfigurationLoader {
}
public static CrosstoolConfig.CrosstoolRelease getCrosstoolReleaseProto(
- ConfigurationEnvironment env, BuildOptions options,
- Label crosstoolTop, Function<String, String> cpuTransformer)
- throws InvalidConfigurationException {
+ ConfigurationEnvironment env,
+ BuildOptions options,
+ Label crosstoolTop,
+ Function<String, String> cpuTransformer)
+ throws InvalidConfigurationException, InterruptedException {
CrosstoolConfigurationLoader.CrosstoolFile file =
readCrosstool(env, crosstoolTop);
// Make sure that we have the requested toolchain in the result. Throw an exception if not.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/ExtraLinkTimeLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/ExtraLinkTimeLibrary.java
index 52b2a0822a..5daeb2deaa 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/ExtraLinkTimeLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/ExtraLinkTimeLibrary.java
@@ -32,10 +32,8 @@ import com.google.devtools.build.lib.rules.cpp.LinkerInputs.LibraryToLink;
* context.
*/
public interface ExtraLinkTimeLibrary {
- /**
- * Build the LibraryToLink inputs to pass to the C++ linker.
- */
- NestedSet<LibraryToLink> buildLibraries(RuleContext context);
+ /** Build the LibraryToLink inputs to pass to the C++ linker. */
+ NestedSet<LibraryToLink> buildLibraries(RuleContext context) throws InterruptedException;
/**
* Get a new Builder for this ExtraLinkTimeLibrary class. This acts
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
index 747ea822e0..db3fbf1815 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
@@ -38,7 +38,6 @@ import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.lib.vfs.ZipFileSystem;
import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.LipoMode;
import com.google.devtools.build.skyframe.SkyFunction;
-
import java.io.IOException;
import java.util.Collection;
import java.util.zip.ZipException;
@@ -233,11 +232,14 @@ public class FdoSupport {
return fdoRoot;
}
- /**
- * Creates an initialized {@link FdoSupport} instance.
- */
- static FdoSupport create(SkyFunction.Environment env, PathFragment fdoInstrument,
- Path fdoProfile, LipoMode lipoMode, Path execRoot) throws IOException, FdoException {
+ /** Creates an initialized {@link FdoSupport} instance. */
+ static FdoSupport create(
+ SkyFunction.Environment env,
+ PathFragment fdoInstrument,
+ Path fdoProfile,
+ LipoMode lipoMode,
+ Path execRoot)
+ throws IOException, FdoException, InterruptedException {
FdoMode fdoMode;
if (fdoProfile != null && isAutoFdo(fdoProfile.getBaseName())) {
fdoMode = FdoMode.AUTO_FDO;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
index 88c967ae72..ef3e620296 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
@@ -39,12 +39,10 @@ import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
-
import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
@@ -165,9 +163,11 @@ public final class ExtraAction extends SpawnAction {
@Nullable
@Override
- public Iterable<Artifact> resolveInputsFromCache(ArtifactResolver artifactResolver,
- PackageRootResolver resolver, Collection<PathFragment> inputPaths)
- throws PackageRootResolutionException {
+ public Iterable<Artifact> resolveInputsFromCache(
+ ArtifactResolver artifactResolver,
+ PackageRootResolver resolver,
+ Collection<PathFragment> inputPaths)
+ throws PackageRootResolutionException, InterruptedException {
// We update the inputs directly from the shadowed action.
Set<PathFragment> extraActionPathFragments =
ImmutableSet.copyOf(Artifact.asPathFragments(extraActionInputs));
diff --git a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
index c5ebb6f8b3..2a336da0bf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
@@ -44,7 +44,6 @@ import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.NoSuchPackageException;
import com.google.devtools.build.lib.packages.NoSuchTargetException;
import com.google.devtools.build.lib.packages.Package;
-import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.pkgcache.FilteringPolicies;
import com.google.devtools.build.lib.pkgcache.FilteringPolicy;
@@ -78,7 +77,6 @@ import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.ValueOrException;
import com.google.devtools.common.options.OptionsParser;
import com.google.devtools.common.options.OptionsParsingException;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -89,7 +87,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -168,7 +165,7 @@ public class GenQuery implements RuleConfiguredTargetFactory {
// The transitive closure of these targets is an upper estimate on the labels
// the query will touch
- private Set<Target> getScope(RuleContext context) {
+ private static Set<Target> getScope(RuleContext context) throws InterruptedException {
List<Label> scopeLabels = context.attributes().get("scope", BuildType.LABEL_LIST);
Set<Target> scope = Sets.newHashSetWithExpectedSize(scopeLabels.size());
for (Label scopePart : scopeLabels) {
@@ -199,8 +196,9 @@ public class GenQuery implements RuleConfiguredTargetFactory {
}
@Nullable
- private Pair<ImmutableMap<PackageIdentifier, Package>, ImmutableMap<Label, Target>>
- constructPackageMap(SkyFunction.Environment env, Collection<Target> scope) {
+ private static Pair<ImmutableMap<PackageIdentifier, Package>, ImmutableMap<Label, Target>>
+ constructPackageMap(SkyFunction.Environment env, Collection<Target> scope)
+ throws InterruptedException {
// It is not necessary for correctness to construct intermediate NestedSets; we could iterate
// over individual targets in scope immediately. However, creating a composite NestedSet first
// saves us from iterating over the same sub-NestedSets multiple times.
@@ -374,10 +372,9 @@ public class GenQuery implements RuleConfiguredTargetFactory {
}
@Override
- public Map<String, ResolvedTargets<Target>> preloadTargetPatterns(EventHandler eventHandler,
- Collection<String> patterns,
- boolean keepGoing)
- throws TargetParsingException {
+ public Map<String, ResolvedTargets<Target>> preloadTargetPatterns(
+ EventHandler eventHandler, Collection<String> patterns, boolean keepGoing)
+ throws TargetParsingException, InterruptedException {
Preconditions.checkArgument(!keepGoing);
boolean ok = true;
Map<String, ResolvedTargets<Target>> preloadedPatterns =
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java
index 3e2b13ae58..43b567699d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java
@@ -25,11 +25,9 @@ import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.collect.IterablesChain;
import com.google.devtools.build.lib.util.Preconditions;
-
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -193,10 +191,8 @@ public class DeployArchiveBuilder {
return args;
}
- /**
- * Builds the action as configured.
- */
- public void build() {
+ /** Builds the action as configured. */
+ public void build() throws InterruptedException {
ImmutableList<Artifact> classpathResources = attributes.getClassPathResources();
Set<String> classPathResourceNames = new HashSet<>();
for (Artifact artifact : classpathResources) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java
index a87e5b4ba5..934437c877 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java
@@ -51,14 +51,12 @@ import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -176,8 +174,13 @@ public class JavaCommon {
* Creates an action to aggregate all metadata artifacts into a single
* &lt;target_name&gt;_instrumented.jar file.
*/
- public static void createInstrumentedJarAction(RuleContext ruleContext, JavaSemantics semantics,
- List<Artifact> metadataArtifacts, Artifact instrumentedJar, String mainClass) {
+ public static void createInstrumentedJarAction(
+ RuleContext ruleContext,
+ JavaSemantics semantics,
+ List<Artifact> metadataArtifacts,
+ Artifact instrumentedJar,
+ String mainClass)
+ throws InterruptedException {
// In Jacoco's setup, metadata artifacts are real jars.
new DeployArchiveBuilder(semantics, ruleContext)
.setOutputJar(instrumentedJar)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaConfigurationLoader.java
index c6eda487fb..6ae2f22b81 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaConfigurationLoader.java
@@ -41,7 +41,7 @@ public class JavaConfigurationLoader implements ConfigurationFragmentFactory {
@Override
public JavaConfiguration create(ConfigurationEnvironment env, BuildOptions buildOptions)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
CppConfiguration cppConfiguration = env.getFragment(buildOptions, CppConfiguration.class);
if (cppConfiguration == null) {
return null;
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 44247890e0..fa665c44aa 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
@@ -265,10 +265,14 @@ public interface JavaSemantics {
*
* @return new main class
*/
- String addCoverageSupport(JavaCompilationHelper helper,
+ String addCoverageSupport(
+ JavaCompilationHelper helper,
JavaTargetAttributes.Builder attributes,
- Artifact executable, Artifact instrumentationMetadata,
- JavaCompilationArtifacts.Builder javaArtifactsBuilder, String mainClass);
+ Artifact executable,
+ Artifact instrumentationMetadata,
+ JavaCompilationArtifacts.Builder javaArtifactsBuilder,
+ String mainClass)
+ throws InterruptedException;
/**
* Return the JVM flags to be used in a Java binary.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java
index c127140e1e..904f8637de 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java
@@ -34,9 +34,7 @@ import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.List;
-
import javax.annotation.Nullable;
/**
@@ -60,7 +58,7 @@ public final class JvmConfigurationLoader implements ConfigurationFragmentFactor
@Override
public Jvm create(ConfigurationEnvironment env, BuildOptions buildOptions)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
JavaOptions javaOptions = buildOptions.get(JavaOptions.class);
if (javaOptions.disableJvm) {
// TODO(bazel-team): Instead of returning null here, add another method to the interface.
@@ -92,8 +90,8 @@ public final class JvmConfigurationLoader implements ConfigurationFragmentFactor
}
@Nullable
- private Jvm createDefault(ConfigurationEnvironment lookup, String javaHome, String cpu)
- throws InvalidConfigurationException, LabelSyntaxException {
+ private static Jvm createDefault(ConfigurationEnvironment lookup, String javaHome, String cpu)
+ throws InvalidConfigurationException, LabelSyntaxException, InterruptedException {
try {
Label label = Label.parseAbsolute(javaHome);
label = RedirectChaser.followRedirects(lookup, label, "jdk");
diff --git a/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java b/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java
index 8b9f9fe878..b9896e90ca 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java
@@ -87,13 +87,16 @@ public abstract class NativeDepsHelper {
*
* @param ruleContext the rule context to determine the native deps library
* @param linkParams the {@link CcLinkParams} for the rule, collected with linkstatic = 1 and
- * linkshared = 1
+ * linkshared = 1
* @return the native deps library runfiles. If the transitive deps closure of the rule contains
- * no native code libraries, its fields are null.
+ * no native code libraries, its fields are null.
*/
- public static Artifact maybeCreateAndroidNativeDepsAction(final RuleContext ruleContext,
- CcLinkParams linkParams, final BuildConfiguration configuration,
- CcToolchainProvider toolchain) {
+ public static Artifact maybeCreateAndroidNativeDepsAction(
+ final RuleContext ruleContext,
+ CcLinkParams linkParams,
+ final BuildConfiguration configuration,
+ CcToolchainProvider toolchain)
+ throws InterruptedException {
if (linkParams.getLibraries().isEmpty()) {
return null;
}
@@ -128,7 +131,8 @@ public abstract class NativeDepsHelper {
Artifact nativeDeps,
String libraryIdentifier,
Root bindirIfShared,
- boolean useDynamicRuntime) {
+ boolean useDynamicRuntime)
+ throws InterruptedException {
Preconditions.checkState(
ruleContext.isLegalFragment(CppConfiguration.class),
"%s does not have access to CppConfiguration",
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfigurationLoader.java
index cb8503d428..a23a234d52 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfigurationLoader.java
@@ -30,7 +30,7 @@ import com.google.devtools.build.lib.analysis.config.InvalidConfigurationExcepti
public class ObjcConfigurationLoader implements ConfigurationFragmentFactory {
@Override
public ObjcConfiguration create(ConfigurationEnvironment env, BuildOptions buildOptions)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
Options options = buildOptions.get(BuildConfiguration.Options.class);
ObjcCommandLineOptions objcOptions = buildOptions.get(ObjcCommandLineOptions.class);
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 39e6d2ce13..c870acc999 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
@@ -312,7 +312,7 @@ public final class ReleaseBundlingSupport {
return this;
}
- private void registerEmbedLabelPlistAction() {
+ private void registerEmbedLabelPlistAction() throws InterruptedException {
Artifact buildInfo = Iterables.getOnlyElement(
ruleContext.getBuildInfo(ObjcBuildInfoFactory.KEY));
String generatedVersionPlistPath = getGeneratedVersionPlist().getShellEscapedExecPathString();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java
index 2599cb139d..ff49b2d9b3 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java
@@ -26,7 +26,6 @@ import com.google.devtools.build.lib.rules.cpp.CppConfiguration;
import com.google.devtools.build.lib.rules.cpp.CppOptions;
import com.google.devtools.build.lib.rules.cpp.CrosstoolConfigurationLoader;
import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig;
-
import javax.annotation.Nullable;
/**
@@ -47,7 +46,7 @@ public class PythonConfigurationLoader implements ConfigurationFragmentFactory {
@Nullable
private CrosstoolConfig.CToolchain getToolchain(
ConfigurationEnvironment env, BuildOptions buildOptions, Label crosstoolTop)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
CrosstoolConfigurationLoader.CrosstoolFile file =
CrosstoolConfigurationLoader.readCrosstool(env, crosstoolTop);
if (file == null) {
@@ -59,7 +58,7 @@ public class PythonConfigurationLoader implements ConfigurationFragmentFactory {
@Override
public PythonConfiguration create(ConfigurationEnvironment env, BuildOptions buildOptions)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
PythonOptions pythonOptions = buildOptions.get(PythonOptions.class);
CppConfiguration cppConfiguration = env.getFragment(buildOptions, CppConfiguration.class);
if (cppConfiguration == null) {
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 d45a8093e9..08fcb1b465 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
@@ -41,10 +41,9 @@ public interface PythonSemantics {
*/
void collectRunfilesForBinary(RuleContext ruleContext, Runfiles.Builder builder, PyCommon common);
- /**
- * Extends the default runfiles of {@code py_binary} rules with custom elements.
- */
- void collectDefaultRunfilesForBinary(RuleContext ruleContext, Runfiles.Builder builder);
+ /** Extends the default runfiles of {@code py_binary} rules with custom elements. */
+ void collectDefaultRunfilesForBinary(RuleContext ruleContext, Runfiles.Builder builder)
+ throws InterruptedException;
/**
* Returns the coverage instrumentation specification to be used in Python rules.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/LocalRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/LocalRepositoryFunction.java
index 258cb960a0..b5f9071456 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/repository/LocalRepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/LocalRepositoryFunction.java
@@ -21,10 +21,8 @@ import com.google.devtools.build.lib.skyframe.FileValue;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
-import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
/**
@@ -40,7 +38,7 @@ public class LocalRepositoryFunction extends RepositoryFunction {
@Override
public SkyValue fetch(
Rule rule, Path outputDirectory, BlazeDirectories directories, Environment env)
- throws SkyFunctionException {
+ throws InterruptedException, RepositoryFunctionException {
PathFragment pathFragment = RepositoryFunction.getTargetPath(rule, directories.getWorkspace());
try {
outputDirectory.createSymbolicLink(pathFragment);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/NewLocalRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/NewLocalRepositoryFunction.java
index eb77b57211..db79483635 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/repository/NewLocalRepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/NewLocalRepositoryFunction.java
@@ -27,7 +27,6 @@ import com.google.devtools.build.skyframe.SkyFunction.Environment;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
/**
@@ -43,7 +42,7 @@ public class NewLocalRepositoryFunction extends RepositoryFunction {
@Override
public SkyValue fetch(
Rule rule, Path outputDirectory, BlazeDirectories directories, Environment env)
- throws SkyFunctionException {
+ throws SkyFunctionException, InterruptedException {
NewRepositoryBuildFileHandler buildFileHandler =
new NewRepositoryBuildFileHandler(directories.getWorkspace());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/NewRepositoryBuildFileHandler.java b/src/main/java/com/google/devtools/build/lib/rules/repository/NewRepositoryBuildFileHandler.java
index 456d80842f..18654e1da1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/repository/NewRepositoryBuildFileHandler.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/NewRepositoryBuildFileHandler.java
@@ -32,7 +32,6 @@ import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
-
import java.io.IOException;
/**
@@ -59,7 +58,7 @@ public class NewRepositoryBuildFileHandler {
* retrieved, written, or symlinked.
*/
public boolean prepareBuildFile(Rule rule, Environment env)
- throws RepositoryFunctionException {
+ throws RepositoryFunctionException, InterruptedException {
AggregatingAttributeMapper mapper = AggregatingAttributeMapper.of(rule);
boolean hasBuildFile = mapper.isAttributeValueExplicitlySpecified("build_file");
@@ -115,7 +114,7 @@ public class NewRepositoryBuildFileHandler {
}
private FileValue getBuildFileValue(Rule rule, Environment env)
- throws RepositoryFunctionException {
+ throws RepositoryFunctionException, InterruptedException {
AggregatingAttributeMapper mapper = AggregatingAttributeMapper.of(rule);
String buildFileAttribute = mapper.get("build_file", Type.STRING);
RootedPath rootedBuild;
@@ -200,4 +199,4 @@ public class NewRepositoryBuildFileHandler {
Path buildFilePath = outputDirectory.getRelative("BUILD");
RepositoryFunction.createSymbolicLink(buildFilePath, buildFileValue.realRootedPath().asPath());
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryFunction.java
index 98e4ad9e71..cb01f3120c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryFunction.java
@@ -132,21 +132,22 @@ public abstract class RepositoryFunction {
*
* <p>The {@code env} argument can be used to fetch Skyframe dependencies the repository
* implementation needs on the following conditions:
+ *
* <ul>
- * <li>When a Skyframe value is missing, fetching must be restarted, thus, in order to avoid
- * doing duplicate work, it's better to first request the Skyframe dependencies you need and
- * only then start doing anything costly.
- * <li>The output directory must be populated from within this method (and not from within
- * another SkyFunction). This is because if it was populated in another SkyFunction, the
- * repository function would be restarted <b>after</b> that SkyFunction has been run, and
- * it would wipe the output directory clean.
+ * <li>When a Skyframe value is missing, fetching must be restarted, thus, in order to avoid doing
+ * duplicate work, it's better to first request the Skyframe dependencies you need and only
+ * then start doing anything costly.
+ * <li>The output directory must be populated from within this method (and not from within another
+ * SkyFunction). This is because if it was populated in another SkyFunction, the repository
+ * function would be restarted <b>after</b> that SkyFunction has been run, and it would wipe
+ * the output directory clean.
* </ul>
*/
@ThreadSafe
@Nullable
public abstract SkyValue fetch(
Rule rule, Path outputDirectory, BlazeDirectories directories, Environment env)
- throws SkyFunctionException, InterruptedException;
+ throws SkyFunctionException, InterruptedException;
/**
* Whether fetching is done using local operations only.
@@ -164,7 +165,7 @@ public abstract class RepositoryFunction {
* to keep it working somehow)
*/
protected byte[] getRuleSpecificMarkerData(Rule rule, Environment env)
- throws RepositoryFunctionException {
+ throws RepositoryFunctionException, InterruptedException {
return new byte[] {};
}
@@ -265,7 +266,7 @@ public abstract class RepositoryFunction {
*/
@Nullable
public static Rule getRule(String repository, Environment env)
- throws RepositoryFunctionException {
+ throws RepositoryFunctionException, InterruptedException {
SkyKey packageLookupKey = PackageLookupValue.key(Label.EXTERNAL_PACKAGE_IDENTIFIER);
PackageLookupValue packageLookupValue = (PackageLookupValue) env.getValue(packageLookupKey);
@@ -298,9 +299,8 @@ public abstract class RepositoryFunction {
}
@Nullable
- public static Rule getRule(
- String ruleName, @Nullable String ruleClassName, Environment env)
- throws RepositoryFunctionException {
+ public static Rule getRule(String ruleName, @Nullable String ruleClassName, Environment env)
+ throws RepositoryFunctionException, InterruptedException {
try {
return getRule(RepositoryName.create("@" + ruleName), ruleClassName, env);
} catch (LabelSyntaxException e) {
@@ -310,15 +310,15 @@ public abstract class RepositoryFunction {
}
/**
- * Uses a remote repository name to fetch the corresponding Rule describing how to get it.
- * This should be called from {@link SkyFunction#compute} functions, which should return null if
- * this returns null. If {@code ruleClassName} is set, the rule found must have a matching rule
- * class name.
+ * Uses a remote repository name to fetch the corresponding Rule describing how to get it. This
+ * should be called from {@link SkyFunction#compute} functions, which should return null if this
+ * returns null. If {@code ruleClassName} is set, the rule found must have a matching rule class
+ * name.
*/
@Nullable
public static Rule getRule(
RepositoryName repositoryName, @Nullable String ruleClassName, Environment env)
- throws RepositoryFunctionException {
+ throws RepositoryFunctionException, InterruptedException {
Rule rule = getRule(repositoryName.strippedName(), env);
Preconditions.checkState(
rule == null || ruleClassName == null || rule.getRuleClass().equals(ruleClassName),
@@ -327,12 +327,12 @@ public abstract class RepositoryFunction {
}
/**
- * Adds the repository's directory to the graph and, if it's a symlink, resolves it to an
- * actual directory.
+ * Adds the repository's directory to the graph and, if it's a symlink, resolves it to an actual
+ * directory.
*/
@Nullable
- public static FileValue getRepositoryDirectory(Path repositoryDirectory, Environment env)
- throws RepositoryFunctionException {
+ protected static FileValue getRepositoryDirectory(Path repositoryDirectory, Environment env)
+ throws RepositoryFunctionException, InterruptedException {
SkyKey outputDirectoryKey = FileValue.key(RootedPath.toRootedPath(
repositoryDirectory, PathFragment.EMPTY_FRAGMENT));
FileValue value;
@@ -354,21 +354,19 @@ public abstract class RepositoryFunction {
}
/**
- * For files that are under $OUTPUT_BASE/external, add a dependency on the corresponding rule
- * so that if the WORKSPACE file changes, the File/DirectoryStateValue will be re-evaluated.
+ * For files that are under $OUTPUT_BASE/external, add a dependency on the corresponding rule so
+ * that if the WORKSPACE file changes, the File/DirectoryStateValue will be re-evaluated.
*
- * Note that:
- * - We don't add a dependency on the parent directory at the package root boundary, so
- * the only transitive dependencies from files inside the package roots to external files
- * are through symlinks. So the upwards transitive closure of external files is small.
- * - The only way other than external repositories for external source files to get into the
- * skyframe graph in the first place is through symlinks outside the package roots, which we
- * neither want to encourage nor optimize for since it is not common. So the set of external
- * files is small.
+ * <p>Note that: - We don't add a dependency on the parent directory at the package root boundary,
+ * so the only transitive dependencies from files inside the package roots to external files are
+ * through symlinks. So the upwards transitive closure of external files is small. - The only way
+ * other than external repositories for external source files to get into the skyframe graph in
+ * the first place is through symlinks outside the package roots, which we neither want to
+ * encourage nor optimize for since it is not common. So the set of external files is small.
*/
public static void addExternalFilesDependencies(
RootedPath rootedPath, BlazeDirectories directories, Environment env)
- throws IOException {
+ throws IOException, InterruptedException {
Path externalRepoDir = getExternalRepositoryDirectory(directories);
PathFragment repositoryPath = rootedPath.asPath().relativeTo(externalRepoDir);
if (repositoryPath.segmentCount() == 0) {
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java
index 7ba1e2daaf..3f0dc5ceae 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java
@@ -34,7 +34,6 @@ import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
import com.google.devtools.common.options.OptionsProvider;
-
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -188,6 +187,8 @@ public class InfoCommand implements BlazeCommand {
return e.getExitCode();
} catch (IOException e) {
return ExitCode.LOCAL_ENVIRONMENTAL_ERROR;
+ } catch (InterruptedException e) {
+ return ExitCode.INTERRUPTED;
}
return ExitCode.SUCCESS;
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java
index 4677b4a509..52c9991369 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java
@@ -94,10 +94,12 @@ public abstract class InfoItem {
/**
* Returns the value of the info key. The return value is directly printed to stdout.
+ *
* @param env TODO(lpino):
*/
- public abstract byte[] get(Supplier<BuildConfiguration> configurationSupplier,
- CommandEnvironment env) throws AbruptExitException;
+ public abstract byte[] get(
+ Supplier<BuildConfiguration> configurationSupplier, CommandEnvironment env)
+ throws AbruptExitException, InterruptedException;
private static byte[] print(Object value) {
if (value instanceof byte[]) {
@@ -626,4 +628,4 @@ public abstract class InfoItem {
return print(description);
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
index 8ec6f0ee02..19fb401ec0 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
@@ -196,11 +196,12 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
* the action cache's view of this action contains additional inputs, it will request metadata for
* them, so we consider those inputs as dependencies of this action as well. Returns null if some
* dependencies were missing and this ActionExecutionFunction needs to restart.
+ *
* @throws ActionExecutionFunctionException
*/
@Nullable
private AllInputs collectInputs(Action action, Environment env)
- throws ActionExecutionFunctionException {
+ throws ActionExecutionFunctionException, InterruptedException {
Iterable<Artifact> allKnownInputs = Iterables.concat(
action.getInputs(), action.getRunfilesSupplier().getArtifacts());
if (action.inputsKnown()) {
@@ -264,7 +265,7 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
@Override
public Map<PathFragment, Root> findPackageRootsForFiles(Iterable<PathFragment> execPaths)
- throws PackageRootResolutionException {
+ throws PackageRootResolutionException, InterruptedException {
Preconditions.checkState(keysRequested.isEmpty(),
"resolver should only be called once: %s %s", keysRequested, execPaths);
// Create SkyKeys list based on execPaths.
@@ -316,7 +317,7 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
@Override
@Nullable
public Map<PathFragment, Root> findPackageRoots(Iterable<PathFragment> execPaths)
- throws PackageRootResolutionException {
+ throws PackageRootResolutionException, InterruptedException {
// call sites for this implementation of PackageRootResolver shouldn't be passing in
// directories.
return findPackageRootsForFiles(execPaths);
@@ -454,8 +455,10 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
}
private static void addDiscoveredInputs(
- Map<Artifact, FileArtifactValue> inputData, Iterable<Artifact> discoveredInputs,
- Environment env) {
+ Map<Artifact, FileArtifactValue> inputData,
+ Iterable<Artifact> discoveredInputs,
+ Environment env)
+ throws InterruptedException {
Set<SkyKey> keys = new HashSet<>();
for (Artifact artifact : discoveredInputs) {
if (!inputData.containsKey(artifact)) {
@@ -479,8 +482,8 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
}
}
- private void establishSkyframeDependencies(Environment env, Action action)
- throws ActionExecutionException {
+ private static void establishSkyframeDependencies(Environment env, Action action)
+ throws ActionExecutionException, InterruptedException {
// Before we may safely establish Skyframe dependencies, we must build all action inputs by
// requesting their ArtifactValues.
// This is very important to do, because the establishSkyframeDependencies method may request
@@ -619,12 +622,12 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
}
/**
- * Declares skyframe dependencies for any {@code action}'s inputs that are not already in
- * {@code knownInputs}. Returns the result of {@code env.getValues(...)} for these inputs,
- * which should contain {@link Artifact} keys and {@link FileArtifactValue} or null values.
+ * Declares skyframe dependencies for any {@code action}'s inputs that are not already in {@code
+ * knownInputs}. Returns the result of {@code env.getValues(...)} for these inputs, which should
+ * contain {@link Artifact} keys and {@link FileArtifactValue} or null values.
*/
- private static Map<SkyKey, SkyValue> declareAdditionalDependencies(Environment env,
- Action action, Set<Artifact> knownInputs) {
+ private static Map<SkyKey, SkyValue> declareAdditionalDependencies(
+ Environment env, Action action, Set<Artifact> knownInputs) throws InterruptedException {
Preconditions.checkState(action.discoversInputs(), action);
Iterable<Artifact> newArtifacts =
Iterables.filter(action.getInputs(), Predicates.not(Predicates.in(knownInputs)));
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunction.java
index 59572f1b9a..6a18db78dd 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunction.java
@@ -38,7 +38,7 @@ public class ActionTemplateExpansionFunction implements SkyFunction {
@Override
public SkyValue compute(SkyKey skyKey, Environment env)
- throws ActionTemplateExpansionFunctionException {
+ throws ActionTemplateExpansionFunctionException, InterruptedException {
ActionTemplateExpansionKey key = (ActionTemplateExpansionKey) skyKey.argument();
SpawnActionTemplate actionTemplate = key.getActionTemplate();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
index f7007b7d59..cecc089d5b 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
@@ -54,7 +54,8 @@ class ArtifactFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws ArtifactFunctionException {
+ public SkyValue compute(SkyKey skyKey, Environment env)
+ throws ArtifactFunctionException, InterruptedException {
OwnedArtifact ownedArtifact = (OwnedArtifact) skyKey.argument();
Artifact artifact = ownedArtifact.getArtifact();
if (artifact.isSourceArtifact()) {
@@ -116,9 +117,9 @@ class ArtifactFunction implements SkyFunction {
}
}
- private TreeArtifactValue createTreeArtifactValueFromActionTemplate(
+ private static TreeArtifactValue createTreeArtifactValueFromActionTemplate(
SpawnActionTemplate actionTemplate, Artifact treeArtifact, Environment env)
- throws ArtifactFunctionException {
+ throws ArtifactFunctionException, InterruptedException {
// Request the list of expanded actions from the ActionTemplate.
ActionTemplateExpansionValue expansionValue = (ActionTemplateExpansionValue) env.getValue(
ActionTemplateExpansionValue.key(actionTemplate));
@@ -167,7 +168,7 @@ class ArtifactFunction implements SkyFunction {
}
private FileArtifactValue createSourceValue(Artifact artifact, boolean mandatory, Environment env)
- throws MissingInputFileException {
+ throws MissingInputFileException, InterruptedException {
SkyKey fileSkyKey = FileValue.key(RootedPath.toRootedPath(artifact.getRoot().getPath(),
artifact.getPath()));
FileValue fileValue;
@@ -253,7 +254,8 @@ class ArtifactFunction implements SkyFunction {
Artifact artifact,
ActionAnalysisMetadata action,
FileArtifactValue value,
- SkyFunction.Environment env) {
+ SkyFunction.Environment env)
+ throws InterruptedException {
// This artifact aggregates other artifacts. Keep track of them so callers can find them.
ImmutableList.Builder<Pair<Artifact, FileArtifactValue>> inputs = ImmutableList.builder();
for (Map.Entry<SkyKey, SkyValue> entry :
@@ -286,8 +288,8 @@ class ArtifactFunction implements SkyFunction {
return Label.print(((OwnedArtifact) skyKey.argument()).getArtifact().getOwner());
}
- private ActionAnalysisMetadata extractActionFromArtifact(
- Artifact artifact, SkyFunction.Environment env) {
+ private static ActionAnalysisMetadata extractActionFromArtifact(
+ Artifact artifact, SkyFunction.Environment env) throws InterruptedException {
ArtifactOwner artifactOwner = artifact.getArtifactOwner();
Preconditions.checkState(artifactOwner instanceof ActionLookupKey, "", artifact, artifactOwner);
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 c1f8c335ec..d94be28632 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
@@ -57,7 +57,6 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import javax.annotation.Nullable;
/**
@@ -93,9 +92,9 @@ public final class AspectFunction implements SkyFunction {
* @return {@code null} if dependencies cannot be satisfied.
*/
@Nullable
- public static SkylarkAspect loadSkylarkAspect(
+ static SkylarkAspect loadSkylarkAspect(
Environment env, Label extensionLabel, String skylarkValueName)
- throws AspectCreationException {
+ throws AspectCreationException, InterruptedException {
SkyKey importFileKey = SkylarkImportLookupValue.key(extensionLabel, false);
try {
SkylarkImportLookupValue skylarkImportLookupValue =
@@ -275,8 +274,13 @@ public final class AspectFunction implements SkyFunction {
}
}
- private SkyValue createAliasAspect(Environment env, Target originalTarget, Label aliasLabel,
- Aspect aspect, AspectKey originalKey) {
+ private static SkyValue createAliasAspect(
+ Environment env,
+ Target originalTarget,
+ Label aliasLabel,
+ Aspect aspect,
+ AspectKey originalKey)
+ throws InterruptedException {
SkyKey depKey = AspectValue.key(aliasLabel,
originalKey.getAspectConfiguration(),
originalKey.getBaseConfiguration(),
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationFunction.java
index a25c3ac201..3f18f8502b 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationFunction.java
@@ -29,7 +29,6 @@ import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.ValueOrException;
-
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
@@ -52,7 +51,8 @@ public class BuildConfigurationFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException {
+ public SkyValue compute(SkyKey skyKey, Environment env)
+ throws InterruptedException, BuildConfigurationFunctionException {
BuildConfigurationValue.Key key = (BuildConfigurationValue.Key) skyKey.argument();
Set<Fragment> fragments;
try {
@@ -83,7 +83,7 @@ public class BuildConfigurationFunction implements SkyFunction {
}
private Set<Fragment> getConfigurationFragments(BuildConfigurationValue.Key key, Environment env)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
// Get SkyKeys for the fragments we need to load.
Set<SkyKey> fragmentKeys = new LinkedHashSet<>();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java
index 5edaf985e4..7361c1f564 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java
@@ -26,7 +26,6 @@ import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.Map;
/**
@@ -46,7 +45,7 @@ public class BuildInfoCollectionFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
final BuildInfoKeyAndConfig keyAndConfig = (BuildInfoKeyAndConfig) skyKey.argument();
WorkspaceStatusValue infoArtifactValue =
(WorkspaceStatusValue) env.getValue(WorkspaceStatusValue.SKY_KEY);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/CollectPackagesUnderDirectoryFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/CollectPackagesUnderDirectoryFunction.java
index 21d4eb2336..cef2a10779 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/CollectPackagesUnderDirectoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/CollectPackagesUnderDirectoryFunction.java
@@ -25,9 +25,7 @@ import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -44,7 +42,7 @@ public class CollectPackagesUnderDirectoryFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
return new MyTraversalFunction().visitDirectory((RecursivePkgKey) skyKey.argument(), env);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
index db9ab97534..6a3e6e45b7 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
@@ -46,15 +46,11 @@ import javax.annotation.Nullable;
public final class CompletionFunction<TValue extends SkyValue, TResult extends SkyValue>
implements SkyFunction {
- /**
- * A strategy for completing the build.
- */
- public interface Completor<TValue, TResult extends SkyValue> {
+ /** A strategy for completing the build. */
+ interface Completor<TValue, TResult extends SkyValue> {
- /**
- * Obtains an analysis result value from environment.
- */
- TValue getValueFromSkyKey(SkyKey skyKey, Environment env);
+ /** Obtains an analysis result value from environment. */
+ TValue getValueFromSkyKey(SkyKey skyKey, Environment env) throws InterruptedException;
/**
* Returns the options which determine the artifacts to build for the top-level targets.
@@ -104,7 +100,8 @@ public final class CompletionFunction<TValue extends SkyValue, TResult extends S
private static class TargetCompletor
implements Completor<ConfiguredTargetValue, TargetCompletionValue> {
@Override
- public ConfiguredTargetValue getValueFromSkyKey(SkyKey skyKey, Environment env) {
+ public ConfiguredTargetValue getValueFromSkyKey(SkyKey skyKey, Environment env)
+ throws InterruptedException {
TargetCompletionKey tcKey = (TargetCompletionKey) skyKey.argument();
LabelAndConfiguration lac = tcKey.labelAndConfiguration();
return (ConfiguredTargetValue)
@@ -162,7 +159,8 @@ public final class CompletionFunction<TValue extends SkyValue, TResult extends S
private static class AspectCompletor implements Completor<AspectValue, AspectCompletionValue> {
@Override
- public AspectValue getValueFromSkyKey(SkyKey skyKey, Environment env) {
+ public AspectValue getValueFromSkyKey(SkyKey skyKey, Environment env)
+ throws InterruptedException {
AspectCompletionKey acKey = (AspectCompletionKey) skyKey.argument();
AspectKey aspectKey = acKey.aspectKey();
return (AspectValue) env.getValue(AspectValue.key(aspectKey));
@@ -237,7 +235,8 @@ public final class CompletionFunction<TValue extends SkyValue, TResult extends S
@Nullable
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws CompletionFunctionException {
+ public SkyValue compute(SkyKey skyKey, Environment env)
+ throws CompletionFunctionException, InterruptedException {
TValue value = completor.getValueFromSkyKey(skyKey, env);
TopLevelArtifactContext topLevelContext = completor.getTopLevelArtifactContext(skyKey);
if (env.valuesMissing()) {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationCollectionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationCollectionFunction.java
index d50e2a65d1..e73b2b4cd5 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationCollectionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationCollectionFunction.java
@@ -33,10 +33,8 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.ArrayList;
import java.util.List;
-
import javax.annotation.Nullable;
/**
@@ -75,10 +73,12 @@ public class ConfigurationCollectionFunction implements SkyFunction {
}
/** Create the build configurations with the given options. */
- private BuildConfigurationCollection getConfigurations(Environment env,
- PackageProviderForConfigurations loadedPackageProvider, BuildOptions buildOptions,
+ private BuildConfigurationCollection getConfigurations(
+ Environment env,
+ PackageProviderForConfigurations loadedPackageProvider,
+ BuildOptions buildOptions,
ImmutableSet<String> multiCpu)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
// We cache all the related configurations for this target configuration in a cache that is
// dropped at the end of this method call. We instead rely on the cache for entire collections
// for caching the target and related configurations, and on a dedicated host configuration
@@ -115,11 +115,10 @@ public class ConfigurationCollectionFunction implements SkyFunction {
return new BuildConfigurationCollection(targetConfigurations, hostConfiguration);
}
- /**
- * Returns the host configuration, or null on missing Skyframe deps.
- */
- private BuildConfiguration getHostConfiguration(Environment env,
- BuildConfiguration targetConfiguration) throws InvalidConfigurationException {
+ /** Returns the host configuration, or null on missing Skyframe deps. */
+ private static BuildConfiguration getHostConfiguration(
+ Environment env, BuildConfiguration targetConfiguration)
+ throws InvalidConfigurationException, InterruptedException {
if (targetConfiguration.useDynamicConfigurations()) {
BuildOptions hostOptions = HostTransition.INSTANCE.apply(targetConfiguration.getOptions());
SkyKey hostConfigKey =
@@ -149,7 +148,9 @@ public class ConfigurationCollectionFunction implements SkyFunction {
Cache<String, BuildConfiguration> cache,
EventHandler originalEventListener,
PackageProviderForConfigurations loadedPackageProvider,
- BuildOptions buildOptions, String cpuOverride) throws InvalidConfigurationException {
+ BuildOptions buildOptions,
+ String cpuOverride)
+ throws InvalidConfigurationException, InterruptedException {
ErrorSensingEventHandler eventHandler = new ErrorSensingEventHandler(originalEventListener);
if (cpuOverride != null) {
// TODO(bazel-team): Options classes should be immutable. This is a bit of a hack.
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java
index f2a12e7b34..62bee585b6 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java
@@ -43,7 +43,6 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -100,8 +99,11 @@ public final class ConfigurationFragmentFunction implements SkyFunction {
* those returned from {@link BuildOptions#getAllLabels()}, and the implicit ones are those that
* are returned from {@link Fragment#getImplicitLabels}.
*/
- private void sanityCheck(Fragment fragment, BuildOptions buildOptions,
- PackageProviderForConfigurations packageProvider) throws InvalidConfigurationException {
+ private static void sanityCheck(
+ Fragment fragment,
+ BuildOptions buildOptions,
+ PackageProviderForConfigurations packageProvider)
+ throws InvalidConfigurationException, InterruptedException {
if (fragment == null) {
return;
}
@@ -134,8 +136,9 @@ public final class ConfigurationFragmentFunction implements SkyFunction {
}
}
- private void collectAllTransitiveLabels(PackageProviderForConfigurations packageProvider,
- Set<Label> reachableLabels, Label from) throws NoSuchThingException {
+ private static void collectAllTransitiveLabels(
+ PackageProviderForConfigurations packageProvider, Set<Label> reachableLabels, Label from)
+ throws NoSuchThingException, InterruptedException {
if (!reachableLabels.add(from)) {
return;
}
@@ -189,12 +192,13 @@ public final class ConfigurationFragmentFunction implements SkyFunction {
}
@Override
- public Target getTarget(Label label) throws NoSuchPackageException, NoSuchTargetException {
+ public Target getTarget(Label label)
+ throws NoSuchPackageException, NoSuchTargetException, InterruptedException {
return packageProvider.getTarget(label);
}
@Override
- public Path getPath(Package pkg, String fileName) {
+ public Path getPath(Package pkg, String fileName) throws InterruptedException {
Path result = pkg.getPackageDirectory().getRelative(fileName);
try {
packageProvider.addDependency(pkg, fileName);
@@ -205,13 +209,13 @@ public final class ConfigurationFragmentFunction implements SkyFunction {
}
@Override
- public <T extends Fragment> T getFragment(BuildOptions buildOptions, Class<T> fragmentType)
- throws InvalidConfigurationException {
+ public <T extends Fragment> T getFragment(BuildOptions buildOptions, Class<T> fragmentType)
+ throws InvalidConfigurationException, InterruptedException {
return packageProvider.getFragment(buildOptions, fragmentType);
}
@Override
- public BlazeDirectories getBlazeDirectories() {
+ public BlazeDirectories getBlazeDirectories() throws InterruptedException {
return packageProvider.getDirectories();
}
}
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 9a82ef4d98..0bd188a4f0 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
@@ -75,7 +75,6 @@ import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.ValueOrException;
import com.google.devtools.build.skyframe.ValueOrException2;
-
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -84,7 +83,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -416,15 +414,18 @@ final class ConfiguredTargetFunction implements SkyFunction {
* transitive closure.
*
* <p>This method is heavily performance-optimized. Because it, in aggregate, reads over every
- * edge in the configured target graph, small inefficiencies can have observable impact on
- * build analysis time. Keep this in mind when making modifications and performance-test any
- * changes you make.
+ * edge in the configured target graph, small inefficiencies can have observable impact on build
+ * analysis time. Keep this in mind when making modifications and performance-test any changes you
+ * make.
*/
@Nullable
- static OrderedSetMultimap<Attribute, Dependency> trimConfigurations(Environment env,
- TargetAndConfiguration ctgValue, OrderedSetMultimap<Attribute, Dependency> originalDeps,
- BuildConfiguration hostConfiguration, RuleClassProvider ruleClassProvider)
- throws DependencyEvaluationException {
+ static OrderedSetMultimap<Attribute, Dependency> trimConfigurations(
+ Environment env,
+ TargetAndConfiguration ctgValue,
+ OrderedSetMultimap<Attribute, Dependency> originalDeps,
+ BuildConfiguration hostConfiguration,
+ RuleClassProvider ruleClassProvider)
+ throws DependencyEvaluationException, InterruptedException {
// Maps each Skyframe-evaluated BuildConfiguration to the dependencies that need that
// configuration. For cases where Skyframe isn't needed to get the configuration (e.g. when
@@ -684,7 +685,7 @@ final class ConfiguredTargetFunction implements SkyFunction {
Map<SkyKey, ConfiguredTarget> configuredTargetMap,
Iterable<Dependency> deps,
NestedSetBuilder<Package> transitivePackages)
- throws AspectCreationException {
+ throws AspectCreationException, InterruptedException {
OrderedSetMultimap<SkyKey, ConfiguredAspect> result = OrderedSetMultimap.create();
Set<SkyKey> aspectKeys = new HashSet<>();
for (Dependency dep : deps) {
@@ -766,18 +767,21 @@ final class ConfiguredTargetFunction implements SkyFunction {
}
/**
- * Returns the set of {@link ConfigMatchingProvider}s that key the configurable attributes
- * used by this rule.
+ * Returns the set of {@link ConfigMatchingProvider}s that key the configurable attributes used by
+ * this rule.
*
- * <p>>If the configured targets supplying those providers aren't yet resolved by the
- * dependency resolver, returns null.
+ * <p>>If the configured targets supplying those providers aren't yet resolved by the dependency
+ * resolver, returns null.
*/
@Nullable
- static ImmutableMap<Label, ConfigMatchingProvider> getConfigConditions(Target target,
- Environment env, SkyframeDependencyResolver resolver, TargetAndConfiguration ctgValue,
+ static ImmutableMap<Label, ConfigMatchingProvider> getConfigConditions(
+ Target target,
+ Environment env,
+ SkyframeDependencyResolver resolver,
+ TargetAndConfiguration ctgValue,
NestedSetBuilder<Package> transitivePackages,
NestedSetBuilder<Label> transitiveLoadingRootCauses)
- throws DependencyEvaluationException {
+ throws DependencyEvaluationException, InterruptedException {
if (!(target instanceof Rule)) {
return NO_CONFIG_CONDITIONS;
}
@@ -847,15 +851,19 @@ final class ConfiguredTargetFunction implements SkyFunction {
return ImmutableMap.copyOf(configConditions);
}
- /***
- * Resolves the targets referenced in depValueNames and returns their ConfiguredTarget instances.
+ /**
+ * * Resolves the targets referenced in depValueNames and returns their ConfiguredTarget
+ * instances.
*
* <p>Returns null if not all instances are available yet.
*/
@Nullable
private static Map<SkyKey, ConfiguredTarget> resolveConfiguredTargetDependencies(
- Environment env, Collection<Dependency> deps, NestedSetBuilder<Package> transitivePackages,
- NestedSetBuilder<Label> transitiveLoadingRootCauses) throws DependencyEvaluationException {
+ Environment env,
+ Collection<Dependency> deps,
+ NestedSetBuilder<Package> transitivePackages,
+ NestedSetBuilder<Label> transitiveLoadingRootCauses)
+ throws DependencyEvaluationException, InterruptedException {
boolean missedValues = env.valuesMissing();
boolean failed = false;
Iterable<SkyKey> depKeys = Iterables.transform(deps, TO_KEYS);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java
index 09debbff4a..68c9ff8353 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java
@@ -18,7 +18,6 @@ import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import javax.annotation.Nullable;
/**
@@ -27,7 +26,7 @@ import javax.annotation.Nullable;
public class ContainingPackageLookupFunction implements SkyFunction {
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
PackageIdentifier dir = (PackageIdentifier) skyKey.argument();
PackageLookupValue pkgLookupValue =
(PackageLookupValue) env.getValue(PackageLookupValue.key(dir));
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java
index 53d7a86102..70de5cc212 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java
@@ -30,7 +30,7 @@ public class CoverageReportFunction implements SkyFunction {
CoverageReportFunction() {}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
Preconditions.checkState(
CoverageReportValue.SKY_KEY.equals(skyKey), String.format(
"Expected %s for SkyKey but got %s instead", CoverageReportValue.SKY_KEY, skyKey));
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingFunction.java
index 3c1401c1d5..97ee8b78bc 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingFunction.java
@@ -18,7 +18,6 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import javax.annotation.Nullable;
/**
@@ -28,7 +27,7 @@ public final class DirectoryListingFunction implements SkyFunction {
@Override
public SkyValue compute(SkyKey skyKey, Environment env)
- throws DirectoryListingFunctionException {
+ throws DirectoryListingFunctionException, InterruptedException {
RootedPath dirRootedPath = (RootedPath) skyKey.argument();
FileValue dirFileValue = (FileValue) env.getValue(FileValue.key(dirRootedPath));
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java
index 0bb5249fcb..aa1fe760e2 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java
@@ -18,7 +18,6 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
/**
@@ -37,7 +36,7 @@ public class DirectoryListingStateFunction implements SkyFunction {
@Override
public SkyValue compute(SkyKey skyKey, Environment env)
- throws DirectoryListingStateFunctionException {
+ throws DirectoryListingStateFunctionException, InterruptedException {
RootedPath dirRootedPath = (RootedPath) skyKey.argument();
try {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java b/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java
index 92888d2427..96a65b59c3 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java
@@ -36,7 +36,6 @@ import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
import com.google.devtools.build.skyframe.SkyKey;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -56,7 +55,7 @@ public final class EnvironmentBackedRecursivePackageProvider implements Recursiv
@Override
public Package getPackage(EventHandler eventHandler, PackageIdentifier packageName)
- throws NoSuchPackageException, MissingDepException {
+ throws NoSuchPackageException, MissingDepException, InterruptedException {
SkyKey pkgKey = PackageValue.key(packageName);
PackageValue pkgValue =
(PackageValue) env.getValueOrThrow(pkgKey, NoSuchPackageException.class);
@@ -93,7 +92,7 @@ public final class EnvironmentBackedRecursivePackageProvider implements Recursiv
@Override
public boolean isPackage(EventHandler eventHandler, PackageIdentifier packageId)
- throws MissingDepException {
+ throws MissingDepException, InterruptedException {
SkyKey packageLookupKey = PackageLookupValue.key(packageId);
try {
PackageLookupValue packageLookupValue =
@@ -111,9 +110,10 @@ public final class EnvironmentBackedRecursivePackageProvider implements Recursiv
@Override
public Iterable<PathFragment> getPackagesUnderDirectory(
- RepositoryName repository, PathFragment directory,
+ RepositoryName repository,
+ PathFragment directory,
ImmutableSet<PathFragment> excludedSubdirectories)
- throws MissingDepException {
+ throws MissingDepException, InterruptedException {
PathPackageLocator packageLocator = PrecomputedValue.PATH_PACKAGE_LOCATOR.get(env);
if (packageLocator == null) {
throw new MissingDepException();
@@ -156,8 +156,9 @@ public final class EnvironmentBackedRecursivePackageProvider implements Recursiv
}
@Override
- public Target getTarget(EventHandler eventHandler, Label label) throws NoSuchPackageException,
- NoSuchTargetException, MissingDepException {
+ public Target getTarget(EventHandler eventHandler, Label label)
+ throws NoSuchPackageException, NoSuchTargetException, MissingDepException,
+ InterruptedException {
return getPackage(eventHandler, label.getPackageIdentifier()).getTarget(label.getName());
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
index 792cc5fa13..b1b6259e90 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
@@ -23,7 +23,6 @@ import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction;
-
import java.io.IOException;
import java.util.concurrent.atomic.AtomicReference;
@@ -82,12 +81,12 @@ public class ExternalFilesHelper {
* external repository). Such files are theoretically mutable, but certain Blaze flags may tell
* Blaze to assume these files are immutable.
*
- * Note that {@link ExternalFilesHelper#maybeHandleExternalFile} is only used for
- * {@link FileStateValue} and {@link DirectoryStateValue}, and also note that output files do
- * not normally have corresponding {@link FileValue} instances (and thus also
- * {@link FileStateValue} instances) in the Skyframe graph ({@link ArtifactFunction} only uses
- * {@link FileValue}s for source files). But {@link FileStateValue}s for output files can still
- * make their way into the Skyframe graph if e.g. a source file is a symlink to an output file.
+ * <p>Note that {@link ExternalFilesHelper#maybeHandleExternalFile} is only used for {@link
+ * FileStateValue} and {@link DirectoryListingStateValue}, and also note that output files do
+ * not normally have corresponding {@link FileValue} instances (and thus also {@link
+ * FileStateValue} instances) in the Skyframe graph ({@link ArtifactFunction} only uses {@link
+ * FileValue}s for source files). But {@link FileStateValue}s for output files can still make
+ * their way into the Skyframe graph if e.g. a source file is a symlink to an output file.
*/
// TODO(nharmata): Consider an alternative design where we have an OutputFileDiffAwareness. This
// could work but would first require that we clean up all RootedPath usage.
@@ -157,8 +156,8 @@ public class ExternalFilesHelper {
* ERROR_OUT, it will throw an error instead.
*/
@ThreadSafe
- public void maybeHandleExternalFile(RootedPath rootedPath, SkyFunction.Environment env)
- throws IOException {
+ void maybeHandleExternalFile(RootedPath rootedPath, SkyFunction.Environment env)
+ throws IOException, InterruptedException {
FileType fileType = getAndNoteFileType(rootedPath);
if (fileType == FileType.INTERNAL) {
return;
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalPackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalPackageFunction.java
index 2e5cf268c1..8a7bdd92d9 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalPackageFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalPackageFunction.java
@@ -18,7 +18,6 @@ import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import javax.annotation.Nullable;
/**
@@ -31,7 +30,7 @@ public class ExternalPackageFunction implements SkyFunction {
@Nullable
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
RootedPath workspacePath = (RootedPath) skyKey.argument();
SkyKey key = WorkspaceFileValue.key(workspacePath);
WorkspaceFileValue value = (WorkspaceFileValue) env.getValue(key);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java
index 6eb962114c..8404f53aa7 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java
@@ -28,12 +28,10 @@ import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicReference;
-
import javax.annotation.Nullable;
/**
@@ -51,7 +49,8 @@ public class FileFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws FileFunctionException {
+ public SkyValue compute(SkyKey skyKey, Environment env)
+ throws FileFunctionException, InterruptedException {
RootedPath rootedPath = (RootedPath) skyKey.argument();
RootedPath realRootedPath = null;
FileStateValue realFileStateValue = null;
@@ -132,9 +131,9 @@ public class FileFunction implements SkyFunction {
* {@code null} if there was a missing dep.
*/
@Nullable
- private Pair<RootedPath, FileStateValue> resolveFromAncestors(
+ private static Pair<RootedPath, FileStateValue> resolveFromAncestors(
RootedPath rootedPath, Environment env)
- throws FileFunctionException, FileOutsidePackageRootsException {
+ throws FileFunctionException, FileOutsidePackageRootsException, InterruptedException {
PathFragment relativePath = rootedPath.getRelativePath();
RootedPath realRootedPath = rootedPath;
FileValue parentFileValue = null;
@@ -180,14 +179,17 @@ public class FileFunction implements SkyFunction {
}
/**
- * Returns the symlink target and file state of {@code rootedPath}'s symlink to
- * {@code symlinkTarget}, accounting for ancestor symlinks, or {@code null} if there was a
- * missing dep.
+ * Returns the symlink target and file state of {@code rootedPath}'s symlink to {@code
+ * symlinkTarget}, accounting for ancestor symlinks, or {@code null} if there was a missing dep.
*/
@Nullable
- private Pair<RootedPath, FileStateValue> getSymlinkTargetRootedPath(RootedPath rootedPath,
- PathFragment symlinkTarget, TreeSet<Path> orderedSeenPaths,
- Iterable<RootedPath> symlinkChain, Environment env) throws FileFunctionException {
+ private Pair<RootedPath, FileStateValue> getSymlinkTargetRootedPath(
+ RootedPath rootedPath,
+ PathFragment symlinkTarget,
+ TreeSet<Path> orderedSeenPaths,
+ Iterable<RootedPath> symlinkChain,
+ Environment env)
+ throws FileFunctionException, InterruptedException {
RootedPath symlinkTargetRootedPath;
if (symlinkTarget.isAbsolute()) {
Path path = rootedPath.asPath().getFileSystem().getRootDirectory().getRelative(
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FileStateFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/FileStateFunction.java
index d77f7e3fc3..f2dfff824c 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/FileStateFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/FileStateFunction.java
@@ -19,7 +19,6 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
import java.util.concurrent.atomic.AtomicReference;
@@ -41,7 +40,8 @@ public class FileStateFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws FileStateFunctionException {
+ public SkyValue compute(SkyKey skyKey, Environment env)
+ throws FileStateFunctionException, InterruptedException {
RootedPath rootedPath = (RootedPath) skyKey.argument();
try {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunction.java
index 777794654f..f95274c648 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunction.java
@@ -49,7 +49,8 @@ public final class FilesetEntryFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey key, Environment env) throws FilesetEntryFunctionException {
+ public SkyValue compute(SkyKey key, Environment env)
+ throws FilesetEntryFunctionException, InterruptedException {
FilesetTraversalParams t = (FilesetTraversalParams) key.argument();
Preconditions.checkState(
t.getNestedTraversal().isPresent() != t.getDirectTraversal().isPresent(),
@@ -226,8 +227,9 @@ public final class FilesetEntryFunction implements SkyFunction {
return null;
}
- private RecursiveFilesystemTraversalValue traverse(Environment env, String errorInfo,
- DirectTraversal traversal) throws MissingDepException {
+ private static RecursiveFilesystemTraversalValue traverse(
+ Environment env, String errorInfo, DirectTraversal traversal)
+ throws MissingDepException, InterruptedException {
SkyKey depKey = RecursiveFilesystemTraversalValue.key(
new RecursiveFilesystemTraversalValue.TraversalRequest(traversal.getRoot().asRootedPath(),
traversal.isGenerated(), traversal.getPackageBoundaryMode(), traversal.isPackage(),
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java b/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
index 6f78572939..4b9263e0e6 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
@@ -45,7 +45,6 @@ import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.WalkableGraph;
-
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
@@ -62,7 +61,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import javax.annotation.Nullable;
/**
@@ -123,9 +121,9 @@ public class FilesystemValueChecker {
dirtinessChecker, /*checkMissingValues=*/true);
}
- private static interface ValueFetcher {
+ private interface ValueFetcher {
@Nullable
- SkyValue get(SkyKey key);
+ SkyValue get(SkyKey key) throws InterruptedException;
}
private static class WalkableGraphBackedValueFetcher implements ValueFetcher {
@@ -137,7 +135,7 @@ public class FilesystemValueChecker {
@Override
@Nullable
- public SkyValue get(SkyKey key) {
+ public SkyValue get(SkyKey key) throws InterruptedException {
return walkableGraph.exists(key) ? walkableGraph.getValue(key) : null;
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java
index 06518314e8..ec3f7138bf 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java
@@ -31,10 +31,8 @@ import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.Map;
import java.util.regex.Pattern;
-
import javax.annotation.Nullable;
/**
@@ -54,7 +52,8 @@ public final class GlobFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws GlobFunctionException {
+ public SkyValue compute(SkyKey skyKey, Environment env)
+ throws GlobFunctionException, InterruptedException {
GlobDescriptor glob = (GlobDescriptor) skyKey.argument();
// Note that the glob's package is assumed to exist which implies that the package's BUILD file
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java b/src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java
index 26e5f1bbb3..5499189c9b 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java
@@ -47,7 +47,6 @@ import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.WalkableGraph;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -79,7 +78,7 @@ public final class GraphBackedRecursivePackageProvider implements RecursivePacka
@Override
public Package getPackage(EventHandler eventHandler, PackageIdentifier packageName)
- throws NoSuchPackageException {
+ throws NoSuchPackageException, InterruptedException {
SkyKey pkgKey = PackageValue.key(packageName);
PackageValue pkgValue;
@@ -98,8 +97,9 @@ public final class GraphBackedRecursivePackageProvider implements RecursivePacka
}
@Override
- public Map<PackageIdentifier, Package> bulkGetPackages(EventHandler eventHandler,
- Iterable<PackageIdentifier> pkgIds) throws NoSuchPackageException {
+ public Map<PackageIdentifier, Package> bulkGetPackages(
+ EventHandler eventHandler, Iterable<PackageIdentifier> pkgIds)
+ throws NoSuchPackageException, InterruptedException {
Set<SkyKey> pkgKeys = ImmutableSet.copyOf(PackageValue.keys(pkgIds));
ImmutableMap.Builder<PackageIdentifier, Package> pkgResults = ImmutableMap.builder();
@@ -133,7 +133,8 @@ public final class GraphBackedRecursivePackageProvider implements RecursivePacka
@Override
- public boolean isPackage(EventHandler eventHandler, PackageIdentifier packageName) {
+ public boolean isPackage(EventHandler eventHandler, PackageIdentifier packageName)
+ throws InterruptedException {
SkyKey packageLookupKey = PackageLookupValue.key(packageName);
if (!graph.exists(packageLookupKey)) {
// If the package lookup key does not exist in the graph, then it must not correspond to any
@@ -158,8 +159,10 @@ public final class GraphBackedRecursivePackageProvider implements RecursivePacka
@Override
public Iterable<PathFragment> getPackagesUnderDirectory(
- RepositoryName repository, PathFragment directory,
- ImmutableSet<PathFragment> excludedSubdirectories) {
+ RepositoryName repository,
+ PathFragment directory,
+ ImmutableSet<PathFragment> excludedSubdirectories)
+ throws InterruptedException {
PathFragment.checkAllPathsAreUnder(excludedSubdirectories, directory);
// Check that this package is covered by at least one of our universe patterns.
@@ -208,7 +211,8 @@ public final class GraphBackedRecursivePackageProvider implements RecursivePacka
private void collectPackagesUnder(
final RepositoryName repository,
Set<TraversalInfo> traversals,
- ImmutableList.Builder<PathFragment> builder) {
+ ImmutableList.Builder<PathFragment> builder)
+ throws InterruptedException {
Map<TraversalInfo, SkyKey> traversalToKeyMap =
Maps.asMap(
traversals,
@@ -256,7 +260,7 @@ public final class GraphBackedRecursivePackageProvider implements RecursivePacka
@Override
public Target getTarget(EventHandler eventHandler, Label label)
- throws NoSuchPackageException, NoSuchTargetException {
+ throws NoSuchPackageException, NoSuchTargetException, InterruptedException {
return getPackage(eventHandler, label.getPackageIdentifier()).getTarget(label.getName());
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageErrorFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageErrorFunction.java
index b277321342..17ba9bee28 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageErrorFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageErrorFunction.java
@@ -24,7 +24,6 @@ import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import javax.annotation.Nullable;
/**
@@ -44,7 +43,8 @@ public class PackageErrorFunction implements SkyFunction {
@Nullable
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws PackageErrorFunctionException {
+ public SkyValue compute(SkyKey skyKey, Environment env)
+ throws PackageErrorFunctionException, InterruptedException {
PackageIdentifier packageIdentifier = (PackageIdentifier) skyKey.argument();
try {
SkyKey packageKey = PackageValue.key(packageIdentifier);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
index 186232aeff..54edcf52e0 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
@@ -172,17 +172,19 @@ public class PackageFunction implements SkyFunction {
}
/**
- * Marks the given dependencies, and returns those already present. Ignores any exception
- * thrown while building the dependency, except for filesystem inconsistencies.
+ * Marks the given dependencies, and returns those already present. Ignores any exception thrown
+ * while building the dependency, except for filesystem inconsistencies.
*
* <p>We need to mark dependencies implicitly used by the legacy package loading code, but we
* don't care about any skyframe errors since the package knows whether it's in error or not.
*/
private static Pair<? extends Map<PathFragment, PackageLookupValue>, Boolean>
- getPackageLookupDepsAndPropagateInconsistentFilesystemExceptions(
- PackageIdentifier packageIdentifier,
- Iterable<SkyKey> depKeys, Environment env, boolean packageWasInError)
- throws InternalInconsistentFilesystemException {
+ getPackageLookupDepsAndPropagateInconsistentFilesystemExceptions(
+ PackageIdentifier packageIdentifier,
+ Iterable<SkyKey> depKeys,
+ Environment env,
+ boolean packageWasInError)
+ throws InternalInconsistentFilesystemException, InterruptedException {
Preconditions.checkState(
Iterables.all(depKeys, SkyFunctions.isSkyFunction(SkyFunctions.PACKAGE_LOOKUP)), depKeys);
boolean packageShouldBeInError = packageWasInError;
@@ -216,7 +218,7 @@ public class PackageFunction implements SkyFunction {
Environment env,
boolean packageWasInError)
throws InternalInconsistentFilesystemException, FileOutsidePackageRootsException,
- SymlinkOutsidePackageRootsException {
+ SymlinkOutsidePackageRootsException, InterruptedException {
Preconditions.checkState(
Iterables.all(depKeys, SkyFunctions.isSkyFunction(SkyFunctions.FILE)), depKeys);
boolean packageShouldBeInError = packageWasInError;
@@ -249,7 +251,7 @@ public class PackageFunction implements SkyFunction {
Environment env,
boolean packageWasInError)
throws InternalInconsistentFilesystemException, FileOutsidePackageRootsException,
- SymlinkOutsidePackageRootsException {
+ SymlinkOutsidePackageRootsException, InterruptedException {
Preconditions.checkState(
Iterables.all(depKeys, SkyFunctions.isSkyFunction(SkyFunctions.GLOB)), depKeys);
boolean packageShouldBeInError = packageWasInError;
@@ -289,7 +291,7 @@ public class PackageFunction implements SkyFunction {
PackageIdentifier packageIdentifier,
boolean containsErrors)
throws InternalInconsistentFilesystemException, FileOutsidePackageRootsException,
- SymlinkOutsidePackageRootsException {
+ SymlinkOutsidePackageRootsException, InterruptedException {
boolean packageShouldBeInError = containsErrors;
// TODO(bazel-team): This means that many packages will have to be preprocessed twice. Ouch!
@@ -368,11 +370,12 @@ public class PackageFunction implements SkyFunction {
/**
* Adds a dependency on the WORKSPACE file, representing it as a special type of package.
+ *
* @throws PackageFunctionException if there is an error computing the workspace file or adding
- * its rules to the //external package.
+ * its rules to the //external package.
*/
private SkyValue getExternalPackage(Environment env, Path packageLookupPath)
- throws PackageFunctionException {
+ throws PackageFunctionException, InterruptedException {
RootedPath workspacePath = RootedPath.toRootedPath(
packageLookupPath, Label.EXTERNAL_PACKAGE_FILE_NAME);
SkyKey workspaceKey = ExternalPackageFunction.key(workspacePath);
@@ -567,7 +570,8 @@ public class PackageFunction implements SkyFunction {
return new PackageValue(pkg);
}
- private FileValue getBuildFileValue(Environment env, RootedPath buildFileRootedPath) {
+ private static FileValue getBuildFileValue(Environment env, RootedPath buildFileRootedPath)
+ throws InterruptedException {
FileValue buildFileValue;
try {
buildFileValue = (FileValue) env.getValueOrThrow(FileValue.key(buildFileRootedPath),
@@ -747,7 +751,7 @@ public class PackageFunction implements SkyFunction {
private static void handleLabelsCrossingSubpackagesAndPropagateInconsistentFilesystemExceptions(
Path pkgRoot, PackageIdentifier pkgId, Package.Builder pkgBuilder, Environment env)
- throws InternalInconsistentFilesystemException {
+ throws InternalInconsistentFilesystemException, InterruptedException {
Set<SkyKey> containingPkgLookupKeys = Sets.newHashSet();
Map<Target, SkyKey> targetToKey = new HashMap<>();
for (Target target : pkgBuilder.getTargets()) {
@@ -921,7 +925,7 @@ public class PackageFunction implements SkyFunction {
@Override
public Token runAsync(List<String> includes, List<String> excludes, boolean excludeDirs)
- throws BadGlobException {
+ throws BadGlobException, InterruptedException {
List<SkyKey> globKeys = new ArrayList<>(includes.size() + excludes.size());
LinkedHashSet<SkyKey> includesKeys = Sets.newLinkedHashSetWithExpectedSize(includes.size());
LinkedHashSet<SkyKey> excludesKeys = Sets.newLinkedHashSetWithExpectedSize(excludes.size());
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
index 638f2eee8d..6e425e8dd7 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
@@ -47,7 +47,8 @@ public class PackageLookupFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws PackageLookupFunctionException {
+ public SkyValue compute(SkyKey skyKey, Environment env)
+ throws PackageLookupFunctionException, InterruptedException {
PathPackageLocator pkgLocator = PrecomputedValue.PATH_PACKAGE_LOCATOR.get(env);
PackageIdentifier packageKey = (PackageIdentifier) skyKey.argument();
if (PackageFunction.isDefaultsPackage(packageKey)) {
@@ -94,9 +95,9 @@ public class PackageLookupFunction implements SkyFunction {
}
@Nullable
- private FileValue getFileValue(
+ private static FileValue getFileValue(
RootedPath fileRootedPath, Environment env, PackageIdentifier packageIdentifier)
- throws PackageLookupFunctionException {
+ throws PackageLookupFunctionException, InterruptedException {
String basename = fileRootedPath.asPath().getBaseName();
SkyKey fileSkyKey = FileValue.key(fileRootedPath);
FileValue fileValue = null;
@@ -122,12 +123,12 @@ public class PackageLookupFunction implements SkyFunction {
return fileValue;
}
- private PackageLookupValue getPackageLookupValue(
+ private static PackageLookupValue getPackageLookupValue(
Environment env,
ImmutableList<Path> packagePathEntries,
PackageIdentifier packageIdentifier,
BuildFileName buildFileName)
- throws PackageLookupFunctionException {
+ throws PackageLookupFunctionException, InterruptedException {
// TODO(bazel-team): The following is O(n^2) on the number of elements on the package path due
// to having restart the SkyFunction after every new dependency. However, if we try to batch
// the missing value keys, more dependencies than necessary will be declared. This wart can be
@@ -147,9 +148,9 @@ public class PackageLookupFunction implements SkyFunction {
return PackageLookupValue.NO_BUILD_FILE_VALUE;
}
- private PackageLookupValue computeWorkspacePackageLookupValue(
+ private static PackageLookupValue computeWorkspacePackageLookupValue(
Environment env, ImmutableList<Path> packagePathEntries)
- throws PackageLookupFunctionException {
+ throws PackageLookupFunctionException, InterruptedException {
PackageLookupValue result =
getPackageLookupValue(
env, packagePathEntries, Label.EXTERNAL_PACKAGE_IDENTIFIER, BuildFileName.WORKSPACE);
@@ -182,11 +183,11 @@ public class PackageLookupFunction implements SkyFunction {
* Gets a PackageLookupValue from a different Bazel repository.
*
* <p>To do this, it looks up the "external" package and finds a path mapping for the repository
- * name.</p>
+ * name.
*/
- private PackageLookupValue computeExternalPackageLookupValue(
+ private static PackageLookupValue computeExternalPackageLookupValue(
SkyKey skyKey, Environment env, PackageIdentifier packageIdentifier)
- throws PackageLookupFunctionException {
+ throws PackageLookupFunctionException, InterruptedException {
PackageIdentifier id = (PackageIdentifier) skyKey.argument();
SkyKey repositoryKey = RepositoryValue.key(id.getRepository());
RepositoryValue repositoryValue;
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 e221ae7be1..08eecd7828 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
@@ -38,12 +38,10 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -134,8 +132,8 @@ public class PostConfiguredTargetFunction implements SkyFunction {
* target, or null if not all dependencies have yet been SkyFrame-evaluated.
*/
@Nullable
- private ImmutableMap<Label, ConfigMatchingProvider> getConfigurableAttributeConditions(
- TargetAndConfiguration ctg, Environment env) {
+ private static ImmutableMap<Label, ConfigMatchingProvider> getConfigurableAttributeConditions(
+ TargetAndConfiguration ctg, Environment env) throws InterruptedException {
if (!(ctg.getTarget() instanceof Rule)) {
return ImmutableMap.of();
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java
index a5f7a6793d..bc9977e4c9 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java
@@ -32,10 +32,8 @@ import com.google.devtools.build.skyframe.Injectable;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.Map;
import java.util.UUID;
-
import javax.annotation.Nullable;
/**
@@ -138,7 +136,7 @@ public final class PrecomputedValue implements SkyValue {
return "<BuildVariable " + value + ">";
}
- public static final void dependOnBuildId(SkyFunction.Environment env) {
+ public static void dependOnBuildId(SkyFunction.Environment env) throws InterruptedException {
BUILD_ID.get(env);
}
@@ -166,7 +164,7 @@ public final class PrecomputedValue implements SkyValue {
*/
@Nullable
@SuppressWarnings("unchecked")
- public T get(SkyFunction.Environment env) {
+ public T get(SkyFunction.Environment env) throws InterruptedException {
PrecomputedValue value = (PrecomputedValue) env.getValue(key);
if (value == null) {
return null;
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java
index 7524bee1c0..fc9cd81c55 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java
@@ -44,11 +44,9 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
-
import javax.annotation.Nullable;
/**
@@ -177,16 +175,17 @@ public class PrepareDepsOfPatternFunction implements SkyFunction {
}
@Override
- public ResolvedTargets<Void> getTargetsInPackage(String originalPattern,
- PackageIdentifier packageIdentifier, boolean rulesOnly) throws TargetParsingException {
+ public ResolvedTargets<Void> getTargetsInPackage(
+ String originalPattern, PackageIdentifier packageIdentifier, boolean rulesOnly)
+ throws TargetParsingException, InterruptedException {
FilteringPolicy policy =
rulesOnly ? FilteringPolicies.RULES_ONLY : FilteringPolicies.NO_FILTER;
return getTargetsInPackage(originalPattern, packageIdentifier, policy);
}
- private ResolvedTargets<Void> getTargetsInPackage(String originalPattern,
- PackageIdentifier packageIdentifier, FilteringPolicy policy)
- throws TargetParsingException {
+ private ResolvedTargets<Void> getTargetsInPackage(
+ String originalPattern, PackageIdentifier packageIdentifier, FilteringPolicy policy)
+ throws TargetParsingException, InterruptedException {
try {
Package pkg = packageProvider.getPackage(env.getListener(), packageIdentifier);
ResolvedTargets<Target> packageTargets =
@@ -209,7 +208,7 @@ public class PrepareDepsOfPatternFunction implements SkyFunction {
}
@Override
- public boolean isPackage(PackageIdentifier packageIdentifier) {
+ public boolean isPackage(PackageIdentifier packageIdentifier) throws InterruptedException {
return packageProvider.isPackage(env.getListener(), packageIdentifier);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunction.java
index b5b560a2c8..568b623c6e 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunction.java
@@ -32,9 +32,7 @@ import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -50,7 +48,7 @@ public class PrepareDepsOfTargetsUnderDirectoryFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
PrepareDepsOfTargetsUnderDirectoryKey argument =
(PrepareDepsOfTargetsUnderDirectoryKey) skyKey.argument();
FilteringPolicy filteringPolicy = argument.getFilteringPolicy();
@@ -102,13 +100,13 @@ public class PrepareDepsOfTargetsUnderDirectoryFunction implements SkyFunction {
}
@Override
- public void visitPackageValue(Package pkg, Environment env) {
+ public void visitPackageValue(Package pkg, Environment env) throws InterruptedException {
loadTransitiveTargets(env, pkg, filteringPolicy);
}
}
private static void loadTransitiveTargets(
- Environment env, Package pkg, FilteringPolicy filteringPolicy) {
+ Environment env, Package pkg, FilteringPolicy filteringPolicy) throws InterruptedException {
ResolvedTargets<Target> packageTargets =
TargetPatternResolverUtil.resolvePackageTargets(pkg, filteringPolicy);
ImmutableList.Builder<SkyKey> builder = ImmutableList.builder();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveDirectoryTraversalFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveDirectoryTraversalFunction.java
index 24696d04f9..4c66e8fe47 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveDirectoryTraversalFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveDirectoryTraversalFunction.java
@@ -39,7 +39,6 @@ import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.ValueOrException;
import com.google.devtools.build.skyframe.ValueOrException4;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -105,25 +104,26 @@ abstract class RecursiveDirectoryTraversalFunction
interface Visitor {
/**
- * Called iff the directory contains a package. Provides an {@link Environment} {@code env}
- * so that the visitor may do additional lookups. {@link Environment#valuesMissing} will be
- * checked afterwards.
+ * Called iff the directory contains a package. Provides an {@link Environment} {@code env} so
+ * that the visitor may do additional lookups. {@link Environment#valuesMissing} will be checked
+ * afterwards.
*/
- void visitPackageValue(Package pkg, Environment env);
+ void visitPackageValue(Package pkg, Environment env) throws InterruptedException;
}
/**
- * Looks in the directory specified by {@code recursivePkgKey} for a package, does some work
- * as specified by {@link Visitor} if such a package exists, then recursively does work in each
+ * Looks in the directory specified by {@code recursivePkgKey} for a package, does some work as
+ * specified by {@link Visitor} if such a package exists, then recursively does work in each
* non-excluded subdirectory as specified by {@link #getSkyKeyForSubdirectory}, and finally
- * aggregates the {@link Visitor} value along with values from each subdirectory as specified
- * by {@link #aggregateWithSubdirectorySkyValues}, and returns that aggregation.
+ * aggregates the {@link Visitor} value along with values from each subdirectory as specified by
+ * {@link #aggregateWithSubdirectorySkyValues}, and returns that aggregation.
*
* <p>Returns null if {@code env.valuesMissing()} is true, checked after each call to one of
* {@link RecursiveDirectoryTraversalFunction}'s abstract methods that were given {@code env}.
* (And after each of {@code visitDirectory}'s own uses of {@code env}, of course.)
*/
- TReturn visitDirectory(RecursivePkgKey recursivePkgKey, Environment env) {
+ TReturn visitDirectory(RecursivePkgKey recursivePkgKey, Environment env)
+ throws InterruptedException {
RootedPath rootedPath = recursivePkgKey.getRootedPath();
ImmutableSet<PathFragment> excludedPaths = recursivePkgKey.getExcludedPaths();
Path root = rootedPath.getRoot();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
index b7f7b921d6..e122307ee7 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
@@ -31,12 +31,10 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-
import javax.annotation.Nullable;
/** A {@link SkyFunction} to build {@link RecursiveFilesystemTraversalValue}s. */
@@ -109,7 +107,7 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
@Override
public SkyValue compute(SkyKey skyKey, Environment env)
- throws RecursiveFilesystemTraversalFunctionException {
+ throws RecursiveFilesystemTraversalFunctionException, InterruptedException {
TraversalRequest traversal = (TraversalRequest) skyKey.argument();
try {
// Stat the traversal root.
@@ -204,7 +202,7 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
}
private static FileInfo lookUpFileInfo(Environment env, TraversalRequest traversal)
- throws MissingDepException {
+ throws MissingDepException, InterruptedException {
// Stat the file.
FileValue fileValue = (FileValue) getDependentSkyValue(env, FileValue.key(traversal.path));
if (fileValue.exists()) {
@@ -279,8 +277,9 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
* {@link FileInfo} so the caller should use these instead of the old ones (this happens when
* a package is found, but under a different root than expected)
*/
- private static PkgLookupResult checkIfPackage(Environment env, TraversalRequest traversal,
- FileInfo rootInfo) throws MissingDepException {
+ private static PkgLookupResult checkIfPackage(
+ Environment env, TraversalRequest traversal, FileInfo rootInfo)
+ throws MissingDepException, InterruptedException {
Preconditions.checkArgument(rootInfo.type.exists() && !rootInfo.type.isFile(),
"{%s} {%s}", traversal, rootInfo);
PackageLookupValue pkgLookup = (PackageLookupValue) getDependentSkyValue(env,
@@ -315,8 +314,9 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
*
* <p>The returned keys are of type {@link SkyFunctions#RECURSIVE_FILESYSTEM_TRAVERSAL}.
*/
- private static Collection<SkyKey> createRecursiveTraversalKeys(Environment env,
- TraversalRequest traversal) throws MissingDepException {
+ private static Collection<SkyKey> createRecursiveTraversalKeys(
+ Environment env, TraversalRequest traversal)
+ throws MissingDepException, InterruptedException {
// Use the traversal's path, even if it's a symlink. The contents of the directory, as listed
// in the result, must be relative to it.
DirectoryListingValue dirListing = (DirectoryListingValue) getDependentSkyValue(env,
@@ -405,7 +405,7 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
}
private static SkyValue getDependentSkyValue(Environment env, SkyKey key)
- throws MissingDepException {
+ throws MissingDepException, InterruptedException {
SkyValue value = env.getValue(key);
if (env.valuesMissing()) {
throw new MissingDepException();
@@ -419,8 +419,7 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
* <p>The keys must all be {@link SkyFunctions#RECURSIVE_FILESYSTEM_TRAVERSAL} keys.
*/
private static Collection<RecursiveFilesystemTraversalValue> traverseChildren(
- Environment env, Iterable<SkyKey> keys)
- throws MissingDepException {
+ Environment env, Iterable<SkyKey> keys) throws MissingDepException, InterruptedException {
Map<SkyKey, SkyValue> values = env.getValues(keys);
if (env.valuesMissing()) {
throw new MissingDepException();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java
index 642d8eae36..a01a1f4f33 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java
@@ -44,7 +44,6 @@ import com.google.devtools.build.lib.pkgcache.RecursivePackageProvider;
import com.google.devtools.build.lib.pkgcache.TargetPatternResolverUtil;
import com.google.devtools.build.lib.util.BatchCallback;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -171,7 +170,7 @@ public class RecursivePackageProviderBackedTargetPatternResolver
}
@Override
- public boolean isPackage(PackageIdentifier packageIdentifier) {
+ public boolean isPackage(PackageIdentifier packageIdentifier) throws InterruptedException {
return recursivePackageProvider.isPackage(eventHandler, packageIdentifier);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunction.java
index 607e9b2c4e..9b97b4be19 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunction.java
@@ -27,9 +27,7 @@ import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.Map;
-
import javax.annotation.Nullable;
/**
@@ -48,7 +46,7 @@ public class RecursivePkgFunction implements SkyFunction {
/** N.B.: May silently throw {@link NoSuchPackageException} in nokeep_going mode! */
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
return new MyTraversalFunction().visitDirectory((RecursivePkgKey) skyKey.argument(), env);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
index b5c0863d98..11d66001db 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
@@ -74,7 +74,6 @@ import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.Symlinks;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
import com.google.protobuf.ByteString;
-
import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
@@ -92,7 +91,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicReference;
-
import javax.annotation.Nullable;
/**
@@ -503,7 +501,7 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
@Nullable
Iterable<Artifact> getActionCachedInputs(Action action, PackageRootResolver resolver)
- throws PackageRootResolutionException {
+ throws PackageRootResolutionException, InterruptedException {
return actionCacheChecker.getCachedInputs(action, resolver);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeAwareAction.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeAwareAction.java
index 6c2caf1128..43c0193d0e 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeAwareAction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeAwareAction.java
@@ -40,7 +40,7 @@ import com.google.devtools.build.skyframe.SkyFunction.Environment;
public interface SkyframeAwareAction {
/** Wrapper and/or base class for exceptions raised in {@link #establishSkyframeDependencies}. */
- public static class ExceptionBase extends Exception {
+ class ExceptionBase extends Exception {
public ExceptionBase(String message) {
super(message);
}
@@ -53,11 +53,11 @@ public interface SkyframeAwareAction {
/**
* Establish dependencies on Skyframe values before executing the action.
*
- * <p><b>IMPORTANT</b>: actions that implement this interface should override
- * {@code Action.executeUnconditionally} and return true. See {@link SkyframeAwareAction} why.
+ * <p><b>IMPORTANT</b>: actions that implement this interface should override {@code
+ * Action.executeUnconditionally} and return true. See {@link SkyframeAwareAction} why.
*
- * <p>This method should perform as little computation as possible: ideally it should request
- * one or a few SkyValues, perhaps set some state somewhere and return. If this method needs to
+ * <p>This method should perform as little computation as possible: ideally it should request one
+ * or a few SkyValues, perhaps set some state somewhere and return. If this method needs to
* perform anything more complicated than that, including perhaps some non-trivial computation,
* you should implement that as a SkyFunction and request the corresponding SkyValue in this
* method.
@@ -69,5 +69,5 @@ public interface SkyframeAwareAction {
* exceptions); that is the responsibility of the caller. It should return as soon as possible,
* ready to be called again at a later time if need be.
*/
- void establishSkyframeDependencies(Environment env) throws ExceptionBase;
+ void establishSkyframeDependencies(Environment env) throws ExceptionBase, InterruptedException;
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
index 546a0e2575..2d80c522f5 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
@@ -73,13 +73,11 @@ import com.google.devtools.build.skyframe.EvaluationResult;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
-
import javax.annotation.Nullable;
/**
@@ -430,7 +428,8 @@ public final class SkyframeBuildView {
*/
// TODO(bazel-team): Allow analysis to return null so the value builder can exit and wait for a
// restart deps are not present.
- private boolean getWorkspaceStatusValues(Environment env, BuildConfiguration config) {
+ private static boolean getWorkspaceStatusValues(Environment env, BuildConfiguration config)
+ throws InterruptedException {
env.getValue(WorkspaceStatusValue.SKY_KEY);
Map<BuildInfoKey, BuildInfoFactory> buildInfoFactories =
PrecomputedValue.BUILD_INFO_FACTORIES.get(env);
@@ -451,9 +450,13 @@ public final class SkyframeBuildView {
/** Returns null if any build-info values are not ready. */
@Nullable
- CachingAnalysisEnvironment createAnalysisEnvironment(ArtifactOwner owner,
- boolean isSystemEnv, EventHandler eventHandler,
- Environment env, BuildConfiguration config) {
+ CachingAnalysisEnvironment createAnalysisEnvironment(
+ ArtifactOwner owner,
+ boolean isSystemEnv,
+ EventHandler eventHandler,
+ Environment env,
+ BuildConfiguration config)
+ throws InterruptedException {
if (config != null && !getWorkspaceStatusValues(env, config)) {
return null;
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeDependencyResolver.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeDependencyResolver.java
index 09fc0f2176..965c3fb4d0 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeDependencyResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeDependencyResolver.java
@@ -31,12 +31,10 @@ import com.google.devtools.build.lib.packages.TargetUtils;
import com.google.devtools.build.skyframe.SkyFunction.Environment;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.ValueOrException;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -65,7 +63,8 @@ public final class SkyframeDependencyResolver extends DependencyResolver {
}
@Override
- protected void missingEdgeHook(Target from, Label to, NoSuchThingException e) {
+ protected void missingEdgeHook(Target from, Label to, NoSuchThingException e)
+ throws InterruptedException {
if (e instanceof NoSuchTargetException) {
NoSuchTargetException nste = (NoSuchTargetException) e;
if (to.equals(nste.getLabel())) {
@@ -87,7 +86,8 @@ public final class SkyframeDependencyResolver extends DependencyResolver {
@Nullable
@Override
- protected Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses) {
+ protected Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses)
+ throws InterruptedException {
SkyKey key = PackageValue.key(label.getPackageIdentifier());
PackageValue packageValue;
try {
@@ -125,7 +125,8 @@ public final class SkyframeDependencyResolver extends DependencyResolver {
@Override
protected List<BuildConfiguration> getConfigurations(
Set<Class<? extends BuildConfiguration.Fragment>> fragments,
- Iterable<BuildOptions> buildOptions) throws InvalidConfigurationException {
+ Iterable<BuildOptions> buildOptions)
+ throws InvalidConfigurationException, InterruptedException {
List<SkyKey> keys = new ArrayList<>();
for (BuildOptions options : buildOptions) {
keys.add(BuildConfigurationValue.key(fragments, options));
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java
index 7ebb7b0018..ceda17193d 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java
@@ -32,7 +32,6 @@ import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.MemoizingEvaluator;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
-
import java.io.IOException;
/**
@@ -56,7 +55,7 @@ class SkyframePackageLoaderWithValueEnvironment implements PackageProviderForCon
}
private Package getPackage(final PackageIdentifier pkgIdentifier)
- throws NoSuchPackageException {
+ throws NoSuchPackageException, InterruptedException {
SkyKey key = PackageValue.key(pkgIdentifier);
PackageValue value = (PackageValue) env.getValueOrThrow(key, NoSuchPackageException.class);
if (value != null) {
@@ -66,13 +65,15 @@ class SkyframePackageLoaderWithValueEnvironment implements PackageProviderForCon
}
@Override
- public Target getTarget(Label label) throws NoSuchPackageException, NoSuchTargetException {
+ public Target getTarget(Label label)
+ throws NoSuchPackageException, NoSuchTargetException, InterruptedException {
Package pkg = getPackage(label.getPackageIdentifier());
return pkg == null ? null : pkg.getTarget(label.getName());
}
@Override
- public void addDependency(Package pkg, String fileName) throws LabelSyntaxException, IOException {
+ public void addDependency(Package pkg, String fileName)
+ throws LabelSyntaxException, IOException, InterruptedException {
RootedPath fileRootedPath = RootedPath.toRootedPath(pkg.getSourceRoot(),
pkg.getPackageIdentifier().getSourceRoot().getRelative(fileName));
FileValue result = (FileValue) env.getValue(FileValue.key(fileRootedPath));
@@ -83,7 +84,7 @@ class SkyframePackageLoaderWithValueEnvironment implements PackageProviderForCon
@Override
public <T extends Fragment> T getFragment(BuildOptions buildOptions, Class<T> fragmentType)
- throws InvalidConfigurationException {
+ throws InvalidConfigurationException, InterruptedException {
ConfigurationFragmentValue fragmentNode = (ConfigurationFragmentValue) env.getValueOrThrow(
ConfigurationFragmentValue.key(buildOptions, fragmentType, ruleClassProvider),
InvalidConfigurationException.class);
@@ -94,7 +95,7 @@ class SkyframePackageLoaderWithValueEnvironment implements PackageProviderForCon
}
@Override
- public BlazeDirectories getDirectories() {
+ public BlazeDirectories getDirectories() throws InterruptedException {
return PrecomputedValue.BLAZE_DIRECTORIES.get(env);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunction.java
index c4889fa7d8..951d8a78b9 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunction.java
@@ -47,13 +47,11 @@ import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.ValueOrException2;
-
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -211,17 +209,17 @@ public class SkylarkImportLookupFunction implements SkyFunction {
}
/**
- * Computes the set of Labels corresponding to a collection of PathFragments representing
- * absolute import paths.
- *
+ * Computes the set of Labels corresponding to a collection of PathFragments representing absolute
+ * import paths.
+ *
* @return a map from the computed {@link Label}s to the corresponding {@link PathFragment}s;
- * {@code null} if any Skyframe dependencies are unavailable.
+ * {@code null} if any Skyframe dependencies are unavailable.
* @throws SkylarkImportFailedException
*/
@Nullable
static ImmutableMap<PathFragment, Label> labelsForAbsoluteImports(
ImmutableSet<PathFragment> pathsToLookup, Environment env)
- throws SkylarkImportFailedException {
+ throws SkylarkImportFailedException, InterruptedException {
// Import PathFragments are absolute, so there is a 1-1 mapping from corresponding Labels.
ImmutableMap.Builder<PathFragment, Label> outputMap = new ImmutableMap.Builder<>();
@@ -290,19 +288,17 @@ public class SkylarkImportLookupFunction implements SkyFunction {
/**
* Computes the set of {@link Label}s corresponding to a set of Skylark {@link LoadStatement}s.
- *
+ *
* @param imports a collection of Skylark {@link LoadStatement}s
* @param containingFileLabel the {@link Label} of the file containing the load statements
- * @return an {@link ImmutableMap} which maps a {@link String} used in the load statement to
- * its corresponding {@Label}. Returns {@code null} if any Skyframe dependencies are
- * unavailable.
- * @throws SkylarkImportFailedException if no package can be found that contains the
- * loaded file
+ * @return an {@link ImmutableMap} which maps a {@link String} used in the load statement to its
+ * corresponding {@Label}. Returns {@code null} if any Skyframe dependencies are unavailable.
+ * @throws SkylarkImportFailedException if no package can be found that contains the loaded file
*/
@Nullable
static ImmutableMap<String, Label> findLabelsForLoadStatements(
ImmutableCollection<SkylarkImport> imports, Label containingFileLabel, Environment env)
- throws SkylarkImportFailedException {
+ throws SkylarkImportFailedException, InterruptedException {
Preconditions.checkArgument(
!containingFileLabel.getPackageIdentifier().getRepository().isDefault());
Map<String, Label> outputMap = Maps.newHashMapWithExpectedSize(imports.size());
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TargetMarkerFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TargetMarkerFunction.java
index 736455ba2a..2aeba41d09 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TargetMarkerFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TargetMarkerFunction.java
@@ -25,7 +25,6 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import javax.annotation.Nullable;
/**
@@ -37,7 +36,8 @@ import javax.annotation.Nullable;
public final class TargetMarkerFunction implements SkyFunction {
@Override
- public SkyValue compute(SkyKey key, Environment env) throws TargetMarkerFunctionException {
+ public SkyValue compute(SkyKey key, Environment env)
+ throws TargetMarkerFunctionException, InterruptedException {
try {
return computeTargetMarkerValue(key, env);
} catch (NoSuchTargetException e) {
@@ -50,7 +50,7 @@ public final class TargetMarkerFunction implements SkyFunction {
@Nullable
static TargetMarkerValue computeTargetMarkerValue(SkyKey key, Environment env)
- throws NoSuchTargetException, NoSuchPackageException {
+ throws NoSuchTargetException, NoSuchPackageException, InterruptedException {
Label label = (Label) key.argument();
PathFragment pkgForLabel = label.getPackageFragment();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java
index 5215b7370a..60600caa1a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java
@@ -53,7 +53,7 @@ import javax.annotation.Nullable;
final class TargetPatternPhaseFunction implements SkyFunction {
@Override
- public TargetPatternPhaseValue compute(SkyKey key, Environment env) {
+ public TargetPatternPhaseValue compute(SkyKey key, Environment env) throws InterruptedException {
TargetPatternList options = (TargetPatternList) key.argument();
PackageValue packageValue = null;
boolean workspaceError = false;
@@ -189,8 +189,9 @@ final class TargetPatternPhaseFunction implements SkyFunction {
* @param compileOneDependency if true, enables alternative interpretation of targetPatterns; see
* {@link LoadingOptions#compileOneDependency}
*/
- private static ResolvedTargets<Target> getTargetsToBuild(Environment env,
- List<String> targetPatterns, String offset, boolean compileOneDependency) {
+ private static ResolvedTargets<Target> getTargetsToBuild(
+ Environment env, List<String> targetPatterns, String offset, boolean compileOneDependency)
+ throws InterruptedException {
List<SkyKey> patternSkyKeys = new ArrayList<>();
for (TargetPatternSkyKeyOrException keyOrException :
TargetPatternValue.keys(targetPatterns, FilteringPolicies.FILTER_MANUAL, offset)) {
@@ -253,8 +254,9 @@ final class TargetPatternPhaseFunction implements SkyFunction {
* @param targetPatterns the list of command-line target patterns specified by the user
* @param testFilter the test filter
*/
- private static ResolvedTargets<Target> determineTests(Environment env,
- List<String> targetPatterns, String offset, TestFilter testFilter) {
+ private static ResolvedTargets<Target> determineTests(
+ Environment env, List<String> targetPatterns, String offset, TestFilter testFilter)
+ throws InterruptedException {
List<SkyKey> patternSkyKeys = new ArrayList<>();
for (TargetPatternSkyKeyOrException keyOrException :
TargetPatternValue.keys(targetPatterns, FilteringPolicies.FILTER_TESTS, offset)) {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternValue.java
index 7641f6eec9..e555b7df99 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternValue.java
@@ -13,8 +13,6 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
@@ -32,9 +30,9 @@ import com.google.devtools.build.lib.pkgcache.FilteringPolicies;
import com.google.devtools.build.lib.pkgcache.FilteringPolicy;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.PathFragment;
+import com.google.devtools.build.skyframe.InterruptibleSupplier;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -209,13 +207,15 @@ public final class TargetPatternValue implements SkyValue {
return excludedSubdirectories;
}
- public ImmutableSet<PathFragment> getAllSubdirectoriesToExclude(
- Iterable<PathFragment> blacklistedPackagePrefixes) {
- return getAllSubdirectoriesToExclude(Suppliers.ofInstance(blacklistedPackagePrefixes));
+ ImmutableSet<PathFragment> getAllSubdirectoriesToExclude(
+ Iterable<PathFragment> blacklistedPackagePrefixes) throws InterruptedException {
+ return getAllSubdirectoriesToExclude(
+ new InterruptibleSupplier.Instance<>(blacklistedPackagePrefixes));
}
public ImmutableSet<PathFragment> getAllSubdirectoriesToExclude(
- Supplier<? extends Iterable<PathFragment>> blacklistedPackagePrefixes) {
+ InterruptibleSupplier<? extends Iterable<PathFragment>> blacklistedPackagePrefixes)
+ throws InterruptedException {
ImmutableSet.Builder<PathFragment> excludedPathsBuilder = ImmutableSet.builder();
excludedPathsBuilder.addAll(getExcludedSubdirectories());
if (parsedPattern.getType() == Type.TARGETS_BELOW_DIRECTORY) {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternsResultBuilder.java b/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternsResultBuilder.java
index 575a0ff30e..3d0acf06af 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternsResultBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternsResultBuilder.java
@@ -23,7 +23,6 @@ import com.google.devtools.build.lib.packages.Package;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.skyframe.WalkableGraph;
-
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -43,10 +42,9 @@ abstract class TargetPatternsResultBuilder {
hasError = true;
}
- /**
- * Returns final set of targets and sets error flag if required.
- */
- public ResolvedTargets<Target> build(WalkableGraph walkableGraph) throws TargetParsingException {
+ /** Returns final set of targets and sets error flag if required. */
+ public ResolvedTargets<Target> build(WalkableGraph walkableGraph)
+ throws TargetParsingException, InterruptedException {
precomputePackages(walkableGraph);
ResolvedTargets.Builder<Target> resolvedTargetsBuilder = buildInternal();
if (hasError) {
@@ -74,7 +72,7 @@ abstract class TargetPatternsResultBuilder {
return resolvedTargetsBuilder;
}
- private void precomputePackages(WalkableGraph walkableGraph) {
+ private void precomputePackages(WalkableGraph walkableGraph) throws InterruptedException {
Set<PackageIdentifier> packagesToRequest = getPackagesIdentifiers();
packages = Maps.newHashMapWithExpectedSize(packagesToRequest.size());
for (PackageIdentifier pkgIdentifier : packagesToRequest) {
@@ -102,8 +100,8 @@ abstract class TargetPatternsResultBuilder {
return packagesIdentifiers;
}
- private Package findPackageInGraph(PackageIdentifier pkgIdentifier,
- WalkableGraph walkableGraph) {
+ private static Package findPackageInGraph(
+ PackageIdentifier pkgIdentifier, WalkableGraph walkableGraph) throws InterruptedException {
return Preconditions.checkNotNull(
((PackageValue) walkableGraph.getValue(PackageValue.key(pkgIdentifier))), pkgIdentifier)
.getPackage();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java
index d277b1955a..3523d3370b 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java
@@ -29,12 +29,8 @@ import com.google.devtools.build.skyframe.SkyValue;
* runs.
*/
public final class TestCompletionFunction implements SkyFunction {
-
- public TestCompletionFunction() {
- }
-
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
TestCompletionValue.TestCompletionKey key =
(TestCompletionValue.TestCompletionKey) skyKey.argument();
LabelAndConfiguration lac = key.labelAndConfiguration();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TestSuiteExpansionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TestSuiteExpansionFunction.java
index d5ecb25ae2..6324b2e03e 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TestSuiteExpansionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TestSuiteExpansionFunction.java
@@ -25,7 +25,6 @@ import com.google.devtools.build.lib.skyframe.TestSuiteExpansionValue.TestSuiteE
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
@@ -33,7 +32,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -41,7 +39,7 @@ import javax.annotation.Nullable;
*/
final class TestSuiteExpansionFunction implements SkyFunction {
@Override
- public SkyValue compute(SkyKey key, Environment env) {
+ public SkyValue compute(SkyKey key, Environment env) throws InterruptedException {
TestSuiteExpansion expansion = (TestSuiteExpansion) key.argument();
ResolvedTargets<Target> targets = labelsToTargets(env, expansion.getTargets(), false);
List<SkyKey> testsInSuitesKeys = new ArrayList<>();
@@ -80,7 +78,7 @@ final class TestSuiteExpansionFunction implements SkyFunction {
}
static ResolvedTargets<Target> labelsToTargets(
- Environment env, ImmutableSet<Label> labels, boolean hasError) {
+ Environment env, ImmutableSet<Label> labels, boolean hasError) throws InterruptedException {
Set<PackageIdentifier> pkgIdentifiers = new LinkedHashSet<>();
for (Label label : labels) {
pkgIdentifiers.add(label.getPackageIdentifier());
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TestsInSuiteFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TestsInSuiteFunction.java
index 4556c762fb..18a747ee97 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TestsInSuiteFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TestsInSuiteFunction.java
@@ -35,7 +35,6 @@ import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.ValueOrException;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -44,7 +43,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -54,7 +52,7 @@ import javax.annotation.Nullable;
// TODO(ulfjack): What about test_suite rules that include each other.
final class TestsInSuiteFunction implements SkyFunction {
@Override
- public SkyValue compute(SkyKey key, Environment env) {
+ public SkyValue compute(SkyKey key, Environment env) throws InterruptedException {
TestsInSuite expansion = (TestsInSuite) key.argument();
ResolvedTargets<Target> result =
computeTestsInSuite(env, expansion.getTestSuite(), expansion.isStrict());
@@ -65,13 +63,13 @@ final class TestsInSuiteFunction implements SkyFunction {
}
/**
- * Populates 'result' with all the tests associated with the specified
- * 'testSuite'. Throws an exception if any target is missing.
+ * Populates 'result' with all the tests associated with the specified 'testSuite'. Throws an
+ * exception if any target is missing.
*
- * <p>CAUTION! Keep this logic consistent with {@code TestSuite}!
+ * <p>CAUTION! Keep this logic consistent with {@code TestSuite}!
*/
- private ResolvedTargets<Target> computeTestsInSuite(
- Environment env, Rule testSuite, boolean strict) {
+ private static ResolvedTargets<Target> computeTestsInSuite(
+ Environment env, Rule testSuite, boolean strict) throws InterruptedException {
ResolvedTargets.Builder<Target> builder = ResolvedTargets.builder();
List<Target> testsAndSuites = new ArrayList<>();
// Note that testsAndSuites can contain input file targets; the test_suite rule does not
@@ -132,8 +130,9 @@ final class TestsInSuiteFunction implements SkyFunction {
* found a problem during the lookup process; the actual error message is reported to the
* environment.
*/
- private boolean getPrerequisites(Environment env, Rule testSuite, String attrName,
- List<Target> targets) {
+ private static boolean getPrerequisites(
+ Environment env, Rule testSuite, String attrName, List<Target> targets)
+ throws InterruptedException {
List<Label> labels =
NonconfigurableAttributeMapper.of(testSuite).get(attrName, BuildType.LABEL_LIST);
Set<PackageIdentifier> pkgIdentifiers = new LinkedHashSet<>();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveBaseTraversalFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveBaseTraversalFunction.java
index 44b161b5a0..3bc1f30845 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveBaseTraversalFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveBaseTraversalFunction.java
@@ -34,7 +34,6 @@ import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.ValueOrException2;
-
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -42,7 +41,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import javax.annotation.Nullable;
/**
@@ -79,10 +77,13 @@ abstract class TransitiveBaseTraversalFunction<TProcessedTargets> implements Sky
abstract TProcessedTargets processTarget(Label label, TargetAndErrorIfAny targetAndErrorIfAny);
- abstract void processDeps(TProcessedTargets processedTargets, EventHandler eventHandler,
+ abstract void processDeps(
+ TProcessedTargets processedTargets,
+ EventHandler eventHandler,
TargetAndErrorIfAny targetAndErrorIfAny,
Iterable<Entry<SkyKey, ValueOrException2<NoSuchPackageException, NoSuchTargetException>>>
- depEntries);
+ depEntries)
+ throws InterruptedException;
/**
* Returns a {@link SkyValue} based on the target and any errors it has, and the values
@@ -97,11 +98,11 @@ abstract class TransitiveBaseTraversalFunction<TProcessedTargets> implements Sky
*/
@Nullable
abstract TargetMarkerValue getTargetMarkerValue(SkyKey targetMarkerKey, Environment env)
- throws NoSuchTargetException, NoSuchPackageException;
+ throws NoSuchTargetException, NoSuchPackageException, InterruptedException;
@Override
public SkyValue compute(SkyKey key, Environment env)
- throws TransitiveBaseTraversalFunctionException {
+ throws TransitiveBaseTraversalFunctionException, InterruptedException {
Label label = (Label) key.argument();
LoadTargetResults loadTargetResults;
try {
@@ -157,9 +158,11 @@ abstract class TransitiveBaseTraversalFunction<TProcessedTargets> implements Sky
* <p>This method may return a precise set of aspect keys, but may need to request additional
* dependencies from the env to do so.
*/
- private Iterable<SkyKey> getStrictLabelAspectKeys(Target target,
- Map<SkyKey, ValueOrException2<NoSuchPackageException, NoSuchTargetException>> depMap,
- Environment env) {
+ private Iterable<SkyKey> getStrictLabelAspectKeys(
+ Target target,
+ Map<SkyKey, ValueOrException2<NoSuchPackageException, NoSuchTargetException>> depMap,
+ Environment env)
+ throws InterruptedException {
List<SkyKey> depKeys = Lists.newArrayList();
if (target instanceof Rule) {
Map<Label, ValueOrException2<NoSuchPackageException, NoSuchTargetException>> labelDepMap =
@@ -189,9 +192,10 @@ abstract class TransitiveBaseTraversalFunction<TProcessedTargets> implements Sky
Attribute attr,
Label toLabel,
ValueOrException2<NoSuchPackageException, NoSuchTargetException> toVal,
- Environment env);
+ Environment env)
+ throws InterruptedException;
- private Iterable<SkyKey> getLabelDepKeys(Target target) {
+ private Iterable<SkyKey> getLabelDepKeys(Target target) throws InterruptedException {
List<SkyKey> depKeys = Lists.newArrayList();
for (Label depLabel : getLabelDeps(target)) {
depKeys.add(getKey(depLabel));
@@ -200,7 +204,7 @@ abstract class TransitiveBaseTraversalFunction<TProcessedTargets> implements Sky
}
// TODO(bazel-team): Unify this logic with that in LabelVisitor, and possibly DependencyResolver.
- private static Iterable<Label> getLabelDeps(Target target) {
+ private static Iterable<Label> getLabelDeps(Target target) throws InterruptedException {
final Set<Label> labels = new HashSet<>();
if (target instanceof OutputFile) {
Rule rule = ((OutputFile) target).getGeneratingRule();
@@ -217,7 +221,7 @@ abstract class TransitiveBaseTraversalFunction<TProcessedTargets> implements Sky
return labels;
}
- private static void visitRule(Target target, Set<Label> labels) {
+ private static void visitRule(Target target, Set<Label> labels) throws InterruptedException {
labels.addAll(((Rule) target).getTransitions(DependencyFilter.NO_NODEP_ATTRIBUTES).values());
}
@@ -295,7 +299,7 @@ abstract class TransitiveBaseTraversalFunction<TProcessedTargets> implements Sky
}
private LoadTargetResults loadTarget(Environment env, Label label)
- throws NoSuchTargetException, NoSuchPackageException {
+ throws NoSuchTargetException, NoSuchPackageException, InterruptedException {
SkyKey packageKey = PackageValue.key(label.getPackageIdentifier());
SkyKey targetKey = TargetMarkerValue.key(label);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTargetFunction.java
index 81e53e0429..b620259f25 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTargetFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTargetFunction.java
@@ -118,10 +118,13 @@ public class TransitiveTargetFunction
}
@Override
- void processDeps(TransitiveTargetValueBuilder builder, EventHandler eventHandler,
+ void processDeps(
+ TransitiveTargetValueBuilder builder,
+ EventHandler eventHandler,
TargetAndErrorIfAny targetAndErrorIfAny,
Iterable<Entry<SkyKey, ValueOrException2<NoSuchPackageException, NoSuchTargetException>>>
- depEntries) {
+ depEntries)
+ throws InterruptedException {
boolean successfulTransitiveLoading = builder.isSuccessfulTransitiveLoading();
Target target = targetAndErrorIfAny.getTarget();
NestedSetBuilder<Label> transitiveRootCauses = builder.getTransitiveRootCauses();
@@ -241,9 +244,13 @@ public class TransitiveTargetFunction
}
@Override
- protected Collection<Label> getAspectLabels(Rule fromRule, Attribute attr, Label toLabel,
+ protected Collection<Label> getAspectLabels(
+ Rule fromRule,
+ Attribute attr,
+ Label toLabel,
ValueOrException2<NoSuchPackageException, NoSuchTargetException> toVal,
- final Environment env) {
+ final Environment env)
+ throws InterruptedException {
SkyKey packageKey = PackageValue.key(toLabel.getPackageIdentifier());
try {
PackageValue pkgValue =
@@ -269,14 +276,15 @@ public class TransitiveTargetFunction
@Override
TargetMarkerValue getTargetMarkerValue(SkyKey targetMarkerKey, Environment env)
- throws NoSuchTargetException, NoSuchPackageException {
+ throws NoSuchTargetException, NoSuchPackageException, InterruptedException {
return (TargetMarkerValue)
env.getValueOrThrow(
targetMarkerKey, NoSuchTargetException.class, NoSuchPackageException.class);
}
- private void maybeReportErrorAboutMissingEdge(
- Target target, Label depLabel, NoSuchThingException e, EventHandler eventHandler) {
+ private static void maybeReportErrorAboutMissingEdge(
+ Target target, Label depLabel, NoSuchThingException e, EventHandler eventHandler)
+ throws InterruptedException {
if (e instanceof NoSuchTargetException) {
NoSuchTargetException nste = (NoSuchTargetException) e;
if (depLabel.equals(nste.getLabel())) {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTraversalFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTraversalFunction.java
index 1852793e70..0a85af09be 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTraversalFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TransitiveTraversalFunction.java
@@ -29,10 +29,8 @@ import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.ValueOrException2;
-
import java.util.Collection;
import java.util.Map.Entry;
-
import javax.annotation.Nullable;
/**
@@ -117,7 +115,7 @@ public class TransitiveTraversalFunction
@Override
TargetMarkerValue getTargetMarkerValue(SkyKey targetMarkerKey, Environment env)
- throws NoSuchTargetException, NoSuchPackageException {
+ throws NoSuchTargetException, NoSuchPackageException, InterruptedException {
return TargetMarkerFunction.computeTargetMarkerValue(targetMarkerKey, env);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusFunction.java
index 4cd9099ec2..12b36a4a31 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusFunction.java
@@ -25,7 +25,7 @@ public class WorkspaceStatusFunction implements SkyFunction {
}
@Override
- public SkyValue compute(SkyKey skyKey, Environment env) {
+ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
Preconditions.checkState(
WorkspaceStatusValue.SKY_KEY.equals(skyKey), WorkspaceStatusValue.SKY_KEY);