-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Deprecate meson.build_root() and meson.source_root() #7772
Conversation
Those function are common source of issue when used in a subproject because they point to the parent project root which is rarely what is expected and is a violation of subproject isolation.
On IRC it was suggested to add What does others think? |
@jpakkane what do you think? |
One problem in adding new API is it force projects to depend on latest meson to get ride of a deprecation warning, while current_source_dir() is available for a long time already (it has no "since" annotation). |
If the feature addition goes in at the same time, I don't think it's a problem as the feature is available at the point of deprecation.... ? To me it seems like a candidate to have these project specific variables defined, But that's purely as a convenience I guess. So if 'I' need it, I would assume it is needed elsewhere ... ? |
I guess an alternative is to make meson.build_root() and meson.source_root() relative to the current project - but I guess that could cause further implications as it becomes a change of definition. I don't know what use cases a subproject would want to access a parent project - as I assume it shouldn't know about the parent project at all... so that makes me believe build_root() and source_root() should always be project relative? (but I there's a lot I don't know on this) |
I'm also tempted to change behavior of meson.build_root(), but from experience people does all kind of crazy hacks with their build system, there are chances it backfires at us, IMHO. Better not taking risks when alternative is already available. |
I think most people thought it would be project-specific, but who knows what a small handful of people are doing for crazy reasons. :p My thought in suggesting a new function is that it was considered desirable enough to implement the global version in the first place, i.e. people want it and it's a useful enough convenience to merit its own sugar. So by extension, it's useful enough to reimplement it the way it was always meant to behave, rather than force people to define the variable in a different-level meson.build file. |
How about rename to meson.global_build_root() and meson.global_source_root() |
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'm good with deprecating these, they are pretty much useless. Im not sure about the replacement, I've never had a use case for it but if we're going to add it that should happen in the 0.56
I'm also in favor of deprecating these. We can add |
Fair enough, added project_build/source_root() now.
That would not be backward compatible. We don't want to break existing projects that are not always meant to be used as a subproject.
I think getting the global root is wrong in all cases, it violates subproject isolation and if you're doing that on purpose you probably deserve getting a deprecation warning. That being said, if it turns out we get bug reports with valid use-cases that I didn't though about then we'll add them, yes. |
e696509
to
7176b74
Compare
The https://github.com/swaywm/wlroots/blob/d595a4ebe3d432cdd3f551d6d067b341d0afdc19/meson.build#L45 |
From what I can tell that code is only using source and build dirs to calculate the relative path from build to source. What if we exposed that directly so you don't have to roll it by hand? |
Sounds good to me.
Sounds good to me as well, if there aren't more use-cases that really need |
I have another use case where I actually need |
There are valid use-cases for these functions. References: mesonbuild#7772
https://mesonbuild.com/Localisation.html#mesonbuild still refers to |
It is absolutely, positively, not needed. Because Meson internally passes I think this documentation is entirely wrong. :) But it might be trying to demonstrate advanced usage of the i18n.gettext() function, though why it needs to do that in a "basics" tutorial I don't know... |
mesonbuild/scripts/gettext.py:run_potgen Meson has always provided this (as PR: #10307 |
https://mesonbuild.com/Dlang-module.html refers to |
Those function are common source of issue when used in a subproject because they
point to the parent project root which is rarely what is expected and is a
violation of subproject isolation.