Daniel Mensinger
8f7343831b
refactor: Refactor BothLibraries logic
...
This commit introduces a new type of `HoldableObject`: The
`SecondLevelHolder`. The primary purpose of this class is
to handle cases where two (or more) `HoldableObject`s are
stored at the same time (with one default object). The
best (and currently only) example here is the `BothLibraries`
class.
3 years ago
Daniel Mensinger
3f889606c7
Split compiler detection from Environment
...
This moves all the compiler detection logic into the new
compilers.detect module. This dramatically reduces the size
and complexity of Environment.
3 years ago
Xavier Claessens
0bef89b0c2
interpreter: Empty list used to be allowed in install_headers/man
...
That change introduced when porting to @typed_pos_args breaks gtk4. We
could decide to deprecate/warn but should not error for backward
compatibility.
3 years ago
Daniel Mensinger
0c4dd81c4d
fix: Handling BothLibraries objects ( fixes #8907 )
3 years ago
Dylan Baker
d636b92c1a
install_*: FileMode doesn't need to be None
...
There's no reason to allow None into the backend, it already has code to
check that all of the values of the FileMode object are None, so let's
use that, which is much simpler all the way down.
3 years ago
Dylan Baker
7213b7d81f
interpreter: use typed_kwargs for install_man
3 years ago
Dylan Baker
7619f31f71
interpreter: man sections can be up to 9 on many platforms
...
Linux and FreeBSD use section 9 for kernel man pages, so we should allow
that.
3 years ago
Dylan Baker
9611bd8244
interpreter: use typed_pos_args for install_man
3 years ago
Dylan Baker
f4d2efbed3
interpreter: use typed_kwargs for install_headers
3 years ago
Dylan Baker
251dff56fb
interpreter: use typed_pos_args for install_headers
3 years ago
Dylan Baker
ea3d85a1c0
interpreter: use typed_kwargs for install_data
3 years ago
Dylan Baker
a551e76137
interpreter: use typed_pos_args for install_data
3 years ago
Dylan Baker
596c8d4af5
interpreter: use typed_kwargs for install_subdir
3 years ago
Dylan Baker
3d940fec98
interpreter: use typed_pos_args for install_subdir
3 years ago
Dylan Baker
a024f432dd
interpreter: add overload for source_strings_to_files
...
when only passing strings or Files we only get back Files. This is
useful for the install_* methods
3 years ago
Laurin-Luis Lehning
281f5abee3
interpreter: Replace manual kwarg validation in compiler.get_supported_arguments with @typed_kwargs
3 years ago
Daniel Mensinger
5cd9f88d6c
fix: Ensure that build targets have all methods from ExternalProgram
...
As a side-effect from #8885 `find_program()` returns now `Executable`
objects when `meson.override_find_program` is called with an
executable target. To resolve this conflict the missing methods
from `ExternalProgram` are added to `BuildTarget`.
3 years ago
Laurin-Luis Lehning
d5ed8f61a5
interpreter: Move argument checks from add_*_arguments to compiler.get_supported_arguments
3 years ago
Laurin-Luis Lehning
e44587fc73
interpreter: Consider the compiler language before checking arguments
3 years ago
Laurin-Luis Lehning
c9ad98ef5e
interprter: Add required kwarg to add_(project|global)_arguments
...
To avoid manual compiler support checks add_project_arguments and
add_global_arguments receive a new keyword argument to perform
them automatically.
3 years ago
Daniel Mensinger
a73791b529
fix: Fix strange holder_map bug in combination with subprojects
...
I was unable to reproduce this in a minimal test-case, so there
is currently no new test :(
3 years ago
Daniel Mensinger
f1ac7db2e6
fix: Fix set_variable not holderifying ( fixes #8904 )
3 years ago
Daniel Mensinger
7c757dff71
holders: Fix the remaining code to respect the holder changes
3 years ago
Daniel Mensinger
34c28dc92c
holders: remove unholder
3 years ago
Daniel Mensinger
84a3e459a8
holders: Introduce BothLibraries
3 years ago
Daniel Mensinger
c2c7f7c9d7
holders: Ensure that InterpreterBase is the sole instance for (un)holderifying
3 years ago
Daniel Mensinger
6879e84c48
holders: Move get_version from directly to ExternalProgram
3 years ago
Daniel Mensinger
66b32a4591
holders: Introduce HoldableObject
3 years ago
Daniel Mensinger
d601227cb2
interpreter: Add FileHolder and remove specical case for File
3 years ago
Daniel Mensinger
63ade7d937
interpreter: Add a new MesonInterpreterObject for non-elementary objects
3 years ago
Daniel Mensinger
202e345dfb
interpreter: Refactor interpreter.compiler to use ObjectHolder
3 years ago
Daniel Mensinger
2b09af834a
interpreter: Refactor ObjectHolder to extend InterpreterObject
3 years ago
Daniel Mensinger
2c08e55f85
typing: Import missing classes in interpreterobjects.py
3 years ago
Dylan Baker
3ec2cf9c60
interpreter: add type annotations to build_incdir_object
...
and use textwrap.dedent to make the very large messages more readable
and not break method folding.
3 years ago
Xavier Claessens
5f3b73beb5
dependency: Empty fallback is the same as allow_fallback: false
3 years ago
Xavier Claessens
b6d754a40c
interpreter: Extract dependency() logic into its own helper class
...
The dependency lookup is a lot of complex code. This refactor it all
into a single file/class outside of interpreter main class. This new
design allows adding more fallbacks candidates in the future (e.g. using
cc.find_library()) but does not yet add any extra API.
3 years ago
Dylan Baker
ec48dbd2d6
interpreterobjects: Clean up GeneratedListHolder
...
Remove an unused method (that didn't work before this series), and
remove the ability to pass a Generator to the GeneratedListHolder, it's
never used and it's weird and not the way Meson generally works now.
While we're here, finish the type annotations.
3 years ago
Dylan Baker
c422621317
interpreterobjects|build: use typed_kwargs for generator.process
3 years ago
Dylan Baker
5952dc9818
interpreter|build: use typed_pos_args and unholder in the interpreter
...
For generator.process_files. Just cleaner and nicer
3 years ago
Dylan Baker
35bdaada1d
interpreter|build: Do Generator keyword argument checking in the interpreter
...
For qt we already have all of the necissary checking in place. Now in
the interpreter we have the same, the intrperter does all of the
checking, then passed the arguments to the Generator initializer, which
just assigns the passed values. This is nice, neat, and clean and fixes
the layering violatino between build and interpreter.
3 years ago
Dylan Baker
491c756dc9
interpreter: use typed_kwargs for func_generator
...
Do the type checking in a nice tidy way
3 years ago
Dylan Baker
d2c1ab40a0
interpreter|build: Pass just the executable down to Generator
...
This requires that the interpreter has done the validation, which it now
does at all callsites. This simplifies the Generator initializer.
3 years ago
Dylan Baker
2ac9b32391
interpreter: Do not create Generator in GeneratorHolder
...
This is an odd pattern, not the way most Holders work, and would be
problematic if a method wanted to return a Generator.
3 years ago
Dylan Baker
2bc7a1b3da
modules/qt: fully annotate and check qt.has_tools
3 years ago
Dylan Baker
e2266e8708
interpreter: use typed_*args for test and benchmark
...
this also requires some changes to the Rust module, as it calls into the
test code.
3 years ago
Dylan Baker
86704261a7
interpreter: use typed_pos_args for func_test and func_benchmark
...
Requires a few small changes to the Rust module, as it calls `func_test`
3 years ago
Xavier Claessens
5a5ab79078
interpreter: Add missing FeatureNewKwarg for allow_fallback
3 years ago
Dylan Baker
98efec5c2b
interpreter: make helper methods protected
...
They really aren't meant to be called outside of the interpreter itself,
so don't expose them as public
3 years ago
Dylan Baker
bf656ce0ec
interpreter: Add type annotations for the add_*_arguments helpers
...
internally these all used a set of shared heleprs, add type annotations
for those as well
3 years ago
Dylan Baker
3f9a81e7f1
interpreter: use typed_kwargs for the add_*_arguments family
...
This makes use of the new convertor and validator arguments, so that we
can check that the languages passed are in fact vaild, and then convert
the native boolean into a MachineChoice internally.
3 years ago