Reputation: 923
Does Bazel support brining multiple versions of external dependency in a single workspace?
I would guess no (similar to cmake, 1 version per project/workspace), but still worth asking?
the use case is if in a large repo, one binary could have dep on version A, and another binary on version B...
Upvotes: 0
Views: 1511
Reputation: 5006
In general, Bazel doesn't have an idea of versions built in, most everything is just a target. E.g. you can have two repository rules in the WORKSPACE that point to the same thing at different versions, and Bazel just considers them as any other repos. However it's up to the developer to use the correct version with the correct targets in BUILD files, and to handle diamond dependency problems. The link in your comment (https://bazel.build/docs/external#shadowing-dependencies) shows some of the mechanisms for working with targets and repos that represent the same thing at different versions.
There's a new dependency management system called Bzlmod coming though that has versioning built in: https://bazel.build/build/bzlmod
Upvotes: 2