-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
De-duplicate argument validation in the build module #14133
base: master
Are you sure you want to change the base?
De-duplicate argument validation in the build module #14133
Conversation
0886be4
to
241d433
Compare
241d433
to
0aa85a8
Compare
The Interpreter has been merging gui_app and win_subsystem for a while, but now with the typed kwargs we can feel more comfortable that gui_app wont get passed through beneath us
…used" This reverts commit 93c11f2. We're going to use it again in the next commit
This just does what would happen later, but with the potential to fail in obscure way.
This includes cleaning up some of the type handling to account for cleanups that are done at the DSL level.
# The use of Sequence[str] here is intentional to get the generally | ||
# undesirable behavior of Sequence[str] |
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.
What undesirable behavior?
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.
That plain str
is a valid Sequence[str]
. What Meson almost always actually want is more like list[str] | tuple[str, ...] | ...
but not plain str
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 see... It seems it could technically be possible to have as SequenceNotStr protocol: https://stackoverflow.com/a/79310749
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 have another project to work on now. lol
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 tried this at one point and I recall that it completely didn't work, but I forget the details. Hopefully you can figure it out but I'm not optimistic.
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 also tried it several times as well and couldn't make it work either. But if someone else has actually figured it out, I'm interested to try. There's some places in Build specifically that would really benefit from it if we can make it work.
We have type checking, we also have interpreter level validation from the DSL, we don't need this.
There's really no reason to not do ths in the `_extract_pic_pie` helper, it only increases the chance of us not doing this when we should.
It's only valid to use `b_staticpic` with `pic`, and `b_pie` with `pie`, so just key it off the argument
This logic is specific to StaticLibrary and to Executable, so put the logic there. While we're at it, make the type checking more rigid.
0aa85a8
to
0fc397b
Compare
I've left the workaround for the install/build_by_default interaction for later, that's a more complicated issue to prove, since the Interpreter does that automatically, so we need to audit non-Interpreter interactions
There is some validation going on here that cannot (currently) be done the KwargInfo validators, namely that the files exist. Additionally, BuildTarget.extra_files is doing some membership checking for dups, which means it should probably be an OrderedSet instead of a list.
0fc397b
to
d537f00
Compare
Also in the latest version split an accidental squash of export_dynamic and vs_module_defs |
Validation for build_rpath and validation for install_rpath could probably be squashed in one commit. |
This series adds TypedDicts for the various
BuildTarget
derived classes, and then rips out all of the validation in the build layer that is already done in the Interpreter layer. This does not attempt to mess with any validation that is not done at the interpreter layer, however.There is also a bit of fixing of the types in a few places, namely the explicit conversion of
install
to bool, rather than doing the same conversion implicitly later.