alibaba / hessian2-codec

hessian2-codec it is a complete C++ implementation of hessian2 spec
Apache License 2.0
26 stars 9 forks source link

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

Closed mmorel-35 closed 1 month ago

mmorel-35 commented 4 months ago

Signed-off-by: Matthieu MOREL matthieu.morel35@gmail.com

CLAassistant commented 4 months ago

CLA assistant check
All committers have signed the CLA.

Lynskylate commented 3 months ago

Thank you very much for your contribution, but it seems that ci did not pass. I will check the reason why ci failed, but it may take a while.

cc @zyfjeff

Lynskylate commented 2 months ago

I test it on my computer, and it appears that the reason for the build demo failure is due to refresh_compile_commands being defined in the BUILD file. When hessian2-codec as a module import, it can't load the dependency.

ERROR: error loading package '@@hessian2-codec~//': Unable to find package for @@[unknown repo 'hedron_compile_commands' requested from @@hessian2-codec~]//:refresh_compile_commands.bzl: The repository '@@[unknown repo 'hedron_compile_commands' requested from @@hessian2-codec~]' could not be resolved: No repository visible as '@hedron_compile_commands' from repository '@@hessian2-codec~'.

After I removed the refresh_compile_commands in the BUILD file, it can build success.

mmorel-35 commented 2 months ago

Let's keep this a draft until this https://github.com/bazelbuild/bazel-central-registry/pull/1989 is merged

Lynskylate commented 2 months ago

Thank you very much.

mmorel-35 commented 2 months ago

@Lynskylate , that’s ready for your review. There won’t be any change concerning hedron_compile_commands

Lynskylate commented 2 months ago

git-override implict do same action as dev_dependency.

This directive only takes effect in the root module; in other words, if a module is used as a dependency by others, its own overrides are ignored.

This is also the reason why it fails to load refresh_compile_commands in the demo.

I am still reading the documentation on dev dependencies to see if I should consider loading that target only when in dev dependency mode.

mmorel-35 commented 2 months ago

I created this : https://github.com/bazelbuild/bazel-central-registry/pull/2054

I believe adding to the BCR is going to become a necessity.

Lynskylate commented 2 months ago

I may not have been clear. Because hessian2-codec, as a module, depends on hedron_compile_commandsand also uses git_override to override this module. Therefore, when the demo module depends on the hessian2-codec module, the demo cannot find the hedron_compile_commandsand that the Hessian module depends on.

So if we want to fix the error, Perhaps we could first simply remove the refresh_compile from the hessian2-codec BUILD.

Lynskylate commented 2 months ago

And i have test the different version bazel for the build, it can build in bazel 6.0 but can't work in bazel 7.0+.

mmorel-35 commented 2 months ago

Perhaps we could first simply remove the refresh_compile from the hessian2-codec BUILD.

It can be removed if you don't need it but if https://github.com/bazelbuild/bazel-central-registry/pull/2055 get merged we shall be able to make things works.

mmorel-35 commented 1 month ago

@Lynskylate, can you retry? This follows @cpsauer's preconisation

Lynskylate commented 1 month ago

I apologize for not responding promptly. I have tested before, and there might be some issues with calculating coverage after migrating to the module. We can merge this PR first, and then I will create another PR to fix this issue.

Lynskylate commented 1 month ago

@zyfjeff @wbpcode If you have no objections, I will merge this pull request first, and then create another pull request later to fix the issues.

The current compilation parameters under the demo will cause a failure, and in addition to this, there is also an incompatibility with coverage.

You could see the action detail. https://github.com/Lynskylate/hessian2-codec/actions/runs/9139284705/job/25131395468

Lynskylate commented 1 month ago

@mmorel-35 Thanks for your contribution.