@@ -36,14 +36,21 @@ export async function getBuildSettings(
3636
3737 const settings = JSON . parse ( buildSettings ) ;
3838
39- const targets = settings . map (
40- ( { target : settingsTarget } : any ) => settingsTarget ,
41- ) ;
42-
43- let selectedTarget = targets [ 0 ] ;
39+ // Find all 'app' targets in the build settings
40+ const applicationTargets = settings
41+ . filter (
42+ ( setting : any ) =>
43+ setting . buildSettings . WRAPPER_EXTENSION ===
44+ 'app' ,
45+ )
46+ . map ( ( { target : settingsTarget } : any ) => settingsTarget ) ;
4447
48+ if ( applicationTargets . length === 0 ) return null
49+
50+ let selectedTarget = applicationTargets [ 0 ] ;
51+
4552 if ( target ) {
46- if ( ! targets . includes ( target ) ) {
53+ if ( ! applicationTargets . includes ( target ) ) {
4754 logger . info (
4855 `Target ${ chalk . bold ( target ) } not found for scheme ${ chalk . bold (
4956 scheme ,
@@ -53,18 +60,9 @@ export async function getBuildSettings(
5360 selectedTarget = target ;
5461 }
5562 }
56-
57- // Find app in all building settings - look for WRAPPER_EXTENSION: 'app',
58- const targetIndex = targets . indexOf ( selectedTarget ) ;
59- const targetSettings = settings [ targetIndex ] . buildSettings ;
60-
61- const wrapperExtension = targetSettings . WRAPPER_EXTENSION ;
62-
63- if ( wrapperExtension === 'app' ) {
64- return settings [ targetIndex ] . buildSettings ;
65- }
66-
67- return null ;
63+
64+ const targetIndex = applicationTargets . indexOf ( selectedTarget ) ;
65+ return settings [ targetIndex ] . buildSettings ;
6866}
6967
7068function getPlatformName ( buildOutput : string ) {
0 commit comments