Skip to content
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
9 changes: 8 additions & 1 deletion crates/pixi_build_types/src/procedures/conda_build_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
path::PathBuf,
};

use rattler_conda_types::{PackageName, Platform, VersionWithSource};
use rattler_conda_types::{ChannelUrl, PackageName, Platform, VersionWithSource};
use serde::{Deserialize, Serialize};

pub const METHOD_NAME: &str = "conda/build_v1";
Expand All @@ -19,6 +19,13 @@ pub const METHOD_NAME: &str = "conda/build_v1";
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CondaBuildV1Params {
/// The canonical channel URLs that define where dependencies will be
/// fetched from. Although this information is not immediately useful for
/// the backend, the backend may choose to generate a different recipe based
/// on the channels.
#[serde(default)]
pub channels: Vec<ChannelUrl>,

/// The path to the build prefix, or `None` if no build prefix is created.
pub build_prefix: Option<CondaBuildV1Prefix>,

Expand Down
9 changes: 8 additions & 1 deletion crates/pixi_build_types/src/procedures/conda_outputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
};

use ordermap::OrderSet;
use rattler_conda_types::{NoArchType, PackageName, Platform, VersionWithSource};
use rattler_conda_types::{ChannelUrl, NoArchType, PackageName, Platform, VersionWithSource};
use serde::{Deserialize, Serialize};
use serde_with::serde_as;

Expand All @@ -27,6 +27,13 @@ pub const METHOD_NAME: &str = "conda/outputs";
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CondaOutputsParams {
/// The canonical channel URLs that define where dependencies will be
/// fetched from. Although this information is not immediately useful for
/// the backend, the backend may choose to generate a different recipe based
/// on the channels.
#[serde(default)]
pub channels: Vec<ChannelUrl>,

/// The native platform for which the outputs should be computed.
///
/// This is usually the same platform as the platform on which the backend
Expand Down
13 changes: 9 additions & 4 deletions crates/pixi_command_dispatcher/src/backend_source_build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ pub struct BackendSourceBuildSpec {
/// The method to use for building the source package.
pub method: BackendSourceBuildMethod,

/// The channels to use for solving.
pub channels: Vec<ChannelUrl>,

/// The working directory to use for the build.
pub work_directory: PathBuf,
}
Expand All @@ -63,9 +66,6 @@ pub struct BackendSourceBuildV0Method {
/// The channel configuration to use when resolving metadata
pub channel_config: ChannelConfig,

/// The channels to use for solving.
pub channels: Vec<ChannelUrl>,

/// Information about the platform to install build tools for and the
/// platform to target.
pub build_environment: BuildEnvironment,
Expand Down Expand Up @@ -140,6 +140,7 @@ impl BackendSourceBuildSpec {
self.source,
params,
self.work_directory,
self.channels,
log_sink,
)
.await
Expand All @@ -150,6 +151,7 @@ impl BackendSourceBuildSpec {
self.package,
params,
self.work_directory,
self.channels,
log_sink,
)
.await
Expand All @@ -163,6 +165,7 @@ impl BackendSourceBuildSpec {
source: PinnedSourceSpec,
params: BackendSourceBuildV0Method,
work_directory: PathBuf,
channels: Vec<ChannelUrl>,
mut log_sink: UnboundedSender<String>,
) -> Result<BackendBuiltSource, CommandDispatcherError<BackendSourceBuildError>> {
// Use the backend to build the source package.
Expand All @@ -172,7 +175,7 @@ impl BackendSourceBuildSpec {
build_platform_virtual_packages: Some(
params.build_environment.build_virtual_packages,
),
channel_base_urls: Some(params.channels.into_iter().map(Into::into).collect()),
channel_base_urls: Some(channels.into_iter().map(Into::into).collect()),
channel_configuration: ChannelConfiguration {
base_url: params.channel_config.channel_alias.clone(),
},
Expand Down Expand Up @@ -262,11 +265,13 @@ impl BackendSourceBuildSpec {
record: PackageIdentifier,
params: BackendSourceBuildV1Method,
work_directory: PathBuf,
channels: Vec<ChannelUrl>,
mut log_sink: UnboundedSender<String>,
) -> Result<BackendBuiltSource, CommandDispatcherError<BackendSourceBuildError>> {
let built_package = backend
.conda_build_v1(
CondaBuildV1Params {
channels,
build_prefix: Some(CondaBuildV1Prefix {
prefix: params.build_prefix.prefix,
platform: params.build_prefix.platform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ impl BuildBackendMetadataSpec {
project_model_hash: Option<Vec<u8>>,
) -> Result<CachedCondaMetadata, CommandDispatcherError<BuildBackendMetadataError>> {
let params = CondaOutputsParams {
channels: self.channels,
host_platform: self.build_environment.host_platform,
build_platform: self.build_environment.build_platform,
variant_configuration: self.variants.map(|variants| variants.into_iter().collect()),
Expand Down
4 changes: 3 additions & 1 deletion crates/pixi_command_dispatcher/src/source_build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ impl SourceBuildSpec {
method: BackendSourceBuildMethod::BuildV0(BackendSourceBuildV0Method {
editable: self.editable(),
channel_config: self.channel_config,
channels: self.channels,
build_environment: self.build_environment,
variants: self.variants,
output_directory: self.output_directory,
Expand All @@ -315,6 +314,7 @@ impl SourceBuildSpec {
package: self.package,
source: self.source,
work_directory,
channels: self.channels,
})
.await
.map_err_with(SourceBuildError::from)?;
Expand Down Expand Up @@ -347,6 +347,7 @@ impl SourceBuildSpec {
build_platform,
variant_configuration: self.variants.clone(),
work_directory: work_directory.clone(),
channels: self.channels.clone(),
})
.await
.map_err(BackendSourceBuildError::BuildError)
Expand Down Expand Up @@ -497,6 +498,7 @@ impl SourceBuildSpec {
package: self.package,
source: self.source,
work_directory,
channels: self.channels,
})
.await
.map_err_with(SourceBuildError::from)?;
Expand Down
Loading