Hello! I'm interested in the state of and future roadmap of BUILD file generation. We have an existing Bazel monorepo with Java, Scala, Python, Go, JavaScript, and Protobuf. We've grown weary of manually maintaining BUILD files, especially during large refactorings, where the double-accounting of, say, Java imports and deps entries can be time consuming and error-prone.
The ideal user interface we would like is something that runs in the background creating, updating, and editing BUILD files and removing 90+% of the manual maintenance required. Certain actions, like changing visibility and adding runtime dependencies, would still require manual updates to BUILD files, but mechanical changes like mapping new imports to a first or third-party dependency would be automated. The second best user interface would be a manual generate command that needs to run when changes requiring BUILD file modifications occur.
Before we write our own custom tool for solving this, we're curious to know:
How have others solved the problem?
Is there a plan to have a standard mechanism within the Bazel project for BUILD file generation?
If not, what's the best foundation or set of patterns to build on?
Going through some of the prior art, there is:
Gazelle - which has an extension mechanism, but seems to require extensions to be written in Go.
Wix's Autodep -- Looks really great, but not OSS (yet?).
bzlgen -- Written in TypeScript, has nice coverage for the JS ecosystem.
BUILD_file_generator -- promising but archived.
tools_jvm_autodeps -- also promising but archived.
Dropbox talk at BazelCon 2018 - Benjamin's hilarious overview of their BUILD file generation.
Any pointers would be much appreciated! Thanks.
Gregg Donovan
Senior Staff Software Engineer, Etsy.com
Hello! I'm interested in the state of and future roadmap of BUILD file generation. We have an existing Bazel monorepo with Java, Scala, Python, Go, JavaScript, and Protobuf. We've grown weary of manually maintaining BUILD files, especially during large refactorings, where the double-accounting of, say, Java imports and deps entries can be time consuming and error-prone.
The ideal user interface we would like is something that runs in the background creating, updating, and editing BUILD files and removing 90+% of the manual maintenance required. Certain actions, like changing visibility and adding runtime dependencies, would still require manual updates to BUILD files, but mechanical changes like mapping new imports to a first or third-party dependency would be automated. The second best user interface would be a manual generate command that needs to run when changes requiring BUILD file modifications occur.
Before we write our own custom tool for solving this, we're curious to know:
How have others solved the problem?
Is there a plan to have a standard mechanism within the Bazel project for BUILD file generation?
If not, what's the best foundation or set of patterns to build on?
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/1ed7207b-65fa-4846-ade8-61357539b7c5n%40googlegroups.com.
I'm a little surprised at this discussion because I thought one of the premises of having everything explicit in BUILD files with a functional-ish build system was that automagically generating dependencies during the build - even if done with compiler output - is fragile and detrimental to correctness and repeatability. And, thus, the pain of maintaining BUILD files is just one of things that's given with Bazel against which you have all the other benefits. Yuval mentions doing this kind of generation to facilitate a migration, which is very reasonable, but I get the impression the rest of this discussion is going in the direction of auto-generation of BUILD files all the time.Purpose of this post: To find out if my understanding of this is correct, vis-à-vis Bazel. Thanks! -- David