-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Implicit dependency fallback when a subproject wrap or dir exists #6902
Conversation
a818473
to
783b779
Compare
For the record, I filed this MR for glib to override every dependency it provides: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1441. |
fb8f31e
to
84bd6eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think provide
should not be in the wrap-* section in the wrap file. Although it needs to be in the wrap file to discover the needed subproject to download, i think it's not itself related to the way to download the subproject.
Also having this in a different section would allow having a file in the actual sub project that contains this information without conflating that information with wrap download information.
bdd5623
to
6e05017
Compare
1ea6a0a
to
73b7044
Compare
Agreed, I changed to have its own
That means that |
96f101e
to
6a87b0c
Compare
92beca3
to
8a0ca13
Compare
@textshell @jpakkane CI failure is unrelated, this is ready for review/merge. |
@textshell following our IRC discussion, I added 2 commits to this PR. The 1st adds The 2nd patch ensures that every dependencies provided by a wrap file are overriden when we used the fallback for one of them. |
47ce698
to
cf9d9a3
Compare
While at it, I also added fallback for find_program() now that we have a mechanism for wrap files to tell which program it provides. |
CI fails because it requires #7002 I think. |
This pull request introduces 1 alert when merging 984dd2f into 49a9742 - view on LGTM.com new alerts:
|
01f8153
to
ed2bcd3
Compare
@textshell check the last 2 commits I added in this PR, I think it should be enough to replace |
One thing that comes to mind is that if both override and the variable name in the wrap file is defined then they should point to the same object. If they don't it should be a hard error. IIRC there is some code for this but does it work in this case also? Maybe there should be a failing test for this here. |
If the subproject does:
And your wrap has:
It will be catched in verify_fallback_consistency() method and raise exception. Would make sense to add a failing test for that indeed. |
9f6afe2
to
b72255c
Compare
@jpakkane failing unit test added. |
⚔️ conflicts in docs. But apart from that looks good. I was never happy with the way fallbacks were defined but could not come up with a proper solution. Looking at this now just makes me want to slap my forehead and go "yes, of course this is how it should have been done". Once this is in we might even consider deprecating the fallback kwargs after a few releases. |
The value for that key must be a coma separated list of dependecy names provided by that subproject, when no variable name is needed because the subproject uses override_dependency().
This fix the following common pattern, we don't want to implicitly fallback on the first line: foo_dep = dependency('foo', required: false) if not foo_dep.found() foo_dep = cc.find_library('foo', required : false) if not foo_dep.found() foo_dep = dependency('foo', fallback: 'foo') endif endif
We don't need the legacy variable name system as for dependency() fallbacks because meson.override_find_program() is largely used already, so we can just rely on it.
It makes the code cleaner to have 3 separate dictionaries for packagename, dependency and programs.
Dependency 'foo' is overriden with 'foo_dep' so using fallback variable name 'bar_dep' should abort.
@textshell thanks a lot for your time spent on the review. I'm glad we made it for the release, but if you still had something to add we can always do a follow-up PR. Now that this is merged, I rebased #6968 for 0.56 release. |
My main worry is that auto fallback might trigger fallback behavior which might be stricter than i initially expected and might block some usage as subproject possibly. But i can't really say without looking some time at the code again specially with this as focus. |
No description provided.