diff options
Diffstat (limited to 'release/src/build.rs')
| -rw-r--r-- | release/src/build.rs | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/release/src/build.rs b/release/src/build.rs deleted file mode 100644 index 7c777d36c..000000000 --- a/release/src/build.rs +++ /dev/null | |||
| @@ -1,50 +0,0 @@ | |||
| 1 | use anyhow::Result; | ||
| 2 | |||
| 3 | use crate::cargo::{CargoArgsBuilder, CargoBatchBuilder}; | ||
| 4 | |||
| 5 | pub(crate) fn build(ctx: &crate::Context, crate_name: Option<&str>) -> Result<()> { | ||
| 6 | let mut batch_builder = CargoBatchBuilder::new(); | ||
| 7 | |||
| 8 | // Process either specific crate or all crates | ||
| 9 | let crates_to_build: Vec<_> = if let Some(name) = crate_name { | ||
| 10 | // Build only the specified crate | ||
| 11 | if let Some(krate) = ctx.crates.get(name) { | ||
| 12 | vec![krate] | ||
| 13 | } else { | ||
| 14 | return Err(anyhow::anyhow!("Crate '{}' not found", name)); | ||
| 15 | } | ||
| 16 | } else { | ||
| 17 | // Build all crates | ||
| 18 | ctx.crates.values().collect() | ||
| 19 | }; | ||
| 20 | |||
| 21 | // Process selected crates and add their build configurations to the batch | ||
| 22 | for krate in crates_to_build { | ||
| 23 | for config in &krate.configs { | ||
| 24 | let mut args_builder = CargoArgsBuilder::new() | ||
| 25 | .subcommand("build") | ||
| 26 | .arg("--release") | ||
| 27 | .arg(format!("--manifest-path={}/Cargo.toml", krate.path.to_string_lossy())); | ||
| 28 | |||
| 29 | if let Some(ref target) = config.target { | ||
| 30 | args_builder = args_builder.target(target); | ||
| 31 | } | ||
| 32 | |||
| 33 | if !config.features.is_empty() { | ||
| 34 | args_builder = args_builder.features(&config.features); | ||
| 35 | } | ||
| 36 | |||
| 37 | if let Some(ref artifact_dir) = config.artifact_dir { | ||
| 38 | args_builder = args_builder.artifact_dir(artifact_dir); | ||
| 39 | } | ||
| 40 | |||
| 41 | batch_builder.add_command(args_builder.build()); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | // Execute the cargo batch command | ||
| 46 | let batch_args = batch_builder.build(); | ||
| 47 | crate::cargo::run(&batch_args, &ctx.root)?; | ||
| 48 | |||
| 49 | Ok(()) | ||
| 50 | } | ||
