Browse Source

Fix --target flag not passed to cargo when Platform == Server (#3595)

* Fix --target flag not passed to cargo when Platform == Server

* revision: use --server-target flag

---------

Co-authored-by: Miles Murgaw <milesmurgaw@gmail.com>
Marco Bergamin 4 tháng trước cách đây
mục cha
commit
b5381e748c
2 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 6 0
      packages/cli/src/build/request.rs
  2. 4 0
      packages/cli/src/cli/target.rs

+ 6 - 0
packages/cli/src/build/request.rs

@@ -270,6 +270,12 @@ impl BuildRequest {
                 true => cargo_args.push("release".to_string()),
                 false => cargo_args.push(self.build.server_profile.to_string()),
             };
+
+            // If the user provided a server target, use it, otherwise use the default host target.
+            if let Some(target) = self.build.target_args.server_target.as_deref() {
+                cargo_args.push("--target".to_string());
+                cargo_args.push(target.to_string());
+            }
         } else {
             // Add required profile flags. --release overrides any custom profiles.
             let custom_profile = &self.build.profile.as_ref();

+ 4 - 0
packages/cli/src/cli/target.rs

@@ -48,6 +48,10 @@ pub(crate) struct TargetArgs {
     /// Rustc platform triple
     #[clap(long)]
     pub(crate) target: Option<String>,
+
+    /// Specify the server rustc target triple.
+    #[clap(long)]
+    pub(crate) server_target: Option<String>,
 }
 
 impl TargetArgs {