Hi there,
I've set up a local_repository in our WORKSPACE file, and would like to leverage bind to prevent having to change the BUILD files.
From the documentation, it seems I should be able to do something like the following:
bind(
name = "grpc",
actual = "@grpc//:grpc",
)
local_repository(
name = "grpc",
path = "third_party/google/grpc",
)
And the BUILD dependency should become: "//external:grpc" whereas it was previously "//third_party/google/grpc:gprc".
However, if I try to do this, I hit the following exception:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURED_TARGET://lb:ip-forwarder-main eeab51cc7d46801c1a05a5f646430553 (936318221 375452941)' (requested by nodes 'CONFIGURED_TARGET://lb/testing:ip_forwarder_test eeab51cc7d46801c1a05a5f646430553 (1211325356 375452941)')
at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:438)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:501)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper.get(NonconfigurableAttributeMapper.java:45)
at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.isTestOnlyRule(BazelRuleClassProvider.java:266)
at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validateDirectPrerequisiteForTestOnly(BazelRuleClassProvider.java:252)
at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validate(BazelRuleClassProvider.java:196)
at com.google.devtools.build.lib.analysis.RuleContext$Builder.validateDirectPrerequisite(RuleContext.java:1954)
at com.google.devtools.build.lib.analysis.RuleContext$Builder.createTargetMap(RuleContext.java:1626)
at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1465)
at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:245)
at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:176)
at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:491)
at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:1094)
at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:251)
at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:373)
... 4 more
Any idea why this is happening? What is the right way to use bind to refer to the local_repository? I know I can refer to the local_repository directly from the BUILD files using "@grpc//:grpc", but I'm trying to avoid having to do this.
Thanks,
Ilina