-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Support MODULE.bazel #2781
Support MODULE.bazel #2781
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## devel #2781 +/- ##
==========================================
+ Coverage 91.51% 91.52% +0.01%
==========================================
Files 198 198
Lines 8243 8243
==========================================
+ Hits 7543 7544 +1
+ Misses 700 699 -1 |
Marking @Vertexwahn @horenmar, as they last changed WORKSPACE.bazel file ;) |
@igormcoelho For me the change is fine. Maybe you can run buildifier on ’MODULE.bazel’. Also using the newest Skylib (1.5.0) would make sense. |
Sure, why not. |
Thanks a lot @Vertexwahn and @horenmar !
I chose 1.4.2 because it's the current version on WORKSPACE... I think that future upgrades should keep them both in same version, so if one migrates to 1.5.0, both should migrate.
Best regards! |
For more information (for future devs coming here), I just tried here the two following setups:
And then:
Then I force in my project 1.5.0:
Then it automatically chooses 1.5.0 for catch2:
So, I guess, at least for non-major improvements in skylib (1.X.X), it's irrelevant what is put here as dependency :) |
Description
First of all, I love Catch2 library! And I also love Bazel Build... recently (today dec, 12 2023) the Bazel team launched version 7.0.0, that now began the process to force all users to abandon legacy WORKSPACE pattern into a newer MODULE.bazel pattern.
To be short, the changes I'm proposing are only two lines of code and a new file named MODULE.bazel, and this makes Catch2 compatible with Bzlmod system. The file is the following:
The good thing is that it manages so much better the bazel_skylib dependency currently on WORKSPACE:
So, this won't be necessary in the future (for now, it's best to keep both ways).
The MODULE system is better, because it allows transitive dependencies, meaning that users won't suffer by not having the skylib dependency (it will be downloaded automatically, what does not happen today!).
Detailed Example for Legacy (today)
Noways, users do the following. On their WORKSPACE, they put:
And then, the users may consume the target
@catch2//:catch2_main
normally.Detailed Example for Proposal (modules system)
With these two lines, users do the following. On their MODULES.bazel, they put:
And then, the users may consume the target
@catch2//:catch2_main
normally (no need to load dependency skylib, unless they really need it).What if this PR is not accepted
Nowadays, users can only use Legacy WORKSPACE system, because the remote repository needs to have the MODULE.bazel file... I tried to workaround this, but it' not possible... So, it's two lines and a file that will help and simplify the life of a lot of people.
GitHub Issues
This PR is very simple, so it can be discussed here, if you find it valuable for Catch2 (please accept it!!!).