aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2016-08-15 21:54:55 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-08-16 15:21:17 +0000
commit3c0adb26bac6d756fb97e4bcc6d4e5b2cefa5eeb (patch)
treec77f6438711f4b23d6c528907a81e23dc9e6dc91 /src/main/java/com/google/devtools/build/lib/rules
parent89125d5ee83f562c309a792a7c56ce24452e61ea (diff)
Allow Skyframe graph lookups and value retrievals to throw InterruptedException.
The only place we now don't handle InterruptedException is in the action graph created after analysis, since I'm not sure that will be around for that much longer. -- MOS_MIGRATED_REVID=130327770
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-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
34 files changed, 202 insertions, 186 deletions
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) {