google / go-jsonnet

Apache License 2.0
1.63k stars 235 forks source link

feat: Add support for bzlmod #698

Closed mortenmj closed 1 year ago

mortenmj commented 1 year ago

This PR adds a MODULE.bazel file which allows other repositories to import this one as a bzlmod module. I don't know how Google handles publishing to the Bazel Central Registry, so I haven't made any attempt at that.

This is ready for review, but not for merging, pending https://github.com/google/jsonnet/pull/1083 which adds bzlmod support for jsonnet. Jsonnet would need to be added to the Bazel Central Registry for this PR to be merged, as bzlmod does not allow importing modules that use overrides (such as git_override used here).

Update: Jsonnet has been merged into BCR, so this can move forward.

coveralls commented 1 year ago

Coverage Status

coverage: 68.493% (-0.02%) from 68.512% when pulling f237f4dfe22a6c194dfe2eef35323c0abb1ed21b on mortenmj:bzlmod into 868d9c6f114d88bd77d5329e45ca605759c4a0d3 on google:master.

sparkprime commented 1 year ago

LGTM

sparkprime commented 1 year ago

Is there any documentation that needs to be updated in either repo?

sparkprime commented 1 year ago

(Either for people using this or maintaining it)

mortenmj commented 1 year ago

@sparkprime I am not aware of any documentation that goes into how to import jsonnet/go-jsonnet into a WORKSPACE, but I'd suggest adding similar documentation for using MODULE.bazel.

I think it could be a good idea to add a test that shows how this works. This could then also be used in the BCR presubmit.yml, which would add some confidence that we don't break things in the future. Here's an example of what that might look like: https://github.com/protocolbuffers/protobuf/tree/main/examples https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/protobuf/3.19.6/presubmit.yml

mortenmj commented 1 year ago

@sparkprime could we merge this?