summaryrefslogtreecommitdiff
path: root/unittests/cargotests.py
AgeCommit message (Collapse)Author
2025-12-15cargo: add --check-cfg cfg(test) unconditionallyPaolo Bonzini
It should be added even if unexpected_cfgs is not part of Cargo.toml. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-23cargo: fix proc-macro=true without crate_typePaolo Bonzini
The default value is not passed further through the converter, therefore it must take proc-macro into account. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-23cargo: generate lint arguments from tablePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-23cargo: parse lints tablePaolo Bonzini
The lints table in Cargo.toml has a very human-targeted syntax. When building manifest.from_raw, flatten everything into a single list, prefixing the tool name to every warning option and sorting by priority. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-23cargo: remove duplicate proc_macro fieldPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-23cargo: convert proc_macro to crate_type in Library dataclass.Paolo Bonzini
Do not look anymore at proc_macro after init, keeping crate_type as the sole source of truth about the desired crate types.
2025-10-22cargo: Move all conversions in _raw_to_dataclass()Xavier Claessens
This allows keeping the manifest unmodified which is better practice for a parser. Previously some places had e.g. raw.setdefault(). It also fix some values: - BuildTarget.doc_scrape_examples is removed. It seems to be some experimental cargo feature, but I haven't found documentation that says it should be part of the manifest. It was also missing from raw manifest. - BuildTarget.edition does not default to 2015, it default to package's edition, which itself default to 2015. - bench value defaults to False for tests. - Dependency.path must be relative to its Cargo.toml location. If the value comes from the package it can be used as-is, but if it comes from workspace it must be made relative. - Library.name default to its package name with dash replaced with underscores.
2025-10-17cargo: raw.Manifest can be any Cargo.tomlXavier Claessens
raw.Manifest represents any Cargo.toml file, a package, a workspace, or both. However, the Manifest dataclass can only be a package, and the Workspace dataclass is a workspace with an optional root package.
2025-10-14cargo: load a single Cargo.lock for a whole chain of subprojectsPaolo Bonzini
When processing cargo subprojects, each Resolver was independently loading Cargo.lock files, leading to duplicate wraps and errors like 'Multiple wrap files provide dependency'. Instead, build the cargo.Interpreter as soon as a Cargo.lock file is found, and merge that Cargo.lock into the wrap resolver. There is no need anymore to build a separate resolver for the dependent packages, because their indirect dependencies are all listed in the parent lockfile.
2025-10-14cargo: When loading wraps multiple packages can have the same URLXavier Claessens
This avoids cloning the same repo multiple times, instead a single wrap can provide multiple cargo dependencies.
2025-08-01unittests/cargotests: add tests for workspace inheritancePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-01cargo: change init-time computation to lazy propertiesPaolo Bonzini
Make the dataclasses closer to the TypedDicts. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-01unittests/cargotests: add tests for Cargo.toml parsingPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-01unittests/cargotests: fix pylintPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-31cargo: Do not convert cfg() to Meson ASTXavier Claessens
We'll need to evaluate those expressions before generating the AST. Instead take a config key-value dictionary and evaluate the expression to return a boolean.
2025-05-31cargo: Fix cfg() parsingXavier Claessens
Add cfg token to be able to parse the top level cfg() function. Fix parser which was creating a new iterator when recursing which caused the caller function's iterator to not have advanced when recursing function returns.
2024-06-14cargo: Load Cargo.lockXavier Claessens
Cargo.lock is essentially identical to subprojects/*.wrap files. When a (sub)project has a Cargo.lock file this allows automatic fallback for its cargo dependencies.
2023-10-09cargo: Fix '1.0.45' version conversionXavier Claessens
The middle 0 was wrongly dropped.
2023-10-09cargo: builder: Remove all duplicated functionsXavier Claessens
Keep only the Builder class, there is no point in duplicating everything.
2023-06-07cargo/cfg: Add a parser for the rust/cargo cfg() expressionsDylan Baker
This uses a recursive descent parser + lexer to create an IR from cfg() expressions, which it then converts into meson IR.
2023-06-07cargo/version: add a function to convert cargo versioning to mesonDylan Baker