Unable to find toolchains in a newly defined module

44 views
Skip to first unread message

Connor Latham

unread,
Mar 6, 2024, 6:17:21 AMMar 6
to bazel-discuss
Hey yall, trying to get some bazel rules spun up for Apple's new config language pkl, and I'm having quite a hard time. Anyone mind taking a look? I wrote up my issue on stack exchange https://stackoverflow.com/q/78113876/14227639.

Appreciate any and all feedback. 

Connor

David Turner

unread,
Mar 10, 2024, 5:16:24 PMMar 10
to Connor Latham, bazel-discuss
I think you need to call `pkl.toolchain(...)` before `use_repo(pkl, "pkl")` otherwise the latter will just generate an empty repository.

Also it looks like you are missing a `platform_name` attribute definition in your `toolchain` tag definition, so your `toolchains()` function is going to error at runtime if you call it as-is. You could try using module_ctx.os values to determine this automatically though.

Hope this helps

--
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/7cb921b4-5a3c-4f6e-85e9-3941f48d3aa7n%40googlegroups.com.

Xudong Yang

unread,
Mar 11, 2024, 2:50:51 PMMar 11
to David Turner, Connor Latham, bazel-discuss
FWIW, the order of `use_repo` directives relative to other directives in MODULE.bazel files is not meaningful at all. You can put it anywhere and the result would be the same. (The module extension is only evaluated once with _all_ tags anyway.)

Reply all
Reply to author
Forward
0 new messages