| Age | Commit message (Collapse) | Author |
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
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>
|
|
This is up to 2x faster because it avoids checks for pkg-config and cmake.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
Make the implicit `xyz = ["dep:xyz"]` declaration explicit in the Manifest.
This also makes it possible to implement correctly the part of the spec where
"If you specify the optional dependency with the dep: prefix anywhere in
the [features] table, that disables the implicit feature."
Unfortunately, this can only be done after target-specific configurations
are resolved, which makes it hard to write a unit test for this. Rustix
requires it, though; without this patch, something like
[package]
name = "rustix"
edition = "2021"
rust-version = "1.63"
version = "0.38.34"
[dependencies]
alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" }
libc = { version = "0.2.0", optional = true, package = "libc" }
libc_errno = { version = "0.3.8", optional = true, package = "errno" }
[features]
alloc = []
default = ["std"]
rustc-dep-of-std = ["dep:alloc"]
std = ["alloc"]
use-libc = ["libc_errno", "libc"]
would incorrectly request the rustc-std-workspace-alloc crate via the
chain default->std->alloc. The patch blocks it because it finds the
"dep:alloc" dependency of feature rustc-dep-of-std.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
It should be added even if unexpected_cfgs is not part of Cargo.toml.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Many crates that have a build.rs will usually require an overlay
with the translated meson/meson.build file. To avoid having to
create a .wrap file, when parsing Cargo.lock autodetect a directory
in subproject/packagefiles/ and add it as the patch_directory.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Using os.path.basename on a string such as "/foo/bar/" returns an
empty string, which breaks on e.g. Cgit git URLs.
The fix uses pathlibs Path class "parent" method, which gets the last
component of the path, so "bar" for "/foo/bar/".
|
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Cargo allows path in dependencies even outside a workspace. To support
this in Meson, always create a dummy WorkspaceState outside non-workspace
manifests.
Another bug that this fixes is that the default feature was not added
for workspaces, only for projects.
In addition, this removes some confusion and code duplication
between interpret_package() and interpret_workspace(). Because
they are respectively for top-level directories and subdirectories,
interpret_package always has a project_root and interpret_workspace
never does.
|
|
... and propagate to their packages
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Add a dep_packages cache to PackageConfiguration to store resolved dependencies,
so that there is no need to call _dep_package() again and all knowledge of
how to build arguments is removed from _create_lib()
|
|
While this has no effect, it makes it easier to move the
generation of the rust_dependency_map out of the interpreter.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Generating command line arguments needs the Environment, not the
whole cargo interpreter state. Move it out of Interpreter.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Generating environment variables needs the Environment, not the
whole cargo interpreter state. Move it out of Interpreter.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Make the PackageConfiguration optional: this makes it easy to see
if the package had already been found earlier. This also removes
calls to _prepare_package and makes it idempotent.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
The next step is to ensure that all packages are in
self.packages prior to _prepare_package. For now,
instead, ensure that nothing breaks if the packages
are _absent_ from self.packages.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Part of PackageState refers to the package itself, and part to the
feature and dependency resolution process. Pull the latter outside,
in preparation for having different features and dependencies for
the build and the host machine.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
self._add_dependency is idempotent so do it freely, and process DEP/FEATURE
as a self._add_dependency followed by regular DEP?/FEATURE processing.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
In the long term, dependencies that do not have a [lib] table will not
create an invocation of override_dependency; do not expect there to be
a handwritten meson.build that does it.
In particular, this is the case for extra-dep-1-rs in the "rust/22 cargo
subproject" test case, so change that to use the extra_deps mechanism
instead to invoke the subproject.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Leave the cfg symbol free. Only one function is used.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
It is required to have unique library names for rust_dependency_map to
work. In the case we have foo crate in multiple versions, we have to
make sure their .rlib file have a different name.
|
|
A crate can depend on 2 different API versions of the same crate:
foo_1_dep and foo_2_dep.
Make sure a Dependency always has a version. When it's defined by a git
URL, or a path, the version could be omitted. Update once we fetched the
dependency's package.
|
|
|
|
edition and lint args were not set the Cargo subproject is a workspace.
|
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This makes it possible to pass rust_args as a list.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Fixes: #15028
|
|
Do not look anymore at proc_macro after init, keeping crate_type as the
sole source of truth about the desired crate types.
|
|
It was wasteful, but also failed when the .wrap file miss that
dependency from [provide] section and no Cargo.lock file provide it
either.
|
|
It should fallback to root package, then all members:
https://doc.rust-lang.org/cargo/reference/workspaces.html#the-default-members-field
|