Skip to content

Allow bazel modules depending on rabbitmq-server to override @rbe #8753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions bazel/bzlmod/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ elixir_config = module_extension(
)

def _rbe(ctx):
root_rbe_repo_props = []
rbe_repo_props = []
for mod in ctx.modules:
for repo in mod.tags.git_repository:
Expand All @@ -106,17 +107,29 @@ def _rbe(ctx):
props["tag"] = repo.tag
if repo.branch != "":
props["branch"] = repo.branch
if not props in rbe_repo_props:
if mod.is_root:
if not props in root_rbe_repo_props:
root_rbe_repo_props.append(props)
elif not props in rbe_repo_props:
rbe_repo_props.append(props)

if len(rbe_repo_props) > 1:
fail("Multiple definitions for @rbe exist: {}".format(rbe_repo_props))
if len(root_rbe_repo_props) > 1:
fail("Multiple definitions for @rbe exist in root module: {}".format(rbe_repo_props))

if len(rbe_repo_props) > 0:
if len(root_rbe_repo_props) > 0:
git_repository(
name = "rbe",
**rbe_repo_props[0]
**root_rbe_repo_props[0]
)
else:
if len(rbe_repo_props) > 1:
fail("Multiple definitions for @rbe exist: {}".format(rbe_repo_props))

if len(rbe_repo_props) > 0:
git_repository(
name = "rbe",
**rbe_repo_props[0]
)

git_repository_tag = tag_class(attrs = {
"remote": attr.string(),
Expand Down