This commit is contained in:
Zsolt Dollenstein 2025-08-31 13:45:42 +02:00
parent 99e4046c83
commit 38f1d1adb0
No known key found for this signature in database
3 changed files with 31 additions and 0 deletions

View File

@ -211,6 +211,7 @@ fn validate_uv_toml(path: &Path, options: &Options) -> Result<(), Error> {
override_dependencies: _, override_dependencies: _,
constraint_dependencies: _, constraint_dependencies: _,
build_constraint_dependencies: _, build_constraint_dependencies: _,
build_dependencies_metadata: _,
environments, environments,
required_environments, required_environments,
conflicts, conflicts,
@ -362,6 +363,7 @@ fn warn_uv_toml_masked_fields(options: &Options) {
managed: _, managed: _,
package: _, package: _,
build_backend: _, build_backend: _,
build_dependencies_metadata: _,
} = options; } = options;
let mut masked_fields = vec![]; let mut masked_fields = vec![];

View File

@ -155,6 +155,9 @@ pub struct Options {
#[cfg_attr(feature = "schemars", schemars(skip))] #[cfg_attr(feature = "schemars", schemars(skip))]
pub r#package: Option<serde::de::IgnoredAny>, pub r#package: Option<serde::de::IgnoredAny>,
#[cfg_attr(feature = "schemars", schemars(skip))]
pub build_dependencies_metadata: Option<serde::de::IgnoredAny>,
#[cfg_attr(feature = "schemars", schemars(skip))] #[cfg_attr(feature = "schemars", schemars(skip))]
pub build_backend: Option<serde::de::IgnoredAny>, pub build_backend: Option<serde::de::IgnoredAny>,
} }
@ -2142,6 +2145,7 @@ pub struct OptionsWire {
default_groups: Option<serde::de::IgnoredAny>, default_groups: Option<serde::de::IgnoredAny>,
dependency_groups: Option<serde::de::IgnoredAny>, dependency_groups: Option<serde::de::IgnoredAny>,
dev_dependencies: Option<serde::de::IgnoredAny>, dev_dependencies: Option<serde::de::IgnoredAny>,
build_dependencies_metadata: Option<serde::de::IgnoredAny>,
// Build backend // Build backend
build_backend: Option<serde::de::IgnoredAny>, build_backend: Option<serde::de::IgnoredAny>,
@ -2208,6 +2212,7 @@ impl From<OptionsWire> for Options {
sources, sources,
default_groups, default_groups,
dependency_groups, dependency_groups,
build_dependencies_metadata,
extra_build_dependencies, extra_build_dependencies,
extra_build_variables, extra_build_variables,
dev_dependencies, dev_dependencies,
@ -2293,6 +2298,7 @@ impl From<OptionsWire> for Options {
dependency_groups, dependency_groups,
managed, managed,
package, package,
build_dependencies_metadata,
} }
} }
} }

View File

@ -428,6 +428,19 @@ pub struct ToolUv {
)] )]
pub dependency_groups: Option<ToolUvDependencyGroups>, pub dependency_groups: Option<ToolUvDependencyGroups>,
/// Metadata for build dependencies.
///
/// This allows specifying metadata for build dependencies, such as runtime matching.
#[option(
default = "None",
value_type = "dict",
example = r#"
[build-dependencies-metadata.package1]
match-runtime = true
"#
)]
pub build_dependencies_metadata: Option<BuildDependenciesMetadata>,
/// Additional build dependencies for packages. /// Additional build dependencies for packages.
/// ///
/// This allows extending the PEP 517 build environment for the project's dependencies with /// This allows extending the PEP 517 build environment for the project's dependencies with
@ -846,6 +859,16 @@ impl From<ExtraBuildDependency> for ExtraBuildDependencyWire {
} }
} }
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct BuildDependenciesMetadata(BTreeMap<PackageName, BuildDependencyMetadata>);
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct BuildDependencyMetadata {
pub match_runtime: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize)] #[derive(Default, Debug, Clone, PartialEq, Eq, Serialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct ExtraBuildDependencies(BTreeMap<PackageName, Vec<ExtraBuildDependency>>); pub struct ExtraBuildDependencies(BTreeMap<PackageName, Vec<ExtraBuildDependency>>);