@@ -161,7 +161,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
161
161
let args : string [ ] = [ ] ;
162
162
if ( this . $options . forDevice ) {
163
163
args = basicArgs . concat ( [
164
- "-xcconfig" , path . join ( projectRoot , this . $projectData . projectName , "build.xcconfig" ) ,
165
164
"-sdk" , "iphoneos" ,
166
165
'ARCHS=armv7 arm64' ,
167
166
'VALID_ARCHS=armv7 arm64' ,
@@ -333,6 +332,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
333
332
return path . join ( this . platformData . projectRoot , "Podfile" ) ;
334
333
}
335
334
335
+ private get projectXcconfigFilePath ( ) : string {
336
+ return path . join ( this . platformData . appDestinationDirectoryPath , "build.xcconfig" ) ;
337
+ }
338
+
336
339
private replace ( name : string ) : string {
337
340
if ( _ . startsWith ( name , '"' ) ) {
338
341
name = name . substr ( 1 , name . length - 2 ) ;
@@ -369,6 +372,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
369
372
this . prepareFrameworks ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
370
373
this . prepareStaticLibs ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
371
374
this . prepareCocoapods ( pluginPlatformsFolderPath ) . wait ( ) ;
375
+ this . prepareXcconfigFile ( pluginPlatformsFolderPath ) . wait ( ) ;
372
376
} ) . future < void > ( ) ( ) ;
373
377
}
374
378
@@ -379,6 +383,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
379
383
this . removeFrameworks ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
380
384
this . removeStaticLibs ( pluginPlatformsFolderPath , pluginData ) . wait ( ) ;
381
385
this . removeCocoapods ( pluginPlatformsFolderPath ) . wait ( ) ;
386
+ this . removeXcconfigFile ( pluginPlatformsFolderPath ) . wait ( ) ;
382
387
} ) . future < void > ( ) ( ) ;
383
388
}
384
389
@@ -432,7 +437,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
432
437
433
438
let packageType = this . $childProcess . exec ( `/usr/libexec/PlistBuddy -c "Print :CFBundlePackageType" "${ infoPlistPath } "` ) . wait ( ) . trim ( ) ;
434
439
if ( packageType !== "FMWK" ) {
435
- this . $errors . failWithoutHelp ( "The bundle at %s does not appear to be a dynamic framework." , libraryPath ) ;
440
+ this . $errors . failWithoutHelp ( "The bundle at %s does not appear to be a framework." , libraryPath ) ;
436
441
}
437
442
} ) . future < void > ( ) ( ) ;
438
443
}
@@ -509,6 +514,17 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
509
514
} ) . future < void > ( ) ( ) ;
510
515
}
511
516
517
+ private prepareXcconfigFile ( pluginPlatformsFolderPath : string ) : IFuture < void > {
518
+ return ( ( ) => {
519
+ let pluginXcconfigFilePath = path . join ( pluginPlatformsFolderPath , "build.xcconfig" ) ;
520
+ if ( this . $fs . exists ( pluginXcconfigFilePath ) . wait ( ) ) {
521
+ let xcconfigContent = this . $fs . readText ( pluginXcconfigFilePath ) . wait ( ) ;
522
+ let contentToWrite = this . buildXcconfigContent ( pluginXcconfigFilePath , xcconfigContent ) ;
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,19 @@ 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 xcconfigContent = this . $fs . readText ( pluginXcconfigFilePath ) . wait ( ) ;
580
+ let projectXcconfigFileContent = this . $fs . readText ( this . projectXcconfigFilePath ) . wait ( ) ;
581
+ let contentToRemove = this . buildXcconfigContent ( pluginXcconfigFilePath , xcconfigContent ) ;
582
+ projectXcconfigFileContent = helpers . stringReplaceAll ( projectXcconfigFileContent , contentToRemove , "" ) ;
583
+ this . $fs . writeFile ( this . projectXcconfigFilePath , projectXcconfigFileContent ) . wait ( ) ;
584
+ }
585
+ } ) . future < void > ( ) ( ) ;
586
+ }
587
+
559
588
private buildPodfileContent ( pluginPodFilePath : string , pluginPodFileContent : string ) : string {
560
589
return `# Begin Podfile - ${ pluginPodFilePath } ${ os . EOL } ${ pluginPodFileContent } ${ os . EOL } # End Podfile ${ os . EOL } ` ;
561
590
}
@@ -575,6 +604,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
575
604
let modulemap = `module ${ libraryName } { explicit module ${ libraryName } { ${ headers . join ( " " ) } } }` ;
576
605
this . $fs . writeFile ( path . join ( headersFolderPath , "module.modulemap" ) , modulemap ) . wait ( ) ;
577
606
}
607
+
608
+ private buildXcconfigContent ( xcconfigFilePath : string , xcconfigFileContent : string ) : string {
609
+ return `${ os . EOL } // Begin xcconfig - ${ xcconfigFilePath } ${ os . EOL } ${ xcconfigFileContent } ${ os . EOL } // End xcconfig ${ os . EOL } ` ;
610
+ }
578
611
}
579
612
580
613
$injector . register ( "iOSProjectService" , IOSProjectService ) ;
0 commit comments