Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,373 changes: 1,123 additions & 250 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ license = "BSD-3-Clause"

[workspace.dependencies]
async-trait = "0.1.86"
cargo_toml = "0.22.3"
chrono = "0.4.39"
clap = "4.5.29"
clap-verbosity-flag = "3.0.2"
comfy-table = "7.1.4"
either = "1.15.0"
fs-err = "3.1.0"
hashlink = "0.10.0"
Expand All @@ -38,6 +40,7 @@ serde_json = "1.0"
tempfile = "3.16.0"
toml_edit = "0.22.24"
tokio = "1.43.0"
tracing = "0.1.41"
tracing-subscriber = "0.3.19"
url = "2.5.4"
pyproject-toml = "0.13.4"
Expand All @@ -56,10 +59,10 @@ rattler-build = { git = "https://github.com/prefix-dev/rattler-build", branch =
"rustls-tls",
] }

rattler_conda_types = { version = "0.37.0", default-features = false }
rattler_conda_types = { version = "0.39.0", default-features = false }
rattler_digest = { version = "1.1.5", default-features = false }
rattler_package_streaming = { version = "0.22.42", default-features = false }
rattler_virtual_packages = { version = "2.0.16", default-features = false }
rattler_package_streaming = { version = "0.23.1", default-features = false }
rattler_virtual_packages = { version = "2.1.3", default-features = false }

