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
15 changes: 8 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ clap = { version = "4.5.31", default-features = false }
clap_complete = "4.5.46"
clap_complete_nushell = "4.5.5"
# Rattler crates
coalesced_map = "0.1.1"
coalesced_map = "0.1.2"
concat-idents = "1.1.5"
console = "0.15.10"
console-subscriber = "0.4.1"
Expand Down Expand Up @@ -146,6 +146,7 @@ self-replace = "1.5.0"
serde = "1.0.218"
serde-untagged = "0.1.6"
serde-value = "0.7.0"
serde_derive = "*"
serde_ignored = "0.1.10"
serde_json = "1.0.139"
serde_with = "=3.14.0"
Expand Down
8 changes: 4 additions & 4 deletions crates/pixi_build_discovery/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct BackendInitializationParams {
pub workspace_root: PathBuf,

/// The location of the source code.
pub source: Option<SourceLocationSpec>,
pub build_source: Option<SourceLocationSpec>,

/// The anchor for relative paths to the location of the source code.
pub source_anchor: PathBuf,
Expand Down Expand Up @@ -202,7 +202,7 @@ impl DiscoveredBackend {
backend_spec: BackendSpec::JsonRpc(JsonRpcBackendSpec::default_rattler_build(channels)),
init_params: BackendInitializationParams {
workspace_root: source_dir.clone(),
source: None,
build_source: None,
source_anchor: source_dir,
manifest_path: recipe_absolute_path,
project_model: None,
Expand Down Expand Up @@ -273,7 +273,7 @@ impl DiscoveredBackend {
init_params: BackendInitializationParams {
workspace_root,
manifest_path: provenance.path.clone(),
source: build_system.source,
build_source: build_system.source,
source_anchor: provenance
.path
.parent()
Expand Down Expand Up @@ -374,7 +374,7 @@ impl DiscoveredBackend {
backend_spec: BackendSpec::JsonRpc(JsonRpcBackendSpec::default_ros_build(channels)),
init_params: BackendInitializationParams {
workspace_root: source_dir.clone(),
source: None,
build_source: None,
source_anchor: source_dir,
manifest_path: package_xml_absolute_path,
project_model: Some(ProjectModelV1::default()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ backend-spec:
- "https://prefix.dev/conda-forge"
init-params:
workspace-root: "file://<ROOT>/ros-package"
source: ~
build-source: ~
source-anchor: "file://<ROOT>/ros-package"
manifest-path: "file://<ROOT>/ros-package/package.xml"
project-model:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ backend-spec:
- "https://prefix.dev/conda-forge"
init-params:
workspace-root: "file://<ROOT>/recipe_yaml"
source: ~
build-source: ~
source-anchor: "file://<ROOT>/recipe_yaml"
manifest-path: "file://<ROOT>/recipe_yaml/recipe.yaml"
project-model: ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ backend-spec:
- "https://prefix.dev/pixi-build-backends"
init-params:
workspace-root: "file://<ROOT>/inherit"
source: ~
build-source: ~
source-anchor: "file://<ROOT>/inherit/nested"
manifest-path: "file://<ROOT>/inherit/nested/pixi.toml"
project-model:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ backend-spec:
- "https://prefix.dev/pixi-build-backends"
init-params:
workspace-root: "file://<ROOT>/nested"
source: ~
build-source: ~
source-anchor: "file://<ROOT>/nested/nested"
manifest-path: "file://<ROOT>/nested/nested/pixi.toml"
project-model:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ backend-spec:
- "https://prefix.dev/conda-forge"
init-params:
workspace-root: "file://<ROOT>/nested_recipe_yml"
source: ~
build-source: ~
source-anchor: "file://<ROOT>/nested_recipe_yml"
manifest-path: "file://<ROOT>/nested_recipe_yml/recipe/recipe.yml"
project-model: ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ backend-spec:
- "https://prefix.dev/conda-forge"
init-params:
workspace-root: "file://<ROOT>/recipe_yaml"
source: ~
build-source: ~
source-anchor: "file://<ROOT>/recipe_yaml"
manifest-path: "file://<ROOT>/recipe_yaml/recipe.yaml"
project-model: ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ backend-spec:
- "https://prefix.dev/conda-forge"
init-params:
workspace-root: "file://<ROOT>/recipe_yml"
source: ~
build-source: ~
source-anchor: "file://<ROOT>/recipe_yml"
manifest-path: "file://<ROOT>/recipe_yml/recipe.yml"
project-model: ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ backend-spec:
- "https://prefix.dev/pixi-build-backends"
init-params:
workspace-root: "file://<ROOT>/simple"
source: ~
build-source: ~
source-anchor: "file://<ROOT>/simple"
manifest-path: "file://<ROOT>/simple/pixi.toml"
project-model:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
source: crates/pixi_build_type_conversions/src/project_model.rs
expression: project_model
---
{
"version": "1",
"data": {
"name": "sdl_example",
"version": "0.1.0",
"description": null,
"authors": null,
"license": null,
"licenseFile": null,
"readme": null,
"homepage": null,
"repository": null,
"documentation": null,
"targets": {
"defaultTarget": {
"hostDependencies": {
"sdl2": {
"binary": {
"version": ">=2.26.5,<3.0",
"build": null,
"buildNumber": null,
"fileName": null,
"channel": null,
"subdir": null,
"md5": null,
"sha256": null,
"url": null,
"license": null
}
}
},
"buildDependencies": {},
"runDependencies": {}
},
"targets": {}
}
}
}
34 changes: 25 additions & 9 deletions crates/pixi_cli/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use pixi_utils::variants::VariantConfig;
use rattler_conda_types::{GenericVirtualPackage, Platform};
use tempfile::tempdir;

use crate::cli_config::WorkspaceConfig;
use crate::cli_config::{LockAndInstallConfig, WorkspaceConfig};

#[derive(Parser, Debug)]
#[clap(verbatim_doc_comment)]
Expand All @@ -27,6 +27,9 @@ pub struct Args {
#[clap(flatten)]
pub config_cli: ConfigCli,

#[clap(flatten)]
pub lock_and_install_config: LockAndInstallConfig,

/// The target platform to build for (defaults to the current platform)
#[clap(long, short, default_value_t = Platform::current())]
pub target_platform: Platform,
Expand Down Expand Up @@ -113,31 +116,43 @@ pub async fn execute(args: Args) -> miette::Result<()> {
manifest_path.display()
)
})?;
// Store the manifest location relative to the workspace root when possible to
// Determine the directory that contains the manifest.
let manifest_dir_canonical = if manifest_path_canonical.is_file() {
manifest_path_canonical.parent().ok_or_else(|| {
miette::miette!(
"explicit manifest path: {} doesn't have a parent",
manifest_path.display()
)
})?
} else {
manifest_path_canonical.as_path()
};

// Store the manifest directory relative to the workspace root when possible to
// keep the pinned path relocatable and avoid double-prefixing during resolution.
let manifest_spec_path = pathdiff::diff_paths(&manifest_path_canonical, workspace.root())
.unwrap_or(manifest_path_canonical.clone());
let manifest_dir_spec = pathdiff::diff_paths(manifest_dir_canonical, workspace.root())
.unwrap_or_else(|| manifest_dir_canonical.to_path_buf());
let channel_config = workspace.channel_config();
let channels = workspace
.default_environment()
.channel_urls(&channel_config)
.into_diagnostic()?;

// Determine the source of the package.
let source: PinnedSourceSpec = PinnedPathSpec {
path: manifest_spec_path.to_string_lossy().into_owned().into(),
let manifest_source: PinnedSourceSpec = PinnedPathSpec {
path: manifest_dir_spec.to_string_lossy().into_owned().into(),
}
.into();

// Create the build backend metadata specification.
let backend_metadata_spec = BuildBackendMetadataSpec {
source: source.clone(),
manifest_source: manifest_source.clone(),
channels: channels.clone(),
channel_config: channel_config.clone(),
build_environment: build_environment.clone(),
variants: Some(variants.clone()),
variant_files: Some(variant_files.clone()),
enabled_protocols: Default::default(),
pin_override: None,
};
let backend_metadata = command_dispatcher
.build_backend_metadata(backend_metadata_spec.clone())
Expand Down Expand Up @@ -168,7 +183,8 @@ pub async fn execute(args: Args) -> miette::Result<()> {
package,
// Build into a temporary directory first
output_directory: Some(temp_output_dir.path().to_path_buf()),
source: source.clone(),
manifest_source: manifest_source.clone(),
build_source: None,
channels: channels.clone(),
channel_config: channel_config.clone(),
build_environment: build_environment.clone(),
Expand Down
1 change: 1 addition & 0 deletions crates/pixi_cli/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
let updated_lock_file = UpdateContext::builder(&workspace)
.with_lock_file(relaxed_lock_file.clone())
.with_no_install(args.no_install)
.with_update_targets(specs.packages.clone())
.finish()
.await?
.update()
Expand Down
3 changes: 3 additions & 0 deletions crates/pixi_command_dispatcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ tokio = { workspace = true, features = ["macros"] }

[features]
slow_integration_tests = []

[package.metadata.cargo-machete]
ignored = ["serde_with"]
2 changes: 1 addition & 1 deletion crates/pixi_command_dispatcher/src/build/build_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl<'a> From<&'a DiscoveredBackend> for PackageBuildInputHash {

// These fields are not relevant for the package build input hash
workspace_root: _,
source: _,
build_source: _,
source_anchor: _,
manifest_path: _,
} = &value.init_params;
Expand Down
6 changes: 4 additions & 2 deletions crates/pixi_command_dispatcher/src/build/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ pub fn from_package_spec_v1(source: PackageSpecV1) -> pixi_spec::PixiSpec {
}

pub(crate) fn package_metadata_to_source_records(
source: &PinnedSourceSpec,
manifest_source: &PinnedSourceSpec,
build_source: Option<&PinnedSourceSpec>,
packages: &[CondaPackageMetadata],
package: &PackageName,
input_hash: &Option<InputHash>,
Expand All @@ -111,7 +112,8 @@ pub(crate) fn package_metadata_to_source_records(
.map(|p| {
SourceRecord {
input_hash: input_hash.clone(),
source: source.clone(),
manifest_source: manifest_source.clone(),
build_source: build_source.cloned(),
sources: p
.sources
.iter()
Expand Down
Loading
Loading