From 1673b5ab20f79d010340383f8df21d2968c46888 Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Wed, 6 Sep 2017 14:05:26 +0200 Subject: Returns repository does not exists when referring to a bind rule... ...or any other non repository rule. Using a bind rule as the name of the repository was returning a strange error "could not find handler for bind rule" which was not useful, so was replaced by a crash. Fixes #3664 Change-Id: Id0711470e6a1ab9267e05eb273900b18d0a27d6b PiperOrigin-RevId: 167706825 --- .../build/lib/rules/repository/RepositoryDelegatorFunction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java index a14800870d..6f6573e0f1 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java @@ -27,7 +27,6 @@ import com.google.devtools.build.lib.skyframe.FileValue; import com.google.devtools.build.lib.skyframe.PrecomputedValue; import com.google.devtools.build.lib.skyframe.PrecomputedValue.Precomputed; import com.google.devtools.build.lib.skyframe.SkyFunctions; -import com.google.devtools.build.lib.syntax.EvalException; import com.google.devtools.build.lib.util.Fingerprint; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.Path; @@ -122,6 +121,7 @@ public final class RepositoryDelegatorFunction implements SkyFunction { if (rule == null) { return null; } + RepositoryFunction handler; if (rule.getRuleClassObject().isSkylark()) { handler = skylarkHandler; @@ -129,8 +129,8 @@ public final class RepositoryDelegatorFunction implements SkyFunction { handler = handlers.get(rule.getRuleClass()); } if (handler == null) { - throw new IllegalStateException( - new EvalException(rule.getLocation(), "Could not find handler for " + rule)); + // If we refer to a non repository rule then the repository does not exist. + return RepositoryDirectoryValue.NO_SUCH_REPOSITORY_VALUE; } handler.setClientEnvironment(clientEnvironment); -- cgit v1.2.3