Skip to content

Synchronize 1.8.x option handling code with 1.9 #14722

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

Open
wants to merge 29 commits into
base: 1.8
Choose a base branch
from

Conversation

bonzini
Copy link
Collaborator

@bonzini bonzini commented Jun 18, 2025

This is the easiest way to bring the fix for #14698 into 1.8.3.

@bonzini bonzini added this to the 1.8.3 milestone Jun 18, 2025
@bonzini bonzini changed the title Synchronize option handling code with 1.9 Synchronize 1.8.x option handling code with 1.9 Jun 18, 2025
jpakkane and others added 28 commits June 18, 2025 23:18
Windows 2019 in GH Actions goes away on the 30th.

(cherry picked from commit 0154363)
(cherry picked from commit 9191748)
It is assigned to invoker_method_default_options for clarity, use that name
everywhere.

Signed-off-by: Paolo Bonzini <[email protected]>
Make the validators accept any object since that is where the type
checking is done.  The same is true for listify_array_value, which
also performs type checking.

Signed-off-by: Paolo Bonzini <[email protected]>
This makes it possible to remove all list cases from first_handle_prefix
and callees.

Signed-off-by: Paolo Bonzini <[email protected]>
Do not go through string first and OptionKey second.  Just pass the OptionKeys
down.

Signed-off-by: Paolo Bonzini <[email protected]>
Allow OptionStringLikeDict to use non-string data types, and use it
as much as possible instead of string-valued dictionaries.

Signed-off-by: Paolo Bonzini <[email protected]>
A convertor will *accept* something that is definitely a TYPE_var; but the
output can be any Python object that the evaluation function desires.

Signed-off-by: Paolo Bonzini <[email protected]>
…_options

Replace optlist2optdict with a convertor.  However, while default_options
should use OptionKeys like it did before the option refactoring,
override_options keeps using strings.

Signed-off-by: Paolo Bonzini <[email protected]>
Which doesn't give helpful error messages unless used with pytest

(cherry picked from commit 7c84341)
The converter in DEFAULT_OPTIONS makes a mapping from OptionKey to Python values,
so use the correct type.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 93708d5)
Use the type that is produced by the converter, and fix the type for
methods_map which has a wrongly-placed bracket.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 013dfe7)
Starting with Meson 1.8.0, "meson configure" prints some options as
":foo" instead of "foo".  Print the option as it was passed by the
user.

While at it, make errors more consistent and/or correct (e.g.
"Unknown option" instead of "Unknown options").

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 54c79dc)
Once unknown options will go through accept_as_pending_option, only system options
that really exist in Meson will be accepted.  Adjust the unit tests.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit dcd98b7)
They must be there when running re-configuring, because the backend cannot
be changed, but they can be pending on the first invocation.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit b58c5cf)
Suggested-by: Dylan Baker <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit f19ff7c)
There is common logic hiding between project() and "meson configure": the
complication that the comment mentions for the "default_options" case
actually applies to "meson configure", to machine files, to command line
options and to project options.  Reuse the same function in all four cases.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 2a4fd32)
Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 9d0df1c)
self.project_options is set already a couple lines above.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 650a076)
The cmd_line_options dictionary is described as having OptionKey keys, so
make sure that cmd_the keys do have the correct type.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 10aab63)
Thanks to several fixes applied between commit d37d649 ("Make all
Meson level options overridable per subproject.", 2025-02-13) and now,
OptionStore never gets a string key.  Tighten the type of OptionDict,
and use it whenever possible.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 53dac0a)
The test covers overriding an option from the dependency() function.
If the same option is passed on the command line, it overrides the
dependency()'s default_options as well.

Tweak the description of the unittests that uses the same sources.
The tests pass, but I am not sure they should.  For example in
the second test the default_library=both setting in the machine file
should have the same effect as the -D option (machine files have lower
priority than command line, but higher priority than anything in meson.build
files).

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 1dd1fed)
…fallback

We're about to lower the priority of the default_options that were passed
to subproject() and dependency() below that of machine files and command
line options.

Whenever a static dependency is falling back to a subproject, however, do
not do that.  It makes no sense to build a shared library in that case.
Another possibility however could be to just make it an error.

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit f2c03ef)
It is impossible to detect the source of default_library=both from within the
test, so add yet another knob... :(

Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 1462365)
Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 852a580)

[1.8 only: also adjust mesonbuild/ast/introspection.py]
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.

3 participants