typedb-driver and typedb-protocol builds have been broken after a recent ts rules update because of the updated aspect_bazel_lib dependency.
To fix the current issue and prevent its reproduction, we add a universal aspect_bazel_lib dependency with a specific version, which is maximal for all the dependent rules in dependencies. This dependency should be explicitly declared before using any rule that depends on aspect_bazel_lib of any version and updated every time a rule uses a newer version of it as its dependency.
What are the changes implemented in this PR?
We add a universal aspect_bazel_lib macro with a single http_archive call for this dependency. We also add invocations of this macro for all the rules' dependencies that depend on aspect_bazel_lib. It lets us not worry about the relative order of these rules declarations in WORKSPACEs as only the aspect_bazel_lib()'s version will be used for all these rules.
The fix works because Bazel uses the first declaration of a dependency. This way, if we have multiple http_archives of aspect_bazel_lib, only the first one is used for every rule depending on it.
It can be a problem if this common dependency becomes not backward-compatible and we cannot make all of our dependent rules use a single version. However, everything is fine while it works.
A similar approach can be used for any other common dependency if we face such issues in the future.
What is the goal of this PR?
typedb-driver
andtypedb-protocol
builds have been broken after a recentts
rules update because of the updatedaspect_bazel_lib
dependency.To fix the current issue and prevent its reproduction, we add a universal
aspect_bazel_lib
dependency with a specific version, which is maximal for all the dependent rules independencies
. This dependency should be explicitly declared before using any rule that depends onaspect_bazel_lib
of any version and updated every time a rule uses a newer version of it as its dependency.What are the changes implemented in this PR?
We add a universal
aspect_bazel_lib
macro with a singlehttp_archive
call for this dependency. We also add invocations of this macro for all the rules' dependencies that depend onaspect_bazel_lib
. It lets us not worry about the relative order of these rules declarations inWORKSPACE
s as only theaspect_bazel_lib()
's version will be used for all these rules.The fix works because Bazel uses the first declaration of a dependency. This way, if we have multiple
http_archive
s ofaspect_bazel_lib
, only the first one is used for every rule depending on it.It can be a problem if this common dependency becomes not backward-compatible and we cannot make all of our dependent rules use a single version. However, everything is fine while it works.
A similar approach can be used for any other common dependency if we face such issues in the future.
An example of a fixed build for protocol