@@ -333,6 +333,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
333
333
return path . join ( this . platformData . projectRoot , "Podfile" ) ;
334
334
}
335
335
336
+ private get projectXcconfigFilePath ( ) : string {
337
+ return path . join ( this . platformData . appDestinationDirectoryPath , "build.xcconfig" ) ;
338
+ }
339
+
336
340
private replace ( name : string ) : string {
337
341
if ( _ . startsWith ( name , '"' ) ) {
338
342
name = name . substr ( 1 , name . length - 2 ) ;
@@ -369,6 +373,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
369
373
this . prepareFrameworks ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
370
374
this . prepareStaticLibs ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
371
375
this . prepareCocoapods ( pluginPlatformsFolderPath ) . wait ( ) ;
376
+ this . prepareXcconfigFile ( pluginPlatformsFolderPath ) . wait ( ) ;
372
377
} ) . future < void > ( ) ( ) ;
373
378
}
374
379
@@ -379,6 +384,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
379
384
this . removeFrameworks ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
380
385
this . removeStaticLibs ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
381
386
this . removeCocoapods ( pluginPlatformsFolderPath ) . wait ( ) ;
387
+ this . removeXcconfigFile ( pluginPlatformsFolderPath ) . wait ( ) ;
382
388
} ) . future < void > ( ) ( ) ;
383
389
}
384
390
@@ -432,7 +438,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
432
438
433
439
let packageType = this . $childProcess . exec ( `/usr/libexec/PlistBuddy -c "Print :CFBundlePackageType" "${ infoPlistPath } "` ) . wait ( ) . trim ( ) ;
434
440
if ( packageType !== "FMWK" ) {
435
- this . $errors . failWithoutHelp ( "The bundle at %s does not appear to be a dynamic framework." , libraryPath ) ;
441
+ this . $errors . failWithoutHelp ( "The bundle at %s does not appear to be a framework." , libraryPath ) ;
436
442
}
437
443
} ) . future < void > ( ) ( ) ;
438
444
}
@@ -509,6 +515,16 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
509
515
} ) . future < void > ( ) ( ) ;
510
516
}
511
517
518
+ private prepareXcconfigFile ( pluginPlatformsFolderPath : string ) : IFuture < void > {
519
+ return ( ( ) => {
520
+ let pluginXcconfigFilePath = path . join ( pluginPlatformsFolderPath , "build.xcconfig" ) ;
521
+ if ( this . $fs . exists ( pluginXcconfigFilePath ) . wait ( ) ) {
522
+ let contentToWrite = this . buildXcconfigContent ( pluginXcconfigFilePath ) ;
523
+ this . $fs . appendFile ( this . projectXcconfigFilePath , contentToWrite ) . wait ( ) ;
524
+ }
525
+ } ) . future < void > ( ) ( ) ;
526
+ }
527
+
512
528
private removeFrameworks ( pluginPlatformsFolderPath : string , pluginData : IPluginData ) : IFuture < void > {
513
529
return ( ( ) => {
514
530
let project = this . createPbxProj ( ) ;
@@ -556,6 +572,18 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
556
572
} ) . future < void > ( ) ( ) ;
557
573
}
558
574
575
+ private removeXcconfigFile ( pluginPlatformsFolderPath : string ) : IFuture < void > {
576
+ return ( ( ) => {
577
+ let pluginXcconfigFilePath = path . join ( pluginPlatformsFolderPath , "build.xcconfig" ) ;
578
+ if ( this . $fs . exists ( pluginXcconfigFilePath ) . wait ( ) ) {
579
+ let projectXcconfigFileContent = this . $fs . readText ( this . projectXcconfigFilePath ) . wait ( ) ;
580
+ let contentToRemove = this . buildXcconfigContent ( pluginXcconfigFilePath ) ;
581
+ projectXcconfigFileContent = helpers . stringReplaceAll ( projectXcconfigFileContent , contentToRemove , "" ) ;
582
+ this . $fs . writeFile ( this . projectXcconfigFilePath , projectXcconfigFileContent ) . wait ( ) ;
583
+ }
584
+ } ) . future < void > ( ) ( ) ;
585
+ }
586
+
559
587
private buildPodfileContent ( pluginPodFilePath : string , pluginPodFileContent : string ) : string {
560
588
return `# Begin Podfile - ${ pluginPodFilePath } ${ os . EOL } ${ pluginPodFileContent } ${ os . EOL } # End Podfile ${ os . EOL } ` ;
561
589
}
@@ -575,6 +603,11 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
575
603
let modulemap = `module ${ libraryName } { explicit module ${ libraryName } { ${ headers . join ( " " ) } } }` ;
576
604
this . $fs . writeFile ( path . join ( headersFolderPath , "module.modulemap" ) , modulemap ) . wait ( ) ;
577
605
}
606
+
607
+ private buildXcconfigContent ( xcconfigFilePath : string ) : string {
608
+ let relativePluginXcconfigFilePath = path . relative ( path . dirname ( this . projectXcconfigFilePath ) , xcconfigFilePath ) ;
609
+ return `${ os . EOL } #include "${ relativePluginXcconfigFilePath } "${ os . EOL } ` ;
610
+ }
578
611
}
579
612
580
613
$injector . register ( "iOSProjectService" , IOSProjectService ) ;
0 commit comments