@@ -144,6 +144,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
144
144
public buildProject ( projectRoot : string ) : IFuture < void > {
145
145
return ( ( ) => {
146
146
let basicArgs = [
147
+ "-xcconfig" , this . projectXcconfigFilePath ,
147
148
"-configuration" , this . $options . release ? "Release" : "Debug" ,
148
149
"build" ,
149
150
'SHARED_PRECOMPS_DIR=' + path . join ( projectRoot , 'build' , 'sharedpch' )
@@ -161,7 +162,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
161
162
let args : string [ ] = [ ] ;
162
163
if ( this . $options . forDevice ) {
163
164
args = basicArgs . concat ( [
164
- "-xcconfig" , path . join ( projectRoot , this . $projectData . projectName , "build.xcconfig" ) ,
165
165
"-sdk" , "iphoneos" ,
166
166
'ARCHS=armv7 arm64' ,
167
167
'VALID_ARCHS=armv7 arm64' ,
@@ -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,17 @@ 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 xcconfigContent = this . $fs . readText ( pluginXcconfigFilePath ) . wait ( ) ;
523
+ let contentToWrite = this . buildXcconfigContent ( pluginXcconfigFilePath , xcconfigContent ) ;
524
+ this . $fs . appendFile ( this . projectXcconfigFilePath , contentToWrite ) . wait ( ) ;
525
+ }
526
+ } ) . future < void > ( ) ( ) ;
527
+ }
528
+
512
529
private removeFrameworks ( pluginPlatformsFolderPath : string , pluginData : IPluginData ) : IFuture < void > {
513
530
return ( ( ) => {
514
531
let project = this . createPbxProj ( ) ;
@@ -556,6 +573,19 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
556
573
} ) . future < void > ( ) ( ) ;
557
574
}
558
575
576
+ private removeXcconfigFile ( pluginPlatformsFolderPath : string ) : IFuture < void > {
577
+ return ( ( ) => {
578
+ let pluginXcconfigFilePath = path . join ( pluginPlatformsFolderPath , "build.xcconfig" ) ;
579
+ if ( this . $fs . exists ( pluginXcconfigFilePath ) . wait ( ) ) {
580
+ let xcconfigContent = this . $fs . readText ( pluginXcconfigFilePath ) . wait ( ) ;
581
+ let projectXcconfigFileContent = this . $fs . readText ( this . projectXcconfigFilePath ) . wait ( ) ;
582
+ let contentToRemove = this . buildXcconfigContent ( pluginXcconfigFilePath , xcconfigContent ) ;
583
+ projectXcconfigFileContent = helpers . stringReplaceAll ( projectXcconfigFileContent , contentToRemove , "" ) ;
584
+ this . $fs . writeFile ( this . projectXcconfigFilePath , projectXcconfigFileContent ) . wait ( ) ;
585
+ }
586
+ } ) . future < void > ( ) ( ) ;
587
+ }
588
+
559
589
private buildPodfileContent ( pluginPodFilePath : string , pluginPodFileContent : string ) : string {
560
590
return `# Begin Podfile - ${ pluginPodFilePath } ${ os . EOL } ${ pluginPodFileContent } ${ os . EOL } # End Podfile ${ os . EOL } ` ;
561
591
}
@@ -575,6 +605,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
575
605
let modulemap = `module ${ libraryName } { explicit module ${ libraryName } { ${ headers . join ( " " ) } } }` ;
576
606
this . $fs . writeFile ( path . join ( headersFolderPath , "module.modulemap" ) , modulemap ) . wait ( ) ;
577
607
}
608
+
609
+ private buildXcconfigContent ( xcconfigFilePath : string , xcconfigFileContent : string ) : string {
610
+ return `${ os . EOL } // Begin xcconfig - ${ xcconfigFilePath } ${ os . EOL } ${ xcconfigFileContent } ${ os . EOL } // End xcconfig ${ os . EOL } ` ;
611
+ }
578
612
}
579
613
580
614
$injector . register ( "iOSProjectService" , IOSProjectService ) ;
0 commit comments