From eaaa18da4cce520b6d410102a6db19c353ef7fa3 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Tue, 30 Jul 2024 13:38:47 +0200 Subject: [PATCH] feat: make recipe generation optional --- Cargo.toml | 40 ++++++++++++++++++++++++++++++++-------- src/lib.rs | 1 + src/opt.rs | 5 ++++- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 22e0f6bf..7039a352 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,15 +15,39 @@ default-run = "rattler-build" [features] default = ['native-tls'] -native-tls = ['reqwest/native-tls', 'rattler/native-tls', 'rattler_installs_packages/native-tls'] -rustls-tls = ['reqwest/rustls-tls', 'reqwest/rustls-tls-native-roots', 'rattler/rustls-tls', 'rattler_installs_packages/rustls-tls'] -tui = ['ratatui', 'crossterm', 'ansi-to-tui', 'throbber-widgets-tui', 'tui-input'] +native-tls = [ + 'reqwest/native-tls', + 'rattler/native-tls', + 'rattler_installs_packages/native-tls', +] +rustls-tls = [ + 'reqwest/rustls-tls', + 'reqwest/rustls-tls-native-roots', + 'rattler/rustls-tls', + 'rattler_installs_packages/rustls-tls', +] +tui = [ + 'ratatui', + 'crossterm', + 'ansi-to-tui', + 'throbber-widgets-tui', + 'tui-input', +] +recipe-generation = ['rattler_installs_packages'] + generate-cli-docs = ["clap-markdown"] +[[bin]] +name = "rattler-build" +required-features = ["recipe-generation"] + [dependencies] serde = { version = "1.0.204", features = ["derive"] } serde_yaml = "0.9.34" -rattler = { version = "0.27.2", default-features = false, features = ["cli-tools", "indicatif"] } +rattler = { version = "0.27.2", default-features = false, features = [ + "cli-tools", + "indicatif", +] } rattler_conda_types = { version = "0.26.3", default-features = false } rattler_digest = { version = "0.19.5", default-features = false } rattler_index = { version = "0.19.21", default-features = false } @@ -36,7 +60,7 @@ rattler_shell = { version = "0.21.3", default-features = false, features = [ ] } rattler_solve = { version = "0.25.3", default-features = false, features = [ "resolvo", - "serde" + "serde", ] } rattler_virtual_packages = { version = "0.19.20", default-features = false } rattler_package_streaming = { version = "0.21.7", default-features = false } @@ -63,7 +87,7 @@ tracing-subscriber = { version = "0.3.18", features = [ "env-filter", "fmt", "ansi", - "json" + "json", ] } marked-yaml = { version = "0.7.1" } miette = { version = "7.2.0", features = ["fancy"] } @@ -106,7 +130,7 @@ zstd = "0.13.2" toml = "0.8.15" memmap2 = "0.9.4" reqwest-middleware = "0.3.2" -rattler_installs_packages = { version = "0.9.0", default-features = false } +rattler_installs_packages = { version = "0.9.0", default-features = false, optional = true } async-once-cell = "0.5.3" terminal_size = "0.3.0" memchr = "2.7.4" @@ -155,7 +179,7 @@ pre-build = [ #rattler_solve = { git = "https://github.com/baszalmstra/rattler", branch = "fix/quote_nushell_var" } #rattler_virtual_packages = { git = "https://github.com/baszalmstra/rattler", branch = "fix/quote_nushell_var" } #rattler_package_streaming = { git = "https://github.com/baszalmstra/rattler", branch = "fix/quote_nushell_var" } -clap-markdown = { git = "https://github.com/ruben-arts/clap-markdown", branch = "main"} +clap-markdown = { git = "https://github.com/ruben-arts/clap-markdown", branch = "main" } # rattler = { path = "../rattler/crates/rattler" } diff --git a/src/lib.rs b/src/lib.rs index 5155be1a..e3b7b400 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,6 +29,7 @@ mod linux; mod macos; mod post_process; pub mod rebuild; +#[cfg(feature = "recipe-generation")] pub mod recipe_generator; mod unix; pub mod upload; diff --git a/src/opt.rs b/src/opt.rs index 5756a497..bba44038 100644 --- a/src/opt.rs +++ b/src/opt.rs @@ -2,9 +2,11 @@ use std::{path::PathBuf, str::FromStr}; +#[cfg(feature = "recipe-generator")] +use crate::recipe_generator::GenerateRecipeOpts; + use crate::{ console_utils::{Color, LogStyle}, - recipe_generator::GenerateRecipeOpts, tool_configuration::SkipExisting, }; use clap::builder::ArgPredicate; @@ -45,6 +47,7 @@ pub enum SubCommands { /// Generate shell completion script Completion(ShellCompletion), + #[cfg(feature = "recipe-generator")] /// Generate a recipe from PyPI or CRAN GenerateRecipe(GenerateRecipeOpts),