nlohmann / json

JSON for Modern C++
https://json.nlohmann.me
MIT License
41.3k stars 6.58k forks source link

chore(bazel): add MODULE.bazel files for bzlmod #4314

Open mmorel-35 opened 3 months ago

mmorel-35 commented 3 months ago

[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]

Integrate MODULE.bazel from https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/nlohmann_json Then it shall be possible to publish automatically with the new version with the help of bcr bot : https://github.com/bazelbuild/bazel-central-registry/blob/main/docs/README.md#contribute-a-bazel-module


Pull request checklist

Read the Contribution Guidelines for detailed information.

Please don't

nlohmann commented 3 months ago

Is adding file MODULE.bazel really necessary?

mmorel-35 commented 3 months ago

To my understanding this will at least avoid generate a patch file every time a new release is published to the BCR.

Having this file in the repository seems to be a trouble, can you explain why ?

nlohmann commented 3 months ago

I personally do not maintain any of the package manager integrations. Hence I am reluctant to having these files in the repository.

coveralls commented 3 months ago

Coverage Status

coverage: 100.0%. remained the same when pulling 94bcdb44afb8ee402b640d6f91891da5e105df42 on mmorel-35:bzlmod into 199dea11b17c533721b26249e2dcaee6ca1d51d3 on nlohmann:develop.

mmorel-35 commented 3 months ago

@Vertexwahn did the configuration in the BCR maybe he has an opinion on that. Maybe MODULE.bazel shall even replace WORKSPACE.bazel

Vertexwahn commented 3 months ago

@mmorel-35 I proposed to add a MODULE.bazel file to this repo already here -> https://github.com/nlohmann/json/pull/4111

I personally would suggest to add a MODULE.bazel it to this repo since this makes life with Bazel easier (no patch at BCR, usage without a BCR is easier, etc.)

In the current state of Bazel (7.x) we need a WORKSPACE/WORKSPACE.bazel (which can be empty) and a MODULE.bazel file. The empty WORKSPACE/WORKSPACE.bazel is there only for legacy reasons - in the future this file will not be needed anymore.

Currently, we are in a transition phase from Bazel 7 -> 8 (maybe end of this year) -> 9 (maybe end of next year) - i.e. it will take some time until we can remove the WORKSPACE file.

@nlohmann For me it seems that there are people around that care about the Catch2 Bazel support. You have the cost of having one additional Bazel related file vs. a community of Bazel users that can easier pick Catch2 for the development of their own projects + Avoid this discussion in the future ;) - anyways it your decision - close the PR if you do not want to have more Bazel files ;)