@@ -309,6 +309,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
309
309
return path . join ( this . platformData . projectRoot , "Podfile" ) ;
310
310
}
311
311
312
+ private get projectXcconfigFilePath ( ) : string {
313
+ return path . join ( this . platformData . appDestinationDirectoryPath , "build.xcconfig" ) ;
314
+ }
315
+
312
316
private replace ( name : string ) : string {
313
317
if ( _ . startsWith ( name , '"' ) ) {
314
318
name = name . substr ( 1 , name . length - 2 ) ;
@@ -344,6 +348,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
344
348
let pluginPlatformsFolderPath = pluginData . pluginPlatformsFolderPath ( IOSProjectService . IOS_PLATFORM_NAME ) ;
345
349
this . prepareFrameworks ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
346
350
this . prepareCocoapods ( pluginPlatformsFolderPath , opts ) . wait ( ) ;
351
+ this . prepareXcconfigFile ( pluginPlatformsFolderPath ) . wait ( ) ;
347
352
} ) . future < void > ( ) ( ) ;
348
353
}
349
354
@@ -352,6 +357,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
352
357
let pluginPlatformsFolderPath = pluginData . pluginPlatformsFolderPath ( IOSProjectService . IOS_PLATFORM_NAME ) ;
353
358
this . removeFrameworks ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
354
359
this . removeCocoapods ( pluginPlatformsFolderPath ) . wait ( ) ;
360
+ this . removeXcconfigFile ( pluginPlatformsFolderPath ) . wait ( ) ;
355
361
} ) . future < void > ( ) ( ) ;
356
362
}
357
363
@@ -405,7 +411,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
405
411
406
412
let packageType = this . $childProcess . exec ( `/usr/libexec/PlistBuddy -c "Print :CFBundlePackageType" "${ infoPlistPath } "` ) . wait ( ) . trim ( ) ;
407
413
if ( packageType !== "FMWK" ) {
408
- this . $errors . failWithoutHelp ( "The bundle at %s does not appear to be a dynamic framework." , libraryPath ) ;
414
+ this . $errors . failWithoutHelp ( "The bundle at %s does not appear to be a framework." , libraryPath ) ;
409
415
}
410
416
} ) . future < void > ( ) ( ) ;
411
417
}
@@ -457,6 +463,17 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
457
463
} ) . future < void > ( ) ( ) ;
458
464
}
459
465
466
+ private prepareXcconfigFile ( pluginPlatformsFolderPath : string ) : IFuture < void > {
467
+ return ( ( ) => {
468
+ let pluginXcconfigFilePath = path . join ( pluginPlatformsFolderPath , "build.xcconfig" ) ;
469
+ if ( this . $fs . exists ( pluginXcconfigFilePath ) . wait ( ) ) {
470
+ let xcconfigContent = this . $fs . readText ( pluginXcconfigFilePath ) . wait ( ) ;
471
+ let contentToWrite = this . buildXcconfigContent ( pluginXcconfigFilePath , xcconfigContent ) ;
472
+ this . $fs . appendFile ( this . projectXcconfigFilePath , contentToWrite ) . wait ( ) ;
473
+ }
474
+ } ) . future < void > ( ) ( ) ;
475
+ }
476
+
460
477
private removeFrameworks ( pluginPlatformsFolderPath : string , pluginData : IPluginData ) : IFuture < void > {
461
478
return ( ( ) => {
462
479
let project = this . createPbxProj ( ) ;
@@ -488,8 +505,25 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
488
505
} ) . future < void > ( ) ( ) ;
489
506
}
490
507
508
+ private removeXcconfigFile ( pluginPlatformsFolderPath : string ) : IFuture < void > {
509
+ return ( ( ) => {
510
+ let pluginXcconfigFilePath = path . join ( pluginPlatformsFolderPath , "build.xcconfig" ) ;
511
+ if ( this . $fs . exists ( pluginXcconfigFilePath ) . wait ( ) ) {
512
+ let xcconfigContent = this . $fs . readText ( pluginXcconfigFilePath ) . wait ( ) ;
513
+ let projectXcconfigFileContent = this . $fs . readText ( this . projectXcconfigFilePath ) . wait ( ) ;
514
+ let contentToRemove = this . buildXcconfigContent ( pluginXcconfigFilePath , xcconfigContent ) ;
515
+ projectXcconfigFileContent = helpers . stringReplaceAll ( projectXcconfigFileContent , contentToRemove , "" ) ;
516
+ this . $fs . writeFile ( this . projectXcconfigFilePath , projectXcconfigFileContent ) . wait ( ) ;
517
+ }
518
+ } ) . future < void > ( ) ( ) ;
519
+ }
520
+
491
521
private buildPodfileContent ( pluginPodFilePath : string , pluginPodFileContent : string ) : string {
492
522
return `# Begin Podfile - ${ pluginPodFilePath } ${ os . EOL } ${ pluginPodFileContent } ${ os . EOL } # End Podfile ${ os . EOL } ` ;
493
523
}
524
+
525
+ private buildXcconfigContent ( xcconfigFilePath : string , xcconfigFileContent : string ) : string {
526
+ return `${ os . EOL } // Begin xcconfig - ${ xcconfigFilePath } ${ os . EOL } ${ xcconfigFileContent } ${ os . EOL } // End xcconfig ${ os . EOL } ` ;
527
+ }
494
528
}
495
529
$injector . register ( "iOSProjectService" , IOSProjectService ) ;
0 commit comments