Skip to content
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

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

dcbaker
Copy link
Member

@dcbaker dcbaker commented Jan 13, 2025

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.

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.
@dcbaker dcbaker force-pushed the submit/build-cleanup-argument-validation branch from 078abb2 to 0886be4 Compare January 13, 2025 21:20
This includes cleaning up some of the type handling to account for
cleanups that are done at the DSL level.
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.
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.
@dcbaker dcbaker force-pushed the submit/build-cleanup-argument-validation branch from 0886be4 to 241d433 Compare January 13, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant