diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 95433ee21..a282d23ec 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -33,7 +33,8 @@ use ignore::WalkBuilder; use indicatif::ProgressBar; use indoc::{formatdoc, printdoc}; use shuttle_common::models::deployment::{ - BuildArgsBeta, BuildMetaBeta, DeploymentRequestBuildArchiveBeta, DeploymentRequestImageBeta, + BuildArgsBeta, BuildArgsRustBeta, BuildMetaBeta, DeploymentRequestBuildArchiveBeta, + DeploymentRequestImageBeta, }; use shuttle_common::{ constants::{ @@ -1849,7 +1850,7 @@ impl Shuttle { }; if self.beta { - let mut build_args = BuildArgsBeta::default(); + let mut rust_build_args = BuildArgsRustBeta::default(); let metadata = async_cargo_metadata(manifest_path.as_path()).await?; let packages = find_shuttle_packages(&metadata)?; @@ -1858,7 +1859,7 @@ impl Shuttle { .first() .expect("at least one shuttle crate in the workspace"); let package_name = package.name.to_owned(); - build_args.package_name = Some(package_name); + rust_build_args.package_name = Some(package_name); // activate shuttle feature if present let (no_default_features, features) = if package.features.contains_key("shuttle") { @@ -1866,12 +1867,12 @@ impl Shuttle { } else { (false, None) }; - build_args.no_default_features = no_default_features; - build_args.features = features.map(|v| v.join(",")); + rust_build_args.no_default_features = no_default_features; + rust_build_args.features = features.map(|v| v.join(",")); // TODO: determine which (one) binary to build - deployment_req_buildarch_beta.build_args = Some(build_args); + deployment_req_buildarch_beta.build_args = Some(BuildArgsBeta::Rust(rust_build_args)); // TODO: have all of the above be configurable in CLI and Shuttle.toml } diff --git a/common/src/models/deployment.rs b/common/src/models/deployment.rs index 85f6daa67..63876e5ba 100644 --- a/common/src/models/deployment.rs +++ b/common/src/models/deployment.rs @@ -311,8 +311,16 @@ pub struct DeploymentRequestBuildArchiveBeta { pub build_meta: Option, } +#[derive(Deserialize, Serialize, Default)] +#[serde(tag = "type", content = "content")] +pub enum BuildArgsBeta { + Rust(BuildArgsRustBeta), + #[default] + Unknown, +} + #[derive(Deserialize, Serialize)] -pub struct BuildArgsBeta { +pub struct BuildArgsRustBeta { /// Use the built in cargo chef setup for caching pub cargo_chef: bool, /// Build with the built in `cargo build` setup @@ -329,7 +337,7 @@ pub struct BuildArgsBeta { pub mold: bool, } -impl Default for BuildArgsBeta { +impl Default for BuildArgsRustBeta { fn default() -> Self { Self { cargo_chef: true,