File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 4
4
const configPreferences = require ( "../npm/processConfigXml.js" ) ;
5
5
const iosPlist = require ( "../ios/updatePlist.js" ) ;
6
6
const iosAssociatedDomains = require ( "../ios/updateAssociatedDomains.js" ) ;
7
+ const iosHeaderPaths = require ( "../ios/updateHeaderPaths.js" ) ;
7
8
const IOS = "ios" ;
8
9
9
10
// entry
18
19
if ( platform === IOS ) {
19
20
iosPlist . addBranchSettings ( preferences ) ;
20
21
iosAssociatedDomains . addAssociatedDomains ( preferences ) ;
22
+ iosHeaderPaths . addHeaderPaths ( ) ;
21
23
}
22
24
} ) ;
23
25
}
Original file line number Diff line number Diff line change
1
+ ( function ( ) {
2
+ // properties
3
+
4
+ const fs = require ( "fs" ) ;
5
+
6
+ // entry
7
+ module . exports = {
8
+ addHeaderPaths : addHeaderPaths
9
+ } ;
10
+
11
+ // updates the platforms/ios/cordova/build.xcconfig file with Branch's Header Paths
12
+ // some plugins still use the old CocoaPods way to resolve config dirs or other obscure
13
+ // ways that modify CocoaPods config. That causes the Branch plugin to fail on iOS build.
14
+ function addHeaderPaths ( ) {
15
+ const filePath = "platforms/ios/cordova/build.xcconfig" ;
16
+ let config = readBuildXcconfig ( filePath ) ;
17
+
18
+ config = updateHeaderPaths ( config ) ;
19
+ writeBuildXcconfig ( filePath , config ) ;
20
+ }
21
+
22
+ // update build.xcconfig with Branch's Header Paths
23
+ function updateHeaderPaths ( config ) {
24
+ config = config . split ( "\n" )
25
+ . map ( function ( line ) {
26
+ if ( line . indexOf ( "HEADER_SEARCH_PATHS" ) > - 1 && line . indexOf ( "Branch-SDK" ) === - 1 ) {
27
+ line += ' "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK" "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK/Networking" "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK/Networking/Requests"' ;
28
+ }
29
+ return line ;
30
+ } ) ;
31
+
32
+ return config . join ( "\n" ) ;
33
+ }
34
+
35
+ function readBuildXcconfig ( filePath ) {
36
+ return fs . readFileSync ( filePath , "utf8" ) ;
37
+ }
38
+
39
+ function writeBuildXcconfig ( filePath , config ) {
40
+ return fs . writeFileSync ( filePath , config , { encoding : "utf8" } ) ;
41
+ }
42
+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments