aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/filegroup
diff options
context:
space:
mode:
authorGravatar Chris Parsons <cparsons@google.com>2016-05-23 17:39:42 +0000
committerGravatar Yue Gan <yueg@google.com>2016-05-24 11:56:43 +0000
commit4dfb22c4bad3dfa4dba46426c8587c0aa148d8d9 (patch)
tree5b09b10bef0e0ca634d237af86b6e9da7160f846 /src/main/java/com/google/devtools/build/lib/rules/filegroup
parentfe206a490a2aa48c789c0edd35383407f44bc49b (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/filegroup')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java b/src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java
index fb4d990fcf..cbbc0fccd6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java
@@ -27,6 +27,7 @@ import com.google.devtools.build.lib.analysis.RunfilesProvider;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
+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.test.InstrumentedFilesCollector;
import com.google.devtools.build.lib.rules.test.InstrumentedFilesCollector.InstrumentationSpec;
@@ -43,7 +44,7 @@ import java.util.Iterator;
public class Filegroup implements RuleConfiguredTargetFactory {
@Override
- public ConfiguredTarget create(RuleContext ruleContext) {
+ public ConfiguredTarget create(RuleContext ruleContext) throws RuleErrorException {
NestedSet<Artifact> filesToBuild = NestedSetBuilder.wrap(Order.STABLE_ORDER,
ruleContext.getPrerequisiteArtifacts("srcs", Mode.TARGET).list());
NestedSet<Artifact> middleman = CompilationHelper.getAggregatingMiddleman(