@@ -12,6 +12,7 @@ import * as temp from "temp";
12
12
import * as plist from "plist" ;
13
13
import { Xcode } from "pbxproj-dom/xcode" ;
14
14
import { IOSProvisionService } from "./ios-provision-service" ;
15
+ import * as fs from "fs" ;
15
16
16
17
export class IOSProjectService extends projectServiceBaseLib . PlatformProjectServiceBase implements IPlatformProjectService {
17
18
private static XCODE_PROJECT_EXT_NAME = ".xcodeproj" ;
@@ -372,10 +373,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
372
373
await this . createIpa ( projectRoot , projectData , buildConfig ) ;
373
374
}
374
375
375
- private async setupSigningFromProvision ( projectRoot : string , projectData : IProjectData , provision ?: any ) : Promise < void > {
376
+ private async setupSigningFromProvision ( projectRoot : string , projectData : IProjectData , provision ?: string ) : Promise < void > {
376
377
if ( provision ) {
377
- const pbxprojPath = path . join ( projectRoot , projectData . projectName + ".xcodeproj" , "project.pbxproj" ) ;
378
- const xcode = Xcode . open ( pbxprojPath ) ;
378
+ const xcode = Xcode . open ( this . getPbxProjPath ( projectData ) ) ;
379
379
const signing = xcode . getSigning ( projectData . projectName ) ;
380
380
381
381
let shouldUpdateXcode = false ;
@@ -421,11 +421,16 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
421
421
}
422
422
423
423
private async setupSigningForDevice ( projectRoot : string , buildConfig : IiOSBuildConfig , projectData : IProjectData ) : Promise < void > {
424
- const pbxprojPath = path . join ( projectRoot , projectData . projectName + ".xcodeproj" , "project.pbxproj" ) ;
425
- const xcode = Xcode . open ( pbxprojPath ) ;
424
+ const xcode = Xcode . open ( this . getPbxProjPath ( projectData ) ) ;
426
425
const signing = xcode . getSigning ( projectData . projectName ) ;
427
426
428
- if ( ( this . readXCConfigProvisioningProfile ( projectData ) || this . readXCConfigProvisioningProfileForIPhoneOs ( projectData ) ) && ( ! signing || signing . style !== "Manual" ) ) {
427
+ const hasProvisioningProfileInXCConfig =
428
+ this . readXCConfigProvisioningProfile ( projectData ) ||
429
+ this . readXCConfigProvisioningProfileForIPhoneOs ( projectData ) ||
430
+ this . readXCConfigProvisioningProfileSpecifier ( projectData ) ||
431
+ this . readXCConfigProvisioningProfileSpecifierForIPhoneOs ( projectData ) ;
432
+
433
+ if ( hasProvisioningProfileInXCConfig && ( ! signing || signing . style !== "Manual" ) ) {
429
434
xcode . setManualSigningStyle ( projectData . projectName ) ;
430
435
xcode . save ( ) ;
431
436
} else if ( ! buildConfig . provision && ! ( signing && signing . style === "Manual" && ! buildConfig . teamId ) ) {
@@ -616,7 +621,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
616
621
617
622
if ( provision ) {
618
623
let projectRoot = path . join ( projectData . platformsDir , "ios" ) ;
619
- await this . setupSigningFromProvision ( projectRoot , provision ) ;
624
+ await this . setupSigningFromProvision ( projectRoot , projectData , provision ) ;
620
625
}
621
626
622
627
let project = this . createPbxProj ( projectData ) ;
@@ -837,6 +842,41 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
837
842
return Promise . resolve ( ) ;
838
843
}
839
844
845
+ public checkForChanges ( changesInfo : IProjectChangesInfo , options : IProjectChangesOptions , projectData : IProjectData ) : void {
846
+ const nextCommandProvisionUUID = options . provision ;
847
+
848
+ if ( typeof nextCommandProvisionUUID === "string" ) {
849
+ const pbxprojPath = this . getPbxProjPath ( projectData ) ;
850
+
851
+ // Check if the native project's signing is set to the provided provision...
852
+ let signingChanged = false ;
853
+ if ( ! fs . existsSync ( pbxprojPath ) ) {
854
+ const xcode = Xcode . open ( pbxprojPath ) ;
855
+ const signing = xcode . getSigning ( projectData . projectName ) ;
856
+ if ( signing . style === "Manual" ) {
857
+ for ( let name in signing . configurations ) {
858
+ let config = signing . configurations [ name ] ;
859
+ if ( config . uuid != nextCommandProvisionUUID && config . name != nextCommandProvisionUUID ) {
860
+ signingChanged = true ;
861
+ break ;
862
+ }
863
+ }
864
+ } else {
865
+ signingChanged = true ;
866
+ }
867
+ } else {
868
+ signingChanged = true ;
869
+ }
870
+
871
+ if ( signingChanged ) {
872
+ changesInfo . nativeChanged = true ;
873
+ changesInfo . configChanged = true ;
874
+ // TRICKY: The native project is prepared only if appResourcesChanged.
875
+ changesInfo . appResourcesChanged = true ;
876
+ }
877
+ }
878
+ }
879
+
840
880
private getAllLibsForPluginWithFileExtension ( pluginData : IPluginData , fileExtension : string ) : string [ ] {
841
881
let filterCallback = ( fileName : string , pluginPlatformsFolderPath : string ) => path . extname ( fileName ) === fileExtension ;
842
882
return this . getAllNativeLibrariesForPlugin ( pluginData , IOSProjectService . IOS_PLATFORM_NAME , filterCallback ) ;
@@ -1179,6 +1219,14 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
1179
1219
return this . readXCConfig ( "PROVISIONING_PROFILE[sdk=iphoneos*]" , projectData ) ;
1180
1220
}
1181
1221
1222
+ private readXCConfigProvisioningProfileSpecifier ( projectData : IProjectData ) : string {
1223
+ return this . readXCConfig ( "PROVISIONING_PROFILE_SPECIFIER" , projectData ) ;
1224
+ }
1225
+
1226
+ private readXCConfigProvisioningProfileSpecifierForIPhoneOs ( projectData : IProjectData ) : string {
1227
+ return this . readXCConfig ( "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" , projectData ) ;
1228
+ }
1229
+
1182
1230
private async getDevelopmentTeam ( projectData : IProjectData , teamId ?: string ) : Promise < string > {
1183
1231
teamId = teamId || this . readTeamId ( projectData ) ;
1184
1232
0 commit comments