@@ -52,7 +52,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
52
52
private $platformEnvironmentRequirements : IPlatformEnvironmentRequirements ,
53
53
private $plistParser : IPlistParser ,
54
54
private $sysInfo : ISysInfo ,
55
- private $xcconfigService : IXcconfigService ) {
55
+ private $xcconfigService : IXcconfigService ,
56
+ private $iOSExtensionsService : IIOSExtensionsService ) {
56
57
super ( $fs , $projectDataService ) ;
57
58
}
58
59
@@ -490,6 +491,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
490
491
}
491
492
492
493
xcode . setAutomaticSigningStyle ( projectData . projectName , teamId ) ;
494
+ xcode . setAutomaticSigningStyleByTargetProductType ( "com.apple.product-type.app-extension" , teamId ) ;
493
495
xcode . save ( ) ;
494
496
495
497
this . $logger . trace ( `Set Automatic signing style and team id ${ teamId } .` ) ;
@@ -524,13 +526,14 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
524
526
if ( ! mobileprovision ) {
525
527
this . $errors . failWithoutHelp ( "Failed to find mobile provision with UUID or Name: " + provision ) ;
526
528
}
527
-
528
- xcode . setManualSigningStyle ( projectData . projectName , {
529
+ const configuration = {
529
530
team : mobileprovision . TeamIdentifier && mobileprovision . TeamIdentifier . length > 0 ? mobileprovision . TeamIdentifier [ 0 ] : undefined ,
530
531
uuid : mobileprovision . UUID ,
531
532
name : mobileprovision . Name ,
532
533
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 ) ;
534
537
xcode . save ( ) ;
535
538
536
539
// this.cache(uuid);
@@ -788,6 +791,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
788
791
789
792
// src folder should not be copied as the pbxproject will have references to its files
790
793
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 ) ) ;
791
795
792
796
this . $fs . deleteDirectory ( this . getAppResourcesDestinationDirectoryPath ( projectData ) ) ;
793
797
}
@@ -934,8 +938,8 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
934
938
return project ;
935
939
}
936
940
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 } ) ) ;
939
943
}
940
944
941
945
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
978
982
// So the correct order is `pod install` to be executed before merging pod's xcconfig file.
979
983
await this . $cocoapodsService . mergePodXcconfigFile ( projectData , platformData , opts ) ;
980
984
}
985
+
986
+ const pbxProjPath = this . getPbxProjPath ( projectData ) ;
987
+ this . $iOSExtensionsService . removeExtensions ( { pbxProjPath} ) ;
988
+ await this . addExtensions ( projectData ) ;
981
989
}
982
990
public beforePrepareAllPlugins ( ) : Promise < void > {
983
991
return Promise . resolve ( ) ;
@@ -1093,15 +1101,36 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
1093
1101
this . savePbxProj ( project , projectData ) ;
1094
1102
}
1095
1103
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
+
1096
1122
private getRootGroup ( name : string , rootPath : string ) {
1097
1123
const filePathsArr : string [ ] = [ ] ;
1098
1124
const rootGroup : INativeSourceCodeGroup = { name : name , files : filePathsArr , path : rootPath } ;
1099
1125
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
+ }
1105
1134
}
1106
1135
1107
1136
return rootGroup ;
0 commit comments