diff --git a/crates/uv-settings/src/lib.rs b/crates/uv-settings/src/lib.rs index df15d60bf..3891ce6c0 100644 --- a/crates/uv-settings/src/lib.rs +++ b/crates/uv-settings/src/lib.rs @@ -211,6 +211,7 @@ fn validate_uv_toml(path: &Path, options: &Options) -> Result<(), Error> { override_dependencies: _, constraint_dependencies: _, build_constraint_dependencies: _, + build_dependencies_metadata: _, environments, required_environments, conflicts, @@ -362,6 +363,7 @@ fn warn_uv_toml_masked_fields(options: &Options) { managed: _, package: _, build_backend: _, + build_dependencies_metadata: _, } = options; let mut masked_fields = vec![]; diff --git a/crates/uv-settings/src/settings.rs b/crates/uv-settings/src/settings.rs index 285b77cf7..313a6ce7a 100644 --- a/crates/uv-settings/src/settings.rs +++ b/crates/uv-settings/src/settings.rs @@ -155,6 +155,9 @@ pub struct Options { #[cfg_attr(feature = "schemars", schemars(skip))] pub r#package: Option, + #[cfg_attr(feature = "schemars", schemars(skip))] + pub build_dependencies_metadata: Option, + #[cfg_attr(feature = "schemars", schemars(skip))] pub build_backend: Option, } @@ -2142,6 +2145,7 @@ pub struct OptionsWire { default_groups: Option, dependency_groups: Option, dev_dependencies: Option, + build_dependencies_metadata: Option, // Build backend build_backend: Option, @@ -2208,6 +2212,7 @@ impl From for Options { sources, default_groups, dependency_groups, + build_dependencies_metadata, extra_build_dependencies, extra_build_variables, dev_dependencies, @@ -2293,6 +2298,7 @@ impl From for Options { dependency_groups, managed, package, + build_dependencies_metadata, } } } diff --git a/crates/uv-workspace/src/pyproject.rs b/crates/uv-workspace/src/pyproject.rs index 82714e465..0244aaf31 100644 --- a/crates/uv-workspace/src/pyproject.rs +++ b/crates/uv-workspace/src/pyproject.rs @@ -428,6 +428,19 @@ pub struct ToolUv { )] pub dependency_groups: Option, + /// 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, + /// Additional build dependencies for packages. /// /// This allows extending the PEP 517 build environment for the project's dependencies with @@ -846,6 +859,16 @@ impl From for ExtraBuildDependencyWire { } } +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct BuildDependenciesMetadata(BTreeMap); + +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct BuildDependencyMetadata { + pub match_runtime: Option, +} + #[derive(Default, Debug, Clone, PartialEq, Eq, Serialize)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ExtraBuildDependencies(BTreeMap>);