@@ -39,7 +39,7 @@ export async function getBuildSettings({
3939 ? getSimulatorPlatformSDK ( platformName )
4040 : getDevicePlatformSDK ( platformName ) ;
4141
42- const { stdout : buildSettings } = await spawn (
42+ const { stdout : buildSettingsOutput } = await spawn (
4343 'xcodebuild' ,
4444 [
4545 xcodeProject . isWorkspace ? '-workspace' : '-project' ,
@@ -64,13 +64,22 @@ export async function getBuildSettings({
6464 action : string ;
6565 buildSettings : BuildSettings ;
6666 target : string ;
67- } [ ] = JSON . parse ( buildSettings ) . filter (
68- ( { target } : { target : string } ) =>
69- target !== 'React' && target !== 'React-Core' ,
67+ } [ ] = JSON . parse ( buildSettingsOutput ) . filter (
68+ ( {
69+ buildSettings : { WRAPPER_EXTENSION } ,
70+ } : {
71+ buildSettings : BuildSettings ;
72+ } ) => WRAPPER_EXTENSION === 'app' || WRAPPER_EXTENSION === 'framework' ,
7073 ) ;
7174 const targets = settings . map (
7275 ( { target : settingsTarget } : { target : string } ) => settingsTarget ,
7376 ) ;
77+ if ( settings . length === 0 ) {
78+ throw new RockError (
79+ `Failed to get build settings for your project. Looking for "app" or "framework" wrapper extension but found: ${ wrapperExtension } ` ,
80+ ) ;
81+ }
82+
7483 let selectedTarget = targets [ 0 ] ;
7584
7685 if ( target ) {
@@ -89,31 +98,21 @@ export async function getBuildSettings({
8998
9099 // Find app in all building settings - look for WRAPPER_EXTENSION: 'app',
91100 const targetIndex = targets . indexOf ( selectedTarget ) ;
92- const targetSettings = settings [ targetIndex ] . buildSettings ;
93-
94- const wrapperExtension = targetSettings . WRAPPER_EXTENSION ;
95-
96- if ( wrapperExtension === 'app' || wrapperExtension === 'framework' ) {
97- const buildSettings = settings [ targetIndex ] . buildSettings ;
98-
99- if ( ! buildSettings ) {
100- throw new RockError ( 'Failed to get build settings for your project' ) ;
101- }
102-
103- const appPath = getBuildPath ( buildSettings , platformName ) ;
104- const infoPlistPath = buildSettings . INFOPLIST_PATH ;
105- const targetBuildDir = buildSettings . TARGET_BUILD_DIR ;
101+ const buildSettings = settings [ targetIndex ] . buildSettings ;
106102
107- return {
108- appPath,
109- infoPlistPath : path . join ( targetBuildDir , infoPlistPath ) ,
110- bundleIdentifier : buildSettings . PRODUCT_BUNDLE_IDENTIFIER ,
111- } ;
103+ if ( ! buildSettings ) {
104+ throw new RockError ( 'Failed to get build settings for your project' ) ;
112105 }
113106
114- throw new RockError (
115- `Failed to get build settings for your project. Looking for "app" or "framework" wrapper extension but found: ${ wrapperExtension } ` ,
116- ) ;
107+ const appPath = getBuildPath ( buildSettings , platformName ) ;
108+ const infoPlistPath = buildSettings . INFOPLIST_PATH ;
109+ const targetBuildDir = buildSettings . TARGET_BUILD_DIR ;
110+
111+ return {
112+ appPath,
113+ infoPlistPath : path . join ( targetBuildDir , infoPlistPath ) ,
114+ bundleIdentifier : buildSettings . PRODUCT_BUNDLE_IDENTIFIER ,
115+ } ;
117116}
118117
119118function getBuildPath (
0 commit comments