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

Bzlmod support #50

Merged
merged 11 commits into from
Jun 17, 2024
Merged

Conversation

jacobshirley
Copy link
Contributor

Hi there, I'm not sure if this is the best-practice way to implement bzlmod, but it does seem to work. Any feedback welcome. I've created a test for it in e2e/ so that the MODULE.bazel is different to the root one like the examples/ have; but I can move to examples/ if that would be better.

@thesayyn
Copy link
Collaborator

Hey, it looks close, I'll take a look next week.

Copy link
Collaborator

@thesayyn thesayyn left a comment

Choose a reason for hiding this comment

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

This looks great! A few nits.

e2e/bzlmod/BUILD.bazel Outdated Show resolved Hide resolved
@jacobshirley
Copy link
Contributor Author

Those tests are now combined, I had to delete the WORKSPACE.bzlmod file in e2e/smoke because it seems that the dependencies of rules_distroless are managed by the MODULE.bzl, so with that WORKSPACE.bzlmod file it would complain that it could not find certain dependencies (e.g. rules_oci)

Comment on lines +55 to +64
# Get the package name with either bzlmod enabled or disabled
package_name = rctx.attr.name.split("~")[-1]

package_defs = [
'"""Generated by rules_distroless. DO NOT EDIT."""',
"""load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")""",
"",
"",
"# buildifier: disable=function-docstring",
"def {}_packages():".format(rctx.attr.name),
"def {}_packages():".format(package_name),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also had to get the last component of the path, as otherwise it would put ~ in the function name and then error: syntax error at '~': expected (

Copy link
Collaborator

@thesayyn thesayyn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@thesayyn thesayyn merged commit 9da4ee5 into GoogleContainerTools:main Jun 17, 2024
7 checks passed
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.

2 participants