From f96a42a5b90c26c2e620d2f0f1e1d79e2ad0ee48 Mon Sep 17 00:00:00 2001 From: Miles Murgaw Date: Sun, 27 Oct 2024 23:13:32 -0400 Subject: [PATCH] Fix: CLI Release & Profile Conflict (#3115) * fix: cli release & profile conflict * remove: commented code --- packages/cli/src/builder/build.rs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/builder/build.rs b/packages/cli/src/builder/build.rs index 84afdf65c..bfa8c1838 100644 --- a/packages/cli/src/builder/build.rs +++ b/packages/cli/src/builder/build.rs @@ -239,11 +239,25 @@ impl BuildRequest { // Set the target, profile and features that vary between the app and server builds if self.build.platform() == Platform::Server { cargo_args.push("--profile".to_string()); - cargo_args.push(self.build.server_profile.to_string()); + match self.build.release { + true => cargo_args.push("release".to_string()), + false => cargo_args.push(self.build.server_profile.to_string()), + }; } else { - if let Some(custom_profile) = &self.build.profile { + // Add required profile flags. --release overrides any custom profiles. + let custom_profile = &self.build.profile.as_ref(); + if custom_profile.is_some() || self.build.release { cargo_args.push("--profile".to_string()); - cargo_args.push(custom_profile.to_string()); + match self.build.release { + true => cargo_args.push("release".to_string()), + false => { + cargo_args.push( + custom_profile + .expect("custom_profile should have been checked by is_some") + .to_string(), + ); + } + }; } // todo: use the right arch based on the current arch @@ -269,10 +283,6 @@ impl BuildRequest { } } - if self.build.release { - cargo_args.push("--release".to_string()); - } - if self.build.verbose { cargo_args.push("--verbose".to_string()); } else {