@@ -52,7 +52,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
5252 private $platformEnvironmentRequirements : IPlatformEnvironmentRequirements ,
5353 private $plistParser : IPlistParser ,
5454 private $sysInfo : ISysInfo ,
55- private $xcconfigService : IXcconfigService ) {
55+ private $xcconfigService : IXcconfigService ,
56+ private $iOSExtensionsService : IIOSExtensionsService ) {
5657 super ( $fs , $projectDataService ) ;
5758 }
5859
@@ -490,6 +491,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
490491 }
491492
492493 xcode . setAutomaticSigningStyle ( projectData . projectName , teamId ) ;
494+ xcode . setAutomaticSigningStyleByTargetProductType ( "com.apple.product-type.app-extension" , teamId ) ;
493495 xcode . save ( ) ;
494496
495497 this . $logger . trace ( `Set Automatic signing style and team id ${ teamId } .` ) ;
@@ -524,13 +526,14 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
524526 if ( ! mobileprovision ) {
525527 this . $errors . failWithoutHelp ( "Failed to find mobile provision with UUID or Name: " + provision ) ;
526528 }
527-
528- xcode . setManualSigningStyle ( projectData . projectName , {
529+ const configuration = {
529530 team : mobileprovision . TeamIdentifier && mobileprovision . TeamIdentifier . length > 0 ? mobileprovision . TeamIdentifier [ 0 ] : undefined ,
530531 uuid : mobileprovision . UUID ,
531532 name : mobileprovision . Name ,
532533 identity : mobileprovision . Type === "Development" ? "iPhone Developer" : "iPhone Distribution"
533- } ) ;
534+ } ;
535+ xcode . setManualSigningStyle ( projectData . projectName , configuration ) ;
536+ xcode . setManualSigningStyleByTargetProductType ( "com.apple.product-type.app-extension" , configuration ) ;
534537 xcode . save ( ) ;
535538
536539 // this.cache(uuid);
@@ -788,6 +791,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
788791
789792 // src folder should not be copied as the pbxproject will have references to its files
790793 this . $fs . deleteDirectory ( path . join ( appResourcesDirectoryPath , this . getPlatformData ( projectData ) . normalizedPlatformName , constants . NATIVE_SOURCE_FOLDER ) ) ;
794+ this . $fs . deleteDirectory ( path . join ( appResourcesDirectoryPath , this . getPlatformData ( projectData ) . normalizedPlatformName , constants . NATIVE_EXTENSION_FOLDER ) ) ;
791795
792796 this . $fs . deleteDirectory ( this . getAppResourcesDestinationDirectoryPath ( projectData ) ) ;
793797 }
@@ -934,8 +938,8 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
934938 return project ;
935939 }
936940
937- private savePbxProj ( project : any , projectData : IProjectData ) : void {
938- return this . $fs . writeFile ( this . getPbxProjPath ( projectData ) , project . writeSync ( ) ) ;
941+ private savePbxProj ( project : any , projectData : IProjectData , omitEmptyValues ?: boolean ) : void {
942+ return this . $fs . writeFile ( this . getPbxProjPath ( projectData ) , project . writeSync ( { omitEmptyValues } ) ) ;
939943 }
940944
941945 public async preparePluginNativeCode ( pluginData : IPluginData , projectData : IProjectData , opts ?: any ) : Promise < void > {
@@ -978,6 +982,10 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
978982 // So the correct order is `pod install` to be executed before merging pod's xcconfig file.
979983 await this . $cocoapodsService . mergePodXcconfigFile ( projectData , platformData , opts ) ;
980984 }
985+
986+ const pbxProjPath = this . getPbxProjPath ( projectData ) ;
987+ this . $iOSExtensionsService . removeExtensions ( { pbxProjPath} ) ;
988+ await this . addExtensions ( projectData ) ;
981989 }
982990 public beforePrepareAllPlugins ( ) : Promise < void > {
983991 return Promise . resolve ( ) ;
@@ -1093,15 +1101,36 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
10931101 this . savePbxProj ( project , projectData ) ;
10941102 }
10951103
1104+ private async addExtensions ( projectData : IProjectData ) : Promise < void > {
1105+ const resorcesExtensionsPath = path . join (
1106+ projectData . getAppResourcesDirectoryPath ( ) ,
1107+ this . getPlatformData ( projectData ) . normalizedPlatformName , constants . NATIVE_EXTENSION_FOLDER
1108+ ) ;
1109+ const platformData = this . getPlatformData ( projectData ) ;
1110+ const pbxProjPath = this . getPbxProjPath ( projectData ) ;
1111+ await this . $iOSExtensionsService . addExtensionsFromPath ( { extensionsFolderPath : resorcesExtensionsPath , projectData, platformData, pbxProjPath} ) ;
1112+ const plugins = await this . getAllInstalledPlugins ( projectData ) ;
1113+ for ( const pluginIndex in plugins ) {
1114+ const pluginData = plugins [ pluginIndex ] ;
1115+ const pluginPlatformsFolderPath = pluginData . pluginPlatformsFolderPath ( IOSProjectService . IOS_PLATFORM_NAME ) ;
1116+
1117+ const extensionPath = path . join ( pluginPlatformsFolderPath , constants . NATIVE_EXTENSION_FOLDER ) ;
1118+ await this . $iOSExtensionsService . addExtensionsFromPath ( { extensionsFolderPath : extensionPath , projectData, platformData, pbxProjPath} ) ;
1119+ }
1120+ }
1121+
10961122 private getRootGroup ( name : string , rootPath : string ) {
10971123 const filePathsArr : string [ ] = [ ] ;
10981124 const rootGroup : INativeSourceCodeGroup = { name : name , files : filePathsArr , path : rootPath } ;
10991125
1100- if ( this . $fs . exists ( rootPath ) && ! this . $fs . isEmptyDir ( rootPath ) ) {
1101- this . $fs . readDirectory ( rootPath ) . forEach ( fileName => {
1102- const filePath = path . join ( rootGroup . path , fileName ) ;
1103- filePathsArr . push ( filePath ) ;
1104- } ) ;
1126+ if ( this . $fs . exists ( rootPath ) ) {
1127+ const stats = this . $fs . getFsStats ( rootPath ) ;
1128+ if ( stats . isDirectory ( ) && ! this . $fs . isEmptyDir ( rootPath ) ) {
1129+ this . $fs . readDirectory ( rootPath ) . forEach ( fileName => {
1130+ const filePath = path . join ( rootGroup . path , fileName ) ;
1131+ filePathsArr . push ( filePath ) ;
1132+ } ) ;
1133+ }
11051134 }
11061135
11071136 return rootGroup ;
0 commit comments