summaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)Author
2025-12-22quick fixHEADmasterJohn Turner
2025-12-22Merge branch 'clippy-json'John Turner
2025-12-22modules: rust: add package.override_dependency methodPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add package.shared_module methodPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add package.executablePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22cargo: populate bin table from src/bin/Paolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add package.library/package.proc_macro methodsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22cargo: use dependencies() method to get dependenciesPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: invoke subprojects automatically from dependencies()Paolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add dependencies() method to package objectPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: allow passing an array for dependency versionsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22cargo: use rust.workspace() to build the argumentsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22cargo: use rust.to_system_dependencyPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22rust: add to_system_dependencyPaolo Bonzini
Move the logic for system dependencies outside Cargo.interpreter and into the rust module, so that it can be reused by the workspace object. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22dependencies: make arguments to InternalDependency.__init__ optionalPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add workspace methods returning arguments for build targetsPaolo Bonzini
Add rustc_args(), env(), and rust_dependency_map() methods to the RustPackage class. They simply delegate to PackageState and PackageConfiguration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: implement workspace.package()Paolo Bonzini
Note that, as shown in the testcase, package() works in the subproject as well. This means that in the future the Cargo code generator can be changed to reduce the amount of generated code and instead rely on the package object. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: implement more package accessorsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: implement workspace.packages()Paolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22cargo: use cargo_ws.subproject().dependency()Paolo Bonzini
This is up to 2x faster because it avoids checks for pkg-config and cmake. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22ast: printer: give a precedence to all kinds of functionsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: implement workspace.subproject() and package.dependency()Paolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22cargo: add configurable features to InterpreterPaolo Bonzini
Add features property to cargo.Interpreter to make default features configurable; customization of which features are enabled by default is triggered by rust.workspace(). Fixes: #14290 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22rust: add rust.workspace() skeleton implementationPaolo Bonzini
rust.workspace() is the entry point for global feature resolution. It loads a Cargo.toml file and ensures that all dependencies will be built with the correct set of features. Fixes: #13404 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22cargo: show nice exception if Cargo.toml missingPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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-20add clippy-json targetJohn Turner
Add a clippy-json target to the ninja script. This is useful for rust-analyzer, which requires an "external check command" to function when not using cargo. Also we add a "clippy-json-prereq" target, and invoke it in the clippy.py script. The prereq target tries to build as much of the project as possible with "-k0".
2025-12-18coredata: lookup options for the correct machinePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-18options: canonicalize to host options anything that is not per-machinePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-18compilers: fix direction of cross-build testPaolo Bonzini
This used to be if for_machine is MachineChoice.BUILD and not is_cross: so it needed to be negated. This is also clearly wrong because "env.is_cross_build(for_machine)" has no effect - it is only true if for_machine is MachineChoice.HOST, in which case key.as_host() does nothing. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-18options: optimize shortcuts for evolve()Paolo Bonzini
Since OptionKey is immutable, it is possible to return self if we know that the returned value is the same as the one being transformed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-17dependencies/coarrays: Remove dead codeDylan Baker
2025-12-17dependencies: Remove `log_tried` methodDylan Baker
It's now only used to populate the DependencyCandidate, so we can remove it and just calculate the same information from the `type_name` parameter. This reduces code and the number of method calls.
2025-12-17dependencies/detect: simplify logging tried methodsDylan Baker
Avoid extra method calls and repeating ourselves.
2025-12-17dependencies: Catch non MesonException in detect and give better messageDylan Baker
2025-12-17Dependencies: Make use of the DependencyCandidate classDylan Baker
This makes the type checking more reasonable (including fixing an issue that newer mypy is pointing out to us), consolidating special cases, and improving code readability.
2025-12-17dependencies: Add a wrapper class for Dependency candidatesDylan Baker
The goal is to have a single type for candidates that replaces having a mixture of class initializers, partials, and factories with a single wrapper class.
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-17dependencies: stop passing "language" as a keyword argumentDylan Baker
It's allowed in the `DependencyKeywordArguments` TypeDict already, so we now have two sources of truth. Additionally, it's often populated by reading from that dict, so we're just doing useless work.
2025-12-17dependencies/framework: remove useless stringlistify callDylan Baker
We have type checking that ensures this is a string list already.
2025-12-17dependencies: Pass the `name` to `ExternalDependency` constructorDylan Baker
So we don't create a default name that is overwritten except in the case of appleframeworks. This allows for some cleanup, including deleting some initializers that were only setting the name.
2025-12-17dependencies: Move type_name to class levelDylan Baker
This is really class constant for all dependencies, and by taking it out of the initializer we make the `__init__` call have a more consistent interface.
2025-12-17dependencies: Annotate the DependencyPackages classDylan Baker
2025-12-17build: update comments on rust object linkingDylan Baker
Some of these issues have been resolved
2025-12-17build: clean up the `link` helperDylan Baker
Splits the subclass specific code into those classes
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`