@@ -19,7 +19,13 @@ use jkconfig::{
1919use object:: { Architecture , Object } ;
2020use tokio:: fs;
2121
22- use crate :: { build:: config:: BuildConfig , utils:: PathResultExt } ;
22+ use crate :: {
23+ build:: {
24+ config:: { BuildConfig , BuildSystem , Cargo } ,
25+ someboot,
26+ } ,
27+ utils:: PathResultExt ,
28+ } ;
2329
2430/// Configuration for output directories.
2531///
@@ -241,9 +247,9 @@ impl AppContext {
241247 ///
242248 /// Returns an error if no ELF file is set or `rust-objcopy` fails.
243249 pub fn objcopy_output_bin ( & mut self ) -> anyhow:: Result < PathBuf > {
244- if self . paths . artifacts . bin . is_some ( ) {
245- debug ! ( "BIN file already exists: {:?}" , self . paths . artifacts . bin) ;
246- return Ok ( self . paths . artifacts . bin . as_ref ( ) . unwrap ( ) . clone ( ) ) ;
250+ if let Some ( bin ) = & self . paths . artifacts . bin {
251+ debug ! ( "BIN file already exists: {:?}" , bin) ;
252+ return Ok ( bin. clone ( ) ) ;
247253 }
248254
249255 let elf_path = self
@@ -327,7 +333,7 @@ impl AppContext {
327333 } ;
328334 self . build_config_path = Some ( config_path. clone ( ) ) ;
329335
330- let Some ( c) : Option < BuildConfig > = jkconfig:: run (
336+ let Some ( mut c) : Option < BuildConfig > = jkconfig:: run (
331337 config_path. clone ( ) ,
332338 menu,
333339 & [ self . ui_hock_feature_select ( ) , self . ui_hock_pacage_select ( ) ] ,
@@ -338,10 +344,21 @@ impl AppContext {
338344 anyhow:: bail!( "No build configuration obtained" ) ;
339345 } ;
340346
347+ if let BuildSystem :: Cargo ( cargo) = & mut c. system {
348+ let iter = self . someboot_cargo_args ( cargo) ?. into_iter ( ) ;
349+ cargo. args . extend ( iter) ;
350+ }
351+
341352 self . build_config = Some ( c. clone ( ) ) ;
342353 Ok ( c)
343354 }
344355
356+ fn someboot_cargo_args ( & self , cargo : & Cargo ) -> anyhow:: Result < Vec < String > > {
357+ let manifest_path = self . paths . manifest . join ( "Cargo.toml" ) ;
358+ let target = & cargo. target ;
359+ someboot:: detect_build_config ( & manifest_path, target)
360+ }
361+
345362 /// Replaces variable placeholders in a string.
346363 ///
347364 /// Currently supports `${workspaceFolder}` which is replaced with the
0 commit comments