aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/apple
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/apple
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/apple')
-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
2 files changed, 45 insertions, 40 deletions
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) {