Skip to content

Commit bfddc6b

Browse files
authored
feat: improve package.xml and recipe.yaml discovery (#4808)
1 parent b4fcf7b commit bfddc6b

17 files changed

+82
-88
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/pixi/tests/integration_rust/add_tests.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ async fn add_git_deps() {
695695

696696
let pixi = PixiControl::from_manifest(
697697
r#"
698-
[project]
698+
[workspace]
699699
name = "test-channel-change"
700700
channels = ["https://prefix.dev/conda-forge"]
701701
platforms = ["win-64"]
@@ -750,7 +750,7 @@ async fn add_git_deps_with_creds() {
750750

751751
let pixi = PixiControl::from_manifest(
752752
r#"
753-
[project]
753+
[workspace]
754754
name = "test-channel-change"
755755
channels = ["https://prefix.dev/conda-forge"]
756756
platforms = ["linux-64"]
@@ -805,10 +805,10 @@ async fn add_git_with_specific_commit() {
805805

806806
let pixi = PixiControl::from_manifest(
807807
r#"
808-
[project]
808+
[workspace]
809809
name = "test-channel-change"
810810
channels = ["https://prefix.dev/conda-forge"]
811-
platforms = ["win-64"]
811+
platforms = ["linux-64"]
812812
preview = ['pixi-build']"#,
813813
)
814814
.unwrap();
@@ -826,7 +826,7 @@ preview = ['pixi-build']"#,
826826
let git_package = lock
827827
.default_environment()
828828
.unwrap()
829-
.packages(Platform::Win64)
829+
.packages(Platform::Linux64)
830830
.unwrap()
831831
.find(|p| p.as_conda().unwrap().location().as_str().contains("git+"));
832832

@@ -857,7 +857,7 @@ async fn add_git_with_tag() {
857857

858858
let pixi = PixiControl::from_manifest(
859859
r#"
860-
[project]
860+
[workspace]
861861
name = "test-channel-change"
862862
channels = ["https://prefix.dev/conda-forge"]
863863
platforms = ["win-64"]
@@ -910,7 +910,7 @@ async fn add_plain_ssh_url() {
910910

911911
let pixi = PixiControl::from_manifest(
912912
r#"
913-
[project]
913+
[workspace]
914914
name = "test-channel-change"
915915
channels = ["https://prefix.dev/conda-forge"]
916916
platforms = ["linux-64"]
@@ -947,7 +947,7 @@ async fn add_pypi_git() {
947947
let pixi = PixiControl::from_manifest(
948948
format!(
949949
r#"
950-
[project]
950+
[workspace]
951951
name = "test-channel-change"
952952
channels = ["https://prefix.dev/conda-forge"]
953953
platforms = ["{platform}"]

crates/pixi/tests/integration_rust/snapshots/integration_rust__add_tests__add_git_deps-2.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
source: crates/pixi/tests/integration_rust/add_tests.rs
33
expression: pixi.workspace().unwrap().workspace.provenance.read().unwrap().into_inner()
44
---
5-
[project]
5+
[workspace]
66
name = "test-channel-change"
77
channels = ["https://prefix.dev/conda-forge"]
88
platforms = ["win-64"]

crates/pixi/tests/integration_rust/snapshots/integration_rust__add_tests__add_git_deps_with_creds-2.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
source: crates/pixi/tests/integration_rust/add_tests.rs
3-
expression: pixi.project().unwrap().manifest().source.to_string()
3+
expression: pixi.workspace().unwrap().modify().unwrap().manifest().document.to_string()
44
---
5-
[project]
5+
[workspace]
66
name = "test-channel-change"
77
channels = ["https://prefix.dev/conda-forge"]
88
platforms = ["linux-64"]

crates/pixi/tests/integration_rust/snapshots/integration_rust__add_tests__add_git_with_specific_commit-2.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
source: crates/pixi/tests/integration_rust/add_tests.rs
33
expression: pixi.workspace().unwrap().workspace.provenance.read().unwrap().into_inner()
44
---
5-
[project]
5+
[workspace]
66
name = "test-channel-change"
77
channels = ["https://prefix.dev/conda-forge"]
8-
platforms = ["win-64"]
8+
platforms = ["linux-64"]
99
preview = ['pixi-build']
1010

1111
[dependencies]

crates/pixi/tests/integration_rust/snapshots/integration_rust__add_tests__add_git_with_tag-2.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
source: crates/pixi/tests/integration_rust/add_tests.rs
33
expression: pixi.workspace().unwrap().workspace.provenance.read().unwrap().into_inner()
44
---
5-
[project]
5+
[workspace]
66
name = "test-channel-change"
77
channels = ["https://prefix.dev/conda-forge"]
88
platforms = ["win-64"]

crates/pixi/tests/integration_rust/snapshots/integration_rust__add_tests__add_plain_ssh_url.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
source: crates/pixi/tests/integration_rust/add_tests.rs
3-
expression: pixi.project().unwrap().manifest().source.to_string()
3+
expression: pixi.workspace().unwrap().workspace.provenance.read().unwrap().into_inner()
44
---
5-
[project]
5+
[workspace]
66
name = "test-channel-change"
77
channels = ["https://prefix.dev/conda-forge"]
88
platforms = ["linux-64"]

crates/pixi/tests/integration_rust/snapshots/integration_rust__add_tests__add_pypi_git.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
source: crates/pixi/tests/integration_rust/add_tests.rs
33
expression: pixi.workspace().unwrap().workspace.provenance.read().unwrap().into_inner()
44
---
5-
[project]
5+
[workspace]
66
name = "test-channel-change"
77
channels = ["https://prefix.dev/conda-forge"]
88
platforms = ["<PLATFORM>"]

crates/pixi_build_discovery/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ ordermap = { workspace = true }
1717
serde = { workspace = true, optional = true, features = ["derive"] }
1818
serde_json = { workspace = true }
1919
thiserror = { workspace = true }
20-
url = { workspace = true }
2120

2221
rattler_conda_types = { workspace = true }
2322

2423
pixi_build_type_conversions = { workspace = true }
2524
pixi_build_types = { workspace = true }
25+
pixi_config = { workspace = true }
2626
pixi_manifest = { workspace = true }
2727
pixi_spec = { workspace = true }
2828
pixi_spec_containers = { workspace = true }

crates/pixi_build_discovery/src/backend_spec.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
use std::str::FromStr;
2-
31
use pixi_spec::{BinarySpec, PixiSpec, SourceAnchor};
42
use pixi_spec_containers::DependencyMap;
5-
use rattler_conda_types::{Channel, ChannelConfig, ChannelUrl};
6-
use url::Url;
7-
3+
use rattler_conda_types::ChannelUrl;
84
/// Describes how a backend should be instantiated.
95
#[derive(Debug, Clone)]
106
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
@@ -149,42 +145,32 @@ impl EnvironmentSpec {
149145

150146
impl JsonRpcBackendSpec {
151147
/// Constructs a new default instance for spawning a recipe build backend.
152-
pub fn default_rattler_build(channel_config: &ChannelConfig) -> Self {
148+
pub fn default_rattler_build(channels: Vec<ChannelUrl>) -> Self {
153149
const DEFAULT_BUILD_TOOL: &str = "pixi-build-rattler-build";
154150

155-
let conda_forge_channel = Channel::from_name("conda-forge", channel_config).base_url;
156-
let backends_channel = Url::from_str("https://prefix.dev/pixi-build-backends")
157-
.unwrap()
158-
.into();
159-
160151
Self {
161152
name: DEFAULT_BUILD_TOOL.to_string(),
162153
command: CommandSpec::EnvironmentSpec(Box::new(EnvironmentSpec {
163154
requirement: (DEFAULT_BUILD_TOOL.parse().unwrap(), PixiSpec::any()),
164155
additional_requirements: Default::default(),
165156
constraints: Default::default(),
166-
channels: vec![conda_forge_channel, backends_channel],
157+
channels,
167158
command: None,
168159
})),
169160
}
170161
}
171162

172163
/// Constructs a new default instance for spawning a ROS build backend.
173-
pub fn default_ros_build(channel_config: &ChannelConfig) -> Self {
164+
pub fn default_ros_build(channels: Vec<ChannelUrl>) -> Self {
174165
const DEFAULT_BUILD_TOOL: &str = "pixi-build-ros";
175166

176-
let conda_forge_channel = Channel::from_name("conda-forge", channel_config).base_url;
177-
let backends_channel = Url::from_str("https://prefix.dev/pixi-build-backends")
178-
.unwrap()
179-
.into();
180-
181167
Self {
182168
name: DEFAULT_BUILD_TOOL.to_string(),
183169
command: CommandSpec::EnvironmentSpec(Box::new(EnvironmentSpec {
184170
requirement: (DEFAULT_BUILD_TOOL.parse().unwrap(), PixiSpec::any()),
185171
additional_requirements: Default::default(),
186172
constraints: Default::default(),
187-
channels: vec![conda_forge_channel, backends_channel],
173+
channels,
188174
command: None,
189175
})),
190176
}

0 commit comments

Comments
 (0)