Peter Laird
Peter Laird

Reputation: 11

gtest dependency for Bazel java_tools build?

I am trying to follow the instructions for contributors here:

https://bazel.build/contributing.html

I have a successful build off of master (i.e. bazel build //src:bazel), but the doc suggests also "you might want to build the various tools Bazel uses." I am trying to do that, for example:

cd src/java_tools/singlejar
bazel build //...

but it fails with:

ERROR: /Users/.../bazel/third_party/protobuf/3.2.0/BUILD:621:1: no such target '//external:gtest': target 'gtest' not declared in package 'external' defined by /Users/plaird/scone/public/bazel/WORKSPACE and referenced by '//third_party/protobuf/3.2.0:test_plugin'.

Do I need to build gtest locally, and then add it to the WORKSPACE file?

Upvotes: 1

Views: 83

Answers (1)

kris
kris

Reputation: 23592

bazel build //..., no matter where you invoke it, will build everything in the project. It looks like what you probably want is bazel build //src/java_tools/singlejar/..., which will build all targets under that directory.

In general, though, you probably don't need to compile singlejar separately. I've been working on Bazel for several years and 99% of the time you don't have to build the tools separately.

In terms of the error you're getting, it would be nice if we could get //... building, but it hasn't been a huge priority. The protobuf code build is weird and I don't recommend trying to debug it, just jump into whatever you want to actually work on.

Upvotes: 1

Related Questions