@@ -40,6 +40,11 @@ module.exports = function(context) {
40
40
var pbxprojPath ;
41
41
var xcodeProject ;
42
42
43
+ var COMMENT_KEY = / _ c o m m e n t $ / ;
44
+ var buildConfigs ;
45
+ var buildConfig ;
46
+ var configName ;
47
+
43
48
platformVersions . forEach ( function ( platformVersion ) {
44
49
if ( platformVersion . platform === 'ios' ) {
45
50
iosPlatformVersion = platformVersion . version ;
@@ -73,10 +78,18 @@ module.exports = function(context) {
73
78
xcodeProject . addHeaderFile ( 'Bridging-Header.h' ) ;
74
79
}
75
80
81
+ buildConfigs = xcodeProject . pbxXCBuildConfigurationSection ( ) ;
82
+
76
83
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
+ }
80
93
}
81
94
82
95
// Look for any bridging header defined in the plugin
@@ -101,19 +114,24 @@ module.exports = function(context) {
101
114
} ) ;
102
115
fs . writeFileSync ( bridgingHeaderPath , content , 'utf-8' ) ;
103
116
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
+ }
108
124
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
+ }
113
129
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
+ }
117
135
}
118
136
119
137
fs . writeFileSync ( pbxprojPath , xcodeProject . writeSync ( ) ) ;
0 commit comments