pixi_build_types = { version = "*" }
pixi_consts = { version = "*" }
Expand Down
2 changes: 2 additions & 0 deletions crates/pixi-build-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ async-trait = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true, features = ["derive", "env"] }
clap-verbosity-flag = { workspace = true }
comfy-table = { workspace = true }
fs-err = { workspace = true }
indexmap = { workspace = true }
ordermap = { workspace = true }
Expand All @@ -30,6 +31,7 @@ toml_edit = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true, features = ["macros"] }
tracing-subscriber = { workspace = true }
tracing = { workspace = true }
url = { workspace = true }
pyproject-toml = { workspace = true }
dirs = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/pixi-build-backend/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ async fn initialize<T: ProtocolInstantiator>(
// Initialize the backend
let (protocol, _initialize_result) = factory
.initialize(InitializeParams {
workspace_root: None,
source_dir: None,
manifest_path: manifest_path.to_path_buf(),
project_model,
Expand Down
49 changes: 13 additions & 36 deletions crates/pixi-build-backend/src/intermediate_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ use rattler_build::{
parser::{BuildString, find_outputs_from_src},
variable::Variable,
},
render::resolved_dependencies::{
DependencyInfo, FinalizedDependencies, FinalizedRunDependencies, ResolvedDependencies,
},
render::resolved_dependencies::DependencyInfo,
selectors::SelectorConfig,
source_code::Source,
system_tools::SystemTools,
Expand All @@ -60,7 +58,9 @@ use crate::{
},
generated_recipe::{BackendConfig, GenerateRecipe, PythonParams},
protocol::{Protocol, ProtocolInstantiator},
specs_conversion::from_source_matchspec_into_package_spec,
specs_conversion::{
from_build_v1_args_to_finalized_dependencies, from_source_matchspec_into_package_spec,
},
tools::{OneOrMultipleOutputs, output_directory},
utils::TemporaryRenderedRecipe,
};
Expand Down Expand Up @@ -174,11 +174,9 @@ where
T::Config: Send + Sync + 'static,
{
fn debug_dir(configuration: Option<serde_json::Value>) -> Option<PathBuf> {
let config = configuration
configuration
.and_then(|config| serde_json::from_value::<T::Config>(config).ok())
.and_then(|config| config.debug_dir().map(|d| d.to_path_buf()));

config
.and_then(|config| config.debug_dir().map(|d| d.to_path_buf()))
}

async fn initialize(
Expand Down Expand Up @@ -1179,34 +1177,13 @@ where
debug: Debug::new(false),
exclude_newer: None,
},
// TODO: We should pass these values to the build backend from pixi
finalized_dependencies: Some(FinalizedDependencies {
build: Some(ResolvedDependencies {
specs: vec![],
resolved: params
.build_prefix
.map(|prefix| prefix.packages)
.unwrap_or_default()
.into_iter()
.map(|pkg| pkg.repodata_record)
.collect(),
}),
host: Some(ResolvedDependencies {
specs: vec![],
resolved: params
.host_prefix
.map(|prefix| prefix.packages)
.unwrap_or_default()
.into_iter()
.map(|pkg| pkg.repodata_record)
.collect(),
}),
run: FinalizedRunDependencies {
depends: vec![],
constraints: vec![],
run_exports: Default::default(),
},
}),
finalized_dependencies: Some(from_build_v1_args_to_finalized_dependencies(
params.build_prefix,
params.host_prefix,
params.run_dependencies,
params.run_constraints,
params.run_exports,
)),
finalized_sources: None,
finalized_cache_dependencies: None,
finalized_cache_sources: None,
Expand Down
107 changes: 106 additions & 1 deletion crates/pixi-build-backend/src/specs_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ use std::sync::Arc;
use ordermap::OrderMap;
use pixi_build_types::{
BinaryPackageSpecV1, PackageSpecV1, SourcePackageSpecV1, TargetV1, TargetsV1,
procedures::conda_build_v1::{
CondaBuildV1Dependency, CondaBuildV1DependencySource, CondaBuildV1Prefix,
CondaBuildV1RunExports,
},
};
use rattler_conda_types::{Channel, MatchSpec, PackageName};
use rattler_build::render::resolved_dependencies::{
DependencyInfo, FinalizedDependencies, FinalizedRunDependencies, ResolvedDependencies,
RunExportDependency, SourceDependency,
};
use rattler_conda_types::{Channel, MatchSpec, PackageName, package::RunExportsJson};
use recipe_stage0::{
matchspec::{PackageDependency, SourceMatchSpec},
recipe::{Conditional, ConditionalList, ConditionalRequirements, Item, ListOrItem},
Expand Down Expand Up @@ -240,6 +248,103 @@ pub fn target_to_package_spec(target: &TargetV1) -> PackageSpecDependencies<Pack
bin_reqs
}

pub(crate) fn from_build_v1_dependency_to_dependency_info(
spec: CondaBuildV1Dependency,
) -> DependencyInfo {
match spec.source {
Some(CondaBuildV1DependencySource::RunExport(run_export)) => {
DependencyInfo::RunExport(RunExportDependency {
spec: spec.spec,
from: run_export.from,
source_package: run_export.package_name.as_normalized().to_string(),
})
}
None => DependencyInfo::Source(SourceDependency { spec: spec.spec }),
}
}

pub(crate) fn from_build_v1_run_exports_to_run_exports(
run_exports: CondaBuildV1RunExports,
) -> RunExportsJson {
RunExportsJson {
weak: run_exports
.weak
.into_iter()
.map(|dep| dep.spec.to_string())
.collect(),
strong: run_exports
.strong
.into_iter()
.map(|dep| dep.spec.to_string())
.collect(),
noarch: run_exports
.noarch
.into_iter()
.map(|dep| dep.spec.to_string())
.collect(),
strong_constrains: run_exports
.strong_constrains
.into_iter()
.map(|dep| dep.spec.to_string())
.collect(),
weak_constrains: run_exports
.weak_constrains
.into_iter()
.map(|dep| dep.spec.to_string())
.collect(),
}
}

pub fn from_build_v1_args_to_finalized_dependencies(
build_prefix: Option<CondaBuildV1Prefix>,
host_prefix: Option<CondaBuildV1Prefix>,
run_dependencies: Option<Vec<CondaBuildV1Dependency>>,
run_constraints: Option<Vec<CondaBuildV1Dependency>>,
run_exports: Option<CondaBuildV1RunExports>,
) -> FinalizedDependencies {
FinalizedDependencies {
build: build_prefix.map(|prefix| ResolvedDependencies {
specs: prefix
.dependencies
.into_iter()
.map(from_build_v1_dependency_to_dependency_info)
.collect(),
resolved: prefix
.packages
.into_iter()
.map(|pkg| pkg.repodata_record)
.collect(),
}),
host: host_prefix.map(|prefix| ResolvedDependencies {
specs: prefix
.dependencies
.into_iter()
.map(from_build_v1_dependency_to_dependency_info)
.collect(),
resolved: prefix
.packages
.into_iter()
.map(|pkg| pkg.repodata_record)
.collect(),
}),
run: FinalizedRunDependencies {
depends: run_dependencies
.unwrap_or_default()
.into_iter()
.map(from_build_v1_dependency_to_dependency_info)
.collect(),
constraints: run_constraints
.unwrap_or_default()
.into_iter()
.map(from_build_v1_dependency_to_dependency_info)
.collect(),
run_exports: run_exports
.map(from_build_v1_run_exports_to_run_exports)
.unwrap_or_default(),
},
}
}

#[cfg(test)]
mod test {
use super::*;
Expand Down
1 change: 1 addition & 0 deletions crates/pixi-build-backend/src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub struct LoadedVariantConfig {
impl LoadedVariantConfig {
/// Load variant configuration from a recipe path. This checks if there is a
/// `variants.yaml` and loads it alongside the recipe.
#[allow(clippy::result_large_err)]
pub fn from_recipe_path(
source_dir: &Path,
recipe_path: &Path,
Expand Down
6 changes: 2 additions & 4 deletions crates/pixi-build-backend/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ impl ProjectModel for pbt::ProjectModelV1 {
.flat_map(|target| target.run_dependencies(platform))
.collect_vec();

let used_variants = build_dependencies
build_dependencies
.iter()
.chain(host_dependencies.iter())
.chain(run_dependencies.iter())
.filter(|(_, spec)| spec.can_be_used_as_variant())
.map(|(name, _)| name.as_str().into())
.collect();

used_variants
.collect()
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/pixi-build-backend/src/utils/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ where
Arc::new(T::default()),
)
.initialize(InitializeParams {
workspace_root: None,
source_dir,
manifest_path,
project_model: project_model.map(Into::into),
Expand Down
1 change: 1 addition & 0 deletions crates/pixi-build-cmake/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ mod tests {
Arc::default(),
)
.initialize(InitializeParams {
workspace_root: None,
source_dir: None,
manifest_path: PathBuf::from("pixi.toml"),
project_model: Some(project_model.into()),
Expand Down
Loading
Loading