Reputation: 269
Is is possible to associate bazel targets with specific toolchains/platforms?
I would like to bazel build ...
and have bazel build the same cc_library for a number of different target architectures. And also to skip some targets for specific target architecutes.
Obviously I can achieve this this if I run bazel several times with different flags and tag the tests to be ignored. But it is not very convenient.
Upvotes: 2
Views: 2287
Reputation: 360
You can use Bazel transitions
to force a target to build with a specific configuration.
https://docs.bazel.build/versions/master/skylark/lib/transition.html
In terms of skipping particular targets, it depends on the nature of your dependency graph. The simplest approach would be to use a select
statement to not build certain dependencies.
See https://docs.bazel.build/versions/master/be/functions.html#select
Upvotes: 1
Reputation: 9679
Unless something had recently changed, I am afraid you are (at least at the moment) out of luck on this one. My understanding of the documentation (and recollection of when I was poking around this area) is that bazel will in the end match one (or no) toolchain for a given toolchain type (and in case of multiple possible matches pick the first one in the list). Hence you won't be able to define one rule for one target matching multiple toolchains for a given single build.
Upvotes: 2