@@ -40,6 +40,11 @@ module.exports = function(context) {
4040 var pbxprojPath ;
4141 var xcodeProject ;
4242
43+ var COMMENT_KEY = / _ c o m m e n t $ / ;
44+ var buildConfigs ;
45+ var buildConfig ;
46+ var configName ;
47+
4348 platformVersions . forEach ( function ( platformVersion ) {
4449 if ( platformVersion . platform === 'ios' ) {
4550 iosPlatformVersion = platformVersion . version ;
@@ -73,10 +78,18 @@ module.exports = function(context) {
7378 xcodeProject . addHeaderFile ( 'Bridging-Header.h' ) ;
7479 }
7580
81+ buildConfigs = xcodeProject . pbxXCBuildConfigurationSection ( ) ;
82+
7683 var bridgingHeaderProperty = '"$(PROJECT_DIR)/$(PROJECT_NAME)' + bridgingHeaderPath . split ( projectPath ) [ 1 ] + '"' ;
77- if ( xcodeProject . getBuildProperty ( 'SWIFT_OBJC_BRIDGING_HEADER' ) !== bridgingHeaderProperty ) {
78- xcodeProject . updateBuildProperty ( 'SWIFT_OBJC_BRIDGING_HEADER' , bridgingHeaderProperty ) ;
79- console . log ( 'Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to:' , xcodeProject . getBuildProperty ( 'SWIFT_OBJC_BRIDGING_HEADER' ) , bridgingHeaderProperty ) ;
84+
85+ for ( configName in buildConfigs ) {
86+ if ( ! COMMENT_KEY . test ( configName ) ) {
87+ buildConfig = buildConfigs [ configName ] ;
88+ if ( xcodeProject . getBuildProperty ( 'SWIFT_OBJC_BRIDGING_HEADER' , buildConfig . name ) !== bridgingHeaderProperty ) {
89+ xcodeProject . updateBuildProperty ( 'SWIFT_OBJC_BRIDGING_HEADER' , bridgingHeaderProperty , buildConfig . name ) ;
90+ console . log ( 'Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to:' , bridgingHeaderProperty , 'for build configuration' , buildConfig . name ) ;
91+ }
92+ }
8093 }
8194
8295 // Look for any bridging header defined in the plugin
@@ -101,19 +114,24 @@ module.exports = function(context) {
101114 } ) ;
102115 fs . writeFileSync ( bridgingHeaderPath , content , 'utf-8' ) ;
103116
104- if ( parseFloat ( xcodeProject . getBuildProperty ( 'IPHONEOS_DEPLOYMENT_TARGET' ) ) < parseFloat ( IOS_MIN_DEPLOYMENT_TARGET ) ) {
105- xcodeProject . updateBuildProperty ( 'IPHONEOS_DEPLOYMENT_TARGET' , IOS_MIN_DEPLOYMENT_TARGET ) ;
106- console . log ( 'Update IOS project deployment target to:' , IOS_MIN_DEPLOYMENT_TARGET ) ;
107- }
117+ for ( configName in buildConfigs ) {
118+ if ( ! COMMENT_KEY . test ( configName ) ) {
119+ buildConfig = buildConfigs [ configName ] ;
120+ if ( parseFloat ( xcodeProject . getBuildProperty ( 'IPHONEOS_DEPLOYMENT_TARGET' , buildConfig . name ) ) < parseFloat ( IOS_MIN_DEPLOYMENT_TARGET ) ) {
121+ xcodeProject . updateBuildProperty ( 'IPHONEOS_DEPLOYMENT_TARGET' , IOS_MIN_DEPLOYMENT_TARGET , buildConfig . name ) ;
122+ console . log ( 'Update IOS project deployment target to:' , IOS_MIN_DEPLOYMENT_TARGET , 'for build configuration' , buildConfig . name ) ;
123+ }
108124
109- if ( xcodeProject . getBuildProperty ( 'EMBEDDED_CONTENT_CONTAINS_SWIFT' ) !== 'YES' ) {
110- xcodeProject . updateBuildProperty ( 'EMBEDDED_CONTENT_CONTAINS_SWIFT' , 'YES' ) ;
111- console . log ( 'Update IOS build setting EMBEDDED_CONTENT_CONTAINS_SWIFT to: YES' ) ;
112- }
125+ if ( xcodeProject . getBuildProperty ( 'EMBEDDED_CONTENT_CONTAINS_SWIFT' , buildConfig . name ) !== 'YES' ) {
126+ xcodeProject . updateBuildProperty ( 'EMBEDDED_CONTENT_CONTAINS_SWIFT' , 'YES' , buildConfig . name ) ;
127+ console . log ( 'Update IOS build setting EMBEDDED_CONTENT_CONTAINS_SWIFT to: YES' , 'for build configuration' , buildConfig . name ) ;
128+ }
113129
114- if ( xcodeProject . getBuildProperty ( 'LD_RUNPATH_SEARCH_PATHS' ) !== '"@executable_path/Frameworks"' ) {
115- xcodeProject . updateBuildProperty ( 'LD_RUNPATH_SEARCH_PATHS' , '"@executable_path/Frameworks"' ) ;
116- console . log ( 'Update IOS build setting LD_RUNPATH_SEARCH_PATHS to: @executable_path/Frameworks' ) ;
130+ if ( xcodeProject . getBuildProperty ( 'LD_RUNPATH_SEARCH_PATHS' , buildConfig . name ) !== '"@executable_path/Frameworks"' ) {
131+ xcodeProject . updateBuildProperty ( 'LD_RUNPATH_SEARCH_PATHS' , '"@executable_path/Frameworks"' , buildConfig . name ) ;
132+ console . log ( 'Update IOS build setting LD_RUNPATH_SEARCH_PATHS to: @executable_path/Frameworks' , 'for build configuration' , buildConfig . name ) ;
133+ }
134+ }
117135 }
118136
119137 fs . writeFileSync ( pbxprojPath , xcodeProject . writeSync ( ) ) ;
0 commit comments