Local Repository and bind in WORKSPACE

17 views
Skip to first unread message

ili...@luminatewireless.com

unread,
Feb 24, 2017, 3:38:20 PM2/24/17
to grpc.io
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

Nicolas Noble

unread,
Feb 24, 2017, 4:59:22 PM2/24/17
to ili...@luminatewireless.com, grpc.io
This is a bit more of a Bazel question than a gRPC question. I don't see anything from from your code fragment however, and I'm not aware of anything that could cause bazel to crash like you are reporting. This is basically how we handle our dependencies. See gflags for instance:


--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/4ddb1266-1190-475a-9118-b5088474637c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ilina Mitra

unread,
Feb 24, 2017, 5:13:25 PM2/24/17
to Nicolas Noble, grpc.io
Ok thanks for the quick reply and the examples! I'll follow up with Bazel.
Reply all
Reply to author
Forward
0 new messages