summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter
AgeCommit message (Collapse)Author
2025-12-22cargo: allow overriding Meson's Cargo interpreterPaolo Bonzini
Some projects may want to override Meson's AST generation for Cargo projects. This was not really doable before without hard coding the results of feature resolution; however, now it will be possible by accessing the results of the global feature resolution from the Rust module's workspace object. At the same time, the subproject must keep using the Cargo method, which is forced by the workspace object's subproject() method, because otherwise the interpreter is not propagated. So just skip the interpretation phase if a Meson.build is present. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-17dependencies: Require 'native' be passed in kwargsDylan Baker
This simplifies a bunch of cases, and likely fixes some annoying bugs in cross compile situations where should have been passing this and weren't.
2025-12-17build|interpreter: use typed_kwargs for link_withDylan Baker
This replaces the long explanation of `external_library`s in the `link_with` parameter to the simpler one used by declare_dependency. Additionally, declare_dependency now checks that a target is linkable when adding it. This just catches the problem before it goes down into the build layer giving a better error message. There is a bug in the declare_dependency annotations, in that they don't mark Executable as acceptable. So I've fixed that.
2025-12-17build: clean up some some of the link_whole pathDylan Baker
This puts subclass specific logic in the subclasses, and cleans up some typing.
2025-12-17interpreter: validate that a target is linkable in link_whole checkDylan Baker
This catches the addition of un-linkable targets at the interpreter level rather than requiring the build layer to handle this. In turn, this gives the end user a better error message.
2025-12-17build|interpreter: use the LINK_WHOLE validator for BuildTargetDylan Baker
2025-12-17interpreter|build: Use typed_kwargs for build_target(dependencies)Dylan Baker
What is basically impossible is to handle `SubprojectHolder`, because it's not a true holder but an interpreter object. Well, impossible without changing SubprojectHolder into a true holder, because it's avoiding the circular import becomes extremely convoluted otherwise, and refactoring is difficult because the held object is itself an Interpreter. It's a rather complex problem to solve gracefully. I've punted to avoid the complexity, it does mean that the error message is somewhat less exact. I don't think this is actually a huge problem because we've really guided people away from using `subproject()` and to instead use dependency fallbacks, which don't have this problem to begin with. This removes validation from the build layer, and puts it in interpreter. For code sharing reasons this means that `internal_dependency` also gets more fine grained error messages. The test case for this has been modified to use the `testcase expect_error` construct, and thus has been moved to the common tests directory. It's also been extended to cover both the library case, which gives coverage for the `extra_types` in `KwargInfo`
2025-12-17interpreter: Add type checking for BuildTarget(install_dir: )Dylan Baker
This just puts the type checking in the frontend, there's still some serious cleanup in the build and backend that need to happen.
2025-12-17interpreter: use the new feature where it is usefulDylan Baker
2025-12-16build: cleanup include_directories codeDylan Baker
With the previous change the build layer no longer needs to be concerned about strings
2025-12-16interpreter: use typed_kwargs for build_target(include_directories)Dylan Baker
This allows some additional cleanup, as we had code specifically for doing version checking that was not only used here, and that can be removed.
2025-12-16interpreter/compiler: Use typed_kwargs for include_directories string featureDylan Baker
This removes the use of interpreter.extract_incdirs since_strings, and instead let's typed_kwargs do the work
2025-12-16interpreter: use typed_kwargs ifor dependency (include_directories) stringsDylan Baker
Instead of using the `extract_incdirs` function.
2025-12-08build|interpreter: use typed_kwargs for BuildTarget(install_tag)Dylan Baker
2025-12-08build|interpreter: use typed_kwargs for BuildTarget(link_args)Dylan Baker
2025-12-05mesonmain: mark getting a language from another subproject as brokenDylan Baker
Currently, you can call `meson.get_compiler('c')`, if you haven't initialized 'c' for your project, but a super-project has initialized it. This happens because we check the wrong set of compilers (the global list vs the per-subproject one). Because of how fragile this is, we can mark it as broken an move on.
2025-12-04interpreter: validate argument to string.split() for empty stringDylan Baker
The underlying Python implementation throws in this case, and I'm not sure what the correct result here would be if we allowed it. Convert to None and don't split? Split every character? I've gone with throwing InvalidArguments, which maintains the current behavior of "doesn't work" but with a nicer output. Any other change would require a FeatureNew anyway, and can wait till 1.11. Fixes: #15335
2025-11-28interpreter: Add a slice() method to arraysJouke Witteveen
This can come in handy for instance when a custom target creates both headers and sources. Slicing the output of a `to_list()` call provides convenient access to just the headers or just the sources.
2025-11-28Simplify to_list implementation for custom targetsJouke Witteveen
2025-11-19compilers: Remove Environment parameter from Compiler.get_defineDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.compute_intDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_membersDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_typeDylan Baker
2025-11-19compilers: Remove Environment parameter from ↵Dylan Baker
Compiler.symbols_have_underscore_prefix
2025-11-19compilers: Remove Environment parameter from Compiler.get_option_compile_argsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.get_option_std_argsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.get_option_link_argsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.check_headerDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_headerDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_header_symbolDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.runDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.sizeofDylan Baker
This also fixes the `_cross_sizeof` helper
2025-11-19compilers: Remove Environment parameter from Compiler.alignmentDylan Baker
This also fixes the helper `_cross_alignment` method.
2025-11-19compilers: Remove Environment parameter from Compiler.has_functionDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.find_libraryDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_multi_argumentsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_function_attributeDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.compiles()Dylan Baker
2025-11-19Compilers: remove Environment parameter from Compiler.links()Dylan Baker
2025-11-19interpreter: Fix import of cargo for type checkingDylan Baker
2025-11-18interpreter: fix type of override_optionsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-14interpreter: Robustly covert executable arguments to shared_library argumentsDylan Baker
This extends the code that strips executable keyword arguments to also default populate shared_library exclusive arguments. Fixes: #15238
2025-11-14Add `shortname' kwarg for a short DLL name on OS/2KO Myung-Hun
Give an user opportunities to mangle a custom short name for a DLL on OS/2.
2025-11-14make str and meson.version() API align again.Eli Schwartz
Regression in commit 6ee583e119b432fee03f908547729d5da030397e. str.version_compare() accepts varargs unless the str was defined via meson.version(), which isn't supposed to be a visible end user distinction. That being said, it makes no sense to support the special casing here. - FeatureNew only compares conditions with min, not with max - Having multiple min conditions is illogical and there's no need to support it. So we allow varargs for parity, but debug log that we can't handle it specially and refrain from setting tmp_meson_version at all. Fixes: https://github.com/mesonbuild/meson/issues/15217
2025-11-14version_compare with meson.version() override should log when it doesn't workEli Schwartz
meson_version: '>=1.8.0' works to control FeatureNew -- but < does not. Likewise with version_compare. This may or may not surprise people. Leave a hint in the logfile.
2025-11-12interpreter: move backend type checking to interpreterDylan Baker
Of course, this checking isn't actually doing what it claims, as it doesn't actually stop you from writing at target like: ```meson build_target( 'foo', 'srcs/main.c', c_pch : 'src/pch.h', ) ```
2025-11-12build: Use a tuple for pch dataDylan Baker
This really isn't a list because it's not homogenous data, it's really `tuple[str, str | None] | None`, but we're using list length to decide what to do with it, and that makes for strict null issues, as an accurate annotation would be `list[str | None]`, which would require a lot of `is not None` checking. By using a tuple we don't need to keep checking length, which is more expensive than null checking. To ensure correctness I annotated some things in the VS backend
2025-11-12intepreter: Move remaining PCH validation to InterpreterDylan Baker
2025-11-12interpreter: Move most of the remaining validation to the InterpreterDylan Baker
What's left requires the Environment, so it will have to be handled in the interpreter implementation for now.
2025-11-12interpreter: move deprecation validation for *_pch to the interpreterDylan Baker