java-control-plane
java-control-plane copied to clipboard
Migrate build system to bazel
(basing this on #2)
What are people's thoughts on migrating this repo to use bazel instead of maven? Not only would it match the build tooling that envoy uses, but it would also simplify the problem of importing the necessary protos, as we'd be able to depend on data-plane-api instead of copying all the protos into this repo. Bazel also has fairly good native support for Java and the IJ plugin works well for small repos.
Thoughts? I'd be happy to put in the work to move it over (I have some experience migrating java repos to bazel), but I'd like to know where we stand on this before starting that work.
I'm not opposed to using Bazel, but there are definitely some trade-offs. Bazel doesn't have any tooling yet for publishing Maven artifacts. There is some prior art for how to do that with Bazel, but the approaches that I've seen have all been really hacky.
My gut reaction would be to stick with Maven for now because I don't think the value add of being able to reference the data-plane-api repo is enough to compensate for the complexity that Bazel adds, but if you feel super strongly about it then feel free to put together a PR and we can look into it further.
Yeah I'm well aware of the limitations when it comes to uploading artifacts, so yeah it might be smarter to hold off for now. I'm also not sure if it's easy to integrate other features provided by mvn plugins like checkstyle.
I might give it a shot this weekend to see how it pans out, if only for my own amusement.
AFAIK, there are no existing rules for checkstyle, but it should be fairly straightforward to just create a custom genrule for it. I know that Bazel has some support for code coverage, but I haven't tried to use it yet. Outside of figuring out releases and getting the java_proto_library stuff setup, those should really be the only must-haves for moving to Bazel.
Yeah I think it’s definitely feasible. Turns out data-plane-api doesn’t actually expose the proto libraries in a way that java_proto_library can consume them (due to visibility rules). I’ve filed an issue to figure out to proceed on that front, so before that there’s not much point in using bazel.
My gut reaction would be to stick with Maven for now
:+1:
Turns out data-plane-api doesn’t actually expose the proto libraries in a way that java_proto_library can consume them (due to visibility rules). I’ve filed an issue
I'm curious what problem you had. Can you reference the issue you had?
What about gradle? :D Gradle is a pretty flexible thing and can embedd some code to pull everything we need before the build
I would only consider switching build systems if it makes protobuf updates easier / more automated. If you have time feel free to submit a PR.