diff --git a/crates/pixi-build-mojo/src/main.rs b/crates/pixi-build-mojo/src/main.rs index be0ca07d..f6e72bc7 100644 --- a/crates/pixi-build-mojo/src/main.rs +++ b/crates/pixi-build-mojo/src/main.rs @@ -75,35 +75,7 @@ impl GenerateRecipe for MojoGenerator { // rattler-build selectors with simple string comparison. let model_dependencies = model.dependencies(Some(host_platform)); - // Get the list of compilers from config, defaulting to ["mojo"] if not specified - let mut compilers = config - .compilers - .clone() - .unwrap_or_else(|| vec!["mojo".to_string()]); - - // Handle mojo compiler specially if it's in the list - if let Some(idx) = compilers.iter().position(|name| name == "mojo") { - let mojo_compiler_pkg = "mojo-compiler"; - // All of these packages also contain the mojo compiler and maintain backward compat. - // They should be removable at a future point. - let alt_names = ["max", "mojo", "modular"]; - - let mojo_pkg_name = pixi_build_types::SourcePackageName::from(mojo_compiler_pkg); - if !model_dependencies.build.contains_key(&mojo_pkg_name) - && !alt_names.iter().any(|alt| { - model_dependencies - .build - .contains_key(&pixi_build_types::SourcePackageName::from(*alt)) - }) - { - requirements - .build - .push(mojo_compiler_pkg.parse().into_diagnostic()?); - } - - // Remove the mojo compiler from the list of compilers. - compilers.swap_remove(idx); - } + let compilers = config.compilers.clone().unwrap_or_default(); pixi_build_backend::compilers::add_compilers_to_requirements( &compilers, @@ -451,7 +423,7 @@ mod tests { .generate_recipe( &project_model, &MojoBackendConfig { - compilers: Some(vec!["mojo".to_string(), "c".to_string(), "cxx".to_string()]), + compilers: Some(vec!["c".to_string(), "cxx".to_string()]), ..Default::default() }, temp.path().to_path_buf(), @@ -465,12 +437,6 @@ mod tests { // Check that we have both the mojo-compiler package and the additional compilers let build_reqs = &generated_recipe.recipe.requirements.build; - // Check for mojo-compiler package (should be present) - let has_mojo_compiler = build_reqs - .iter() - .any(|item| format!("{item:?}").contains("mojo-compiler")); - assert!(has_mojo_compiler, "Should have mojo-compiler package"); - // Check for additional compiler templates let compiler_templates: Vec = build_reqs .iter() @@ -544,15 +510,6 @@ mod tests { // Check that we have only the mojo-compiler package by default let build_reqs = &generated_recipe.recipe.requirements.build; - // Check for mojo-compiler package (should be present by default) - let has_mojo_compiler = build_reqs - .iter() - .any(|item| format!("{item:?}").contains("mojo-compiler")); - assert!( - has_mojo_compiler, - "Should have mojo-compiler package by default" - ); - // Check that no additional compiler templates are present let compiler_templates: Vec = build_reqs .iter() diff --git a/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__compiler_is_in_build_requirements.snap b/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__compiler_is_in_build_requirements.snap index d324462a..c8a4aabc 100644 --- a/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__compiler_is_in_build_requirements.snap +++ b/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__compiler_is_in_build_requirements.snap @@ -11,8 +11,7 @@ build: number: ~ script: "[ ... script ... ]" requirements: - build: - - mojo-compiler + build: [] host: [] run: - boltons diff --git a/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__mojo_bin_is_set.snap b/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__mojo_bin_is_set.snap index a9bc2012..f77db32a 100644 --- a/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__mojo_bin_is_set.snap +++ b/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__mojo_bin_is_set.snap @@ -14,8 +14,7 @@ build: env: {} secrets: [] requirements: - build: - - mojo-compiler + build: [] host: [] run: - boltons diff --git a/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__mojo_pkg_is_set.snap b/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__mojo_pkg_is_set.snap index 42748276..9600ba90 100644 --- a/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__mojo_pkg_is_set.snap +++ b/crates/pixi-build-mojo/src/snapshots/pixi_build_mojo__tests__mojo_pkg_is_set.snap @@ -14,8 +14,7 @@ build: env: {} secrets: [] requirements: - build: - - mojo-compiler + build: [] host: [] run: - boltons diff --git a/docs/backends/pixi-build-mojo.md b/docs/backends/pixi-build-mojo.md index c1127945..058b7d43 100644 --- a/docs/backends/pixi-build-mojo.md +++ b/docs/backends/pixi-build-mojo.md @@ -140,7 +140,7 @@ The auto-derive feature supports various common project layouts: ### Required Dependencies -- `max` package for both the compiler and linked runtime +- `mojo` / `mojo-compiler` package for both the compiler and linked runtime ## Configuration Options @@ -177,32 +177,27 @@ extra-input-globs = ["**/*.c", "assets/**/*", "*.md"] ### `compilers` - **Type**: `Array` -- **Default**: `["mojo"]` +- **Default**: `[]` - **Target Merge Behavior**: `Overwrite` - Platform-specific compilers completely replace base compilers -List of compilers to use for the build. The mojo compiler is handled specially and uses the `mojo-compiler` package, while other compilers use conda-forge's standard compiler infrastructure. +List of compilers to use for the build. Compilers use conda-forge's standard compiler infrastructure. ```toml [package.build.config] -compilers = ["mojo", "c", "cxx"] +compilers = ["c", "cxx"] ``` For target-specific configuration, platform compilers completely replace the base configuration: ```toml [package.build.config] -compilers = ["mojo"] +compilers = [] [package.build.target.linux-64.config] -compilers = ["mojo", "c", "cuda"] +compilers = ["c", "cuda"] # Result for linux-64: ["mojo", "c", "cuda"] ``` -**Special mojo compiler behavior:** -- When `mojo` is included in the compilers list, the backend automatically adds the `mojo-compiler` package to build requirements -- You can opt out of the mojo compiler entirely by specifying a list without `"mojo"`, e.g., `compilers = ["c", "cxx"]` -- The mojo compiler does not use the standard conda-forge compiler template system like other compilers - !!! info "Comprehensive Compiler Documentation" For detailed information about available compilers, platform-specific behavior, and how conda-forge compilers work, see the [Compilers Documentation](../key_concepts/compilers.md). Note that the mojo compiler has special behavior as described above. diff --git a/docs/key_concepts/compilers.md b/docs/key_concepts/compilers.md index 91de8758..05c09203 100644 --- a/docs/key_concepts/compilers.md +++ b/docs/key_concepts/compilers.md @@ -133,12 +133,6 @@ The table below lists the core compilers, specialized compilers, and some backen |----------|-------------|-----------| | `cuda` | NVIDIA CUDA compiler | Linux, Windows, (limited macOS) | -### Backend-Specific Compilers - -| Compiler | Description | Backend | Special Behavior | -|----------|-------------|---------|------------------| -| `mojo` | Mojo compiler | pixi-build-mojo | Uses `mojo-compiler` package instead of template | - ## Backend-Specific Defaults Only certain `pixi-build` backends support the `compilers` configuration option. Each supporting backend has sensible defaults based on the typical requirements for that language ecosystem: @@ -148,7 +142,7 @@ Only certain `pixi-build` backends support the `compilers` configuration option. | **[pixi-build-cmake](../backends/pixi-build-cmake.md#compilers)** | ✅ **Supported** | `["cxx"]` | Most CMake projects are C++ | | **[pixi-build-rust](../backends/pixi-build-rust.md#compilers)** | ✅ **Supported** | `["rust"]` | Rust projects need the Rust compiler | | **[pixi-build-python](../backends/pixi-build-python.md#compilers)** | ✅ **Supported** | `[]` | Pure Python packages typically don't need compilers | -| **[pixi-build-mojo](../backends/pixi-build-mojo.md#compilers)** | ✅ **Supported** | `["mojo"]` | Mojo projects need the Mojo compiler | +| **[pixi-build-mojo](../backends/pixi-build-mojo.md#compilers)** | ✅ **Supported** | `[]` | `mojo-compiler` must be specified in the `package.*-dependencies` manually. | | **pixi-build-rattler-build** | ❌ **Not Supported** | N/A | Uses direct `recipe.yaml` - configure compilers directly in recipe | !!! info "Adding Compiler Support to Other Backends"