diff options
author | 2016-05-23 17:39:42 +0000 | |
---|---|---|
committer | 2016-05-24 11:56:43 +0000 | |
commit | 4dfb22c4bad3dfa4dba46426c8587c0aa148d8d9 (patch) | |
tree | 5b09b10bef0e0ca634d237af86b6e9da7160f846 /src/main/java/com/google/devtools/build/lib/rules/objc/IosDevice.java | |
parent | fe206a490a2aa48c789c0edd35383407f44bc49b (diff) |
Allow use of Exceptions to exit early out of configured-target creation, instead of passing and checking null in all helpers.
Demonstrates this pattern usage in a few select rules (e.g. AndroidBinary) where this was particularly egregious.
There are many places which can benefit from this pattern -- this change doesn't try to fix them all at once.
--
MOS_MIGRATED_REVID=123012378
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/IosDevice.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/IosDevice.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosDevice.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosDevice.java index 97bfa97960..1e3ad31586 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosDevice.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosDevice.java @@ -22,6 +22,7 @@ import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode; import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.RunfilesProvider; +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.apple.AppleConfiguration; import com.google.devtools.build.lib.rules.apple.DottedVersion; @@ -33,7 +34,8 @@ import com.google.devtools.build.lib.rules.apple.XcodeVersionProperties; */ public final class IosDevice implements RuleConfiguredTargetFactory { @Override - public ConfiguredTarget create(RuleContext context) throws InterruptedException { + public ConfiguredTarget create(RuleContext context) + throws InterruptedException, RuleErrorException { AppleConfiguration appleConfiguration = context.getFragment(AppleConfiguration.class); String iosVersionAttribute = context.attributes().get(IosDeviceRule.IOS_VERSION_ATTR_NAME, STRING); |