Hooks for generating BUILD files?

219 views
Skip to first unread message

ms...@dropbox.com

unread,
Dec 14, 2015, 6:17:08 PM12/14/15
to bazel-discuss
Hi Bazelites,

I was wondering if there is any way to hook in a BUILD file generator or dynamic rule-writer to bazel itself.

I currently generate the dependencies of Python and Go with small tools that emits BUILD files. Naturally this could be done in some sort of wrapper script, but I wondered if there is a better way to do with inside Bazel/Skylark itself.

I thought I had heard of some plan to implement such a thing, but I haven't seen any documentation that proves it wasn't all a dream I had.

Thanks,
-Mike


Damien Martin-guillerez

unread,
Dec 15, 2015, 4:01:52 AM12/15/15
to ms...@dropbox.com, bazel-discuss

--
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/89eebf3f-7771-48e8-a8f4-26109e5a6dee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

actionspe...@gmail.com

unread,
Dec 15, 2015, 7:14:36 AM12/15/15
to bazel-discuss
Hi - I'm sorry, I don't have an answer for you. But I'm looking at the possibility of introducing bazel at work and was considering doing something like you describe for our python and javascript dependencies. Would you mind sharing a little more of the solution you've been working with? Is it consuming a requirements.txt file (for pip installed python deps?)


Sorry to barge on, feel free to ignore.

Anthony

Han-Wen Nienhuys

unread,
Dec 15, 2015, 7:57:33 AM12/15/15
to ms...@dropbox.com, bazel-discuss
I don't think there is a plan. Inside google, there are language
specific tools which generate/update BUILD files for certain
languages.
> --
> 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/89eebf3f-7771-48e8-a8f4-26109e5a6dee%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Han-Wen Nienhuys
Google Munich
han...@google.com

Mike Solomon

unread,
Dec 15, 2015, 1:36:20 PM12/15/15
to Han-Wen Nienhuys, bazel-discuss
I should have been more clear. At Google, if you want to build some Go code, you used to a run "glaze" to emit a series of generated BUILD files.  I have basically written "gazel" and the missing piece is that during development, it's inconvenient to re-run glaze/gazel by hand and makes the workflow more cumbersome for Go folks who are used to the open source workflow.

Writing a tiny wrapper program to Blaze isn't my first choice, but if the rest of the team feels strongly, it feels like that's my only option at this point.



Han-Wen Nienhuys

unread,
Dec 15, 2015, 1:39:40 PM12/15/15
to Mike Solomon, bazel-discuss
Inside google, it's hooked into the editors' save function. You could try that.

Mike Solomon

unread,
Dec 15, 2015, 1:41:06 PM12/15/15
to actionspe...@gmail.com, bazel-discuss
I have a series of skylark rules the encapsulate relocatable python modules. This basically takes python code/shared libraries and creates a zip file that is treated as an intermediate file. When a binary or test target is compiled, these intermediate zip files are exploded into runfiles in a special location. A couple of helper binaries take care of pulling and verifying pip code and statically linking C/C++ dependencies.

It's important to note that the rules that ship with Bazel for python are not hermetic and not particularly useful. There is a good bit of non-trivial work to get it functioning, but it's really starting to pay dividends.

--
You received this message because you are subscribed to a topic in the Google Groups "bazel-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bazel-discuss/IBK6CnURb_k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/65d0566a-d0bf-46fc-9c16-a3743cd3a3ab%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages