Skip to content
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

feat: add a module extension for http_archive #341

Closed
wants to merge 1 commit into from

Conversation

kormide
Copy link
Collaborator

@kormide kormide commented Jan 18, 2023

There is a rules_js e2e I want to convert to bzlmod that uses http_archive in the WORKSPACE file. I could just use a workspace file alongside a MODULE.bazel file, but I thought of doing this. Wdyt?

Related to bazelbuild/bazel#17141.


# Extension that can declare http repository rules, until there's a better way:
# https://github.com/bazelbuild/bazel/issues/17141
http = module_extension(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little gross, but comments on that issue from Keith make me think that someone has to have that code somewhere, so bazel-lib is the best place we have.

@fmeum do you have any opinion about it?

Copy link
Member

@fmeum fmeum Jan 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please don't do it :-) It suggests that something works that is inherently broken: The names provided to the extension tag need to be globally unique, which they will be in small projects and then break when composed with other modules.

It's fine if someone builds this for their own module (and thus have the generated repos scoped under this one-off extension), but having it available in a general purpose skylib-like library makes it more likely these collisions will happen in practice and break the "strict deps" promise of Bzlmod.

I think that we should just accept the overhead of wrapping a bunch of http_archives in a macro and making it a module extension for now and wait for a resolution to bazelbuild/bazel#17141.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants