Skip to content

Commit

Permalink
feat: add new pixi-build-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
nichmor committed Nov 20, 2024
1 parent f336507 commit 77a473f
Show file tree
Hide file tree
Showing 9 changed files with 1,034 additions and 836 deletions.
1,806 changes: 988 additions & 818 deletions Cargo.lock

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ clap-verbosity-flag = "2.2.1"
tracing-subscriber = "0.3.18"
serde_yaml = "0.9.33"
serde = "1.0"
indexmap = "2.6.0"
minijinja = "2.3.0"

parking_lot = "0.12.3"
Expand All @@ -28,18 +29,26 @@ jsonrpc-stdio-server = "18.0.0"
jsonrpc-http-server = "18.0.0"
jsonrpc-core = "18.0.0"

rattler-build = { git = "https://github.com/prefix-dev/rattler-build", branch = "main", default-features = false }
rattler_conda_types = "0.28.2"
rattler_package_streaming = "0.22.10"
rattler_virtual_packages = "1.1.7"
url = "2.5.3"

rattler-build = { git = "https://github.com/nichmor/rattler-build", branch = "feat/pixi-build", default-features = false }

rattler_conda_types = { version = "0.29.1", default-features = false }
rattler_package_streaming = { version = "0.22.14", default-features = false }
rattler_virtual_packages = { version = "1.1.10", default-features = false }
rattler_lock = { version = "0.22.31", default-features = false }


#pixi_build_types = { path = "../pixi-build-branch/crates/pixi_build_types" }
#pixi_consts = { path = "../pixi-build-branch/crates/pixi_consts" }
#pixi_manifest = { path = "../pixi-build-branch/crates/pixi_manifest" }
#pixi_spec = { path = "../pixi-build-branch/crates/pixi_spec" }

pixi_build_types = { git = "https://github.com/prefix-dev/pixi", branch = "feature/pixi-build" }
pixi_consts = { git = "https://github.com/prefix-dev/pixi", branch = "feature/pixi-build" }
pixi_manifest = { git = "https://github.com/prefix-dev/pixi", branch = "feature/pixi-build" }
pixi_spec = { git = "https://github.com/prefix-dev/pixi", branch = "feature/pixi-build" }



[patch.crates-io]
rattler_conda_types = { git = "https://github.com/conda/rattler", branch = "main"}
rattler_package_streaming = { git = "https://github.com/conda/rattler", branch = "main"}
rattler_virtual_packages = { git = "https://github.com/conda/rattler", branch = "main"}
rattler_lock = { git = "https://github.com/conda/rattler", branch = "main"}
2 changes: 2 additions & 0 deletions crates/pixi-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ serde_yaml = { workspace = true }
serde = { workspace = true, features = ["derive"] }
minijinja = { workspace = true }
itertools = { workspace = true }
url = { workspace = true }
indexmap = { workspace = true }

parking_lot = { workspace = true }

Expand Down
4 changes: 2 additions & 2 deletions crates/pixi-build/src/bin/pixi-build-cmake/cmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl CMakeBuildBackend {
.expect("the project manifest must reside in a directory");

// Parse the package name from the manifest
let Some(name) = self.manifest.parsed.project.name.clone() else {
let Some(name) = self.manifest.workspace.workspace.name.clone() else {
miette::bail!("a 'name' field is required in the project manifest");
};
let name = PackageName::from_str(&name).into_diagnostic()?;
Expand Down Expand Up @@ -294,7 +294,7 @@ impl CMakeBuildBackend {
work_directory: &Path,
) -> miette::Result<BuildConfiguration> {
// Parse the package name from the manifest
let Some(name) = self.manifest.parsed.project.name.clone() else {
let Some(name) = self.manifest.workspace.workspace.name.clone() else {
miette::bail!("a 'name' field is required in the project manifest");
};
let name = PackageName::from_str(&name).into_diagnostic()?;
Expand Down
4 changes: 2 additions & 2 deletions crates/pixi-build/src/bin/pixi-build-python/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl PythonBuildBackend {
.expect("the project manifest must reside in a directory");

// Parse the package name from the manifest
let Some(name) = self.manifest.parsed.project.name.clone() else {
let Some(name) = self.manifest.workspace.workspace.name.clone() else {
miette::bail!("a 'name' field is required in the project manifest");
};
let name = PackageName::from_str(&name).into_diagnostic()?;
Expand Down Expand Up @@ -267,7 +267,7 @@ impl PythonBuildBackend {
work_directory: &Path,
) -> miette::Result<BuildConfiguration> {
// Parse the package name from the manifest
let Some(name) = self.manifest.parsed.project.name.clone() else {
let Some(name) = self.manifest.workspace.workspace.name.clone() else {
miette::bail!("a 'name' field is required in the project manifest");
};
let name = PackageName::from_str(&name).into_diagnostic()?;
Expand Down
1 change: 1 addition & 0 deletions crates/pixi-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ pub mod server;
mod consts;
pub mod dependencies;
pub mod manifest_ext;
pub mod tools;
pub mod utils;
17 changes: 11 additions & 6 deletions crates/pixi-build/src/manifest_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,25 @@ pub trait ManifestExt {
channel_config: &ChannelConfig,
) -> Result<Vec<Url>, ParseChannelError> {
self.manifest()
.parsed
.project
.workspace
.workspace
.channels
.iter()
.map(|c| c.channel.clone().into_base_url(channel_config))
.map(|c| {
c.channel
.clone()
.into_base_url(channel_config)
.map(|cl| cl.url().as_ref().clone())
})
.collect()
}

/// Returns `true` if the manifest is configured to use the specified
/// platform.
fn supports_target_platform(&self, platform: Platform) -> bool {
self.manifest()
.parsed
.project
.workspace
.workspace
.platforms
.value
.contains(&platform)
Expand All @@ -48,7 +53,7 @@ pub trait ManifestExt {
/// Note that this may be `None` because having a version is not required.
/// Use [`Self::version_or_default`] to get a default version in that case.
fn version(&self) -> Option<&Version> {
self.manifest().parsed.project.version.as_ref()
self.manifest().workspace.workspace.version.as_ref()
}

/// Returns the version of the project or a default version if no version is
Expand Down
2 changes: 2 additions & 0 deletions crates/pixi-build/src/utils/temporary_recipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ impl TemporaryRenderedRecipe {
.into_diagnostic()
.context("failed to create output directory")?;

eprintln!("I have created the output directory");

let (recipe_file, recipe_path) = tempfile::Builder::new()
.prefix(".rendered-recipe")
.suffix(".yaml")
Expand Down
9 changes: 9 additions & 0 deletions recipe/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ outputs:
- bin/pixi-build-cmake.exe
tests:
- script: pixi-build-cmake --help

- package:
name: pixi-build-rattler-build
build:
files:
- bin/pixi-build-rattler-build
- bin/pixi-build-rattler-build.exe
tests:
- script: pixi-build-rattler-build --help

0 comments on commit 77a473f

Please sign in to comment.