@@ -311,7 +311,17 @@ export class IOSSigningService implements IiOSSigningService {
311
311
"project.pbxproj"
312
312
) ;
313
313
}
314
-
314
+ private readTeamIdFromFile ( projectRoot : string ) : string | undefined {
315
+ try {
316
+ const filePath = path . join ( projectRoot , "teamid" ) ;
317
+ if ( this . $fs . exists ( filePath ) ) {
318
+ return this . $fs . readText ( filePath ) ;
319
+ }
320
+ } catch ( e ) {
321
+ this . $logger . trace ( "Unable to read file: teamid. Error is: " , e ) ;
322
+ }
323
+ return undefined ;
324
+ }
315
325
private async getDevelopmentTeam (
316
326
projectData : IProjectData ,
317
327
projectRoot : string ,
@@ -345,45 +355,54 @@ export class IOSSigningService implements IiOSSigningService {
345
355
) } . Specify team in app/App_Resources/iOS/build.xcconfig file in the following way: DEVELOPMENT_TEAM = <team id>`
346
356
) ;
347
357
}
348
-
349
- const choices : string [ ] = [ ] ;
350
- for ( const team of teams ) {
351
- choices . push ( team . name + " (" + team . id + ")" ) ;
358
+ const fromFile = this . readTeamIdFromFile ( projectRoot ) ;
359
+ if ( fromFile ) {
360
+ const idFromFile = teams . find ( ( value ) => value . id === fromFile ) ;
361
+ if ( idFromFile ) {
362
+ teamId = idFromFile . id ;
363
+ this . $logger . info ( `Team Id resolved from file: '${ teamId } '.` ) ;
364
+ }
352
365
}
353
- const choice = await this . $prompter . promptForChoice (
354
- "Found multiple development teams, select one:" ,
355
- choices
356
- ) ;
357
- teamId = teams [ choices . indexOf ( choice ) ] . id ;
358
-
359
- const choicesPersist = [
360
- "Yes, set the DEVELOPMENT_TEAM setting in build.xcconfig file." ,
361
- "Yes, persist the team id in platforms folder." ,
362
- "No, don't persist this setting." ,
363
- ] ;
364
- const choicePersist = await this . $prompter . promptForChoice (
365
- "Do you want to make teamId: " +
366
- teamId +
367
- " a persistent choice for your app?" ,
368
- choicesPersist
369
- ) ;
370
- switch ( choicesPersist . indexOf ( choicePersist ) ) {
371
- case 0 :
372
- const xcconfigFile = path . join (
373
- projectData . appResourcesDirectoryPath ,
374
- "iOS" ,
375
- BUILD_XCCONFIG_FILE_NAME
376
- ) ;
377
- this . $fs . appendFile (
378
- xcconfigFile ,
379
- "\nDEVELOPMENT_TEAM = " + teamId + "\n"
380
- ) ;
381
- break ;
382
- case 1 :
383
- this . $fs . writeFile ( path . join ( projectRoot , "teamid" ) , teamId ) ;
384
- break ;
385
- default :
386
- break ;
366
+ if ( ! teamId ) {
367
+ const choices : string [ ] = [ ] ;
368
+ for ( const team of teams ) {
369
+ choices . push ( team . name + " (" + team . id + ")" ) ;
370
+ }
371
+ const choice = await this . $prompter . promptForChoice (
372
+ "Found multiple development teams, select one:" ,
373
+ choices
374
+ ) ;
375
+ teamId = teams [ choices . indexOf ( choice ) ] . id ;
376
+
377
+ const choicesPersist = [
378
+ "Yes, set the DEVELOPMENT_TEAM setting in build.xcconfig file." ,
379
+ "Yes, persist the team id in platforms folder." ,
380
+ "No, don't persist this setting." ,
381
+ ] ;
382
+ const choicePersist = await this . $prompter . promptForChoice (
383
+ "Do you want to make teamId: " +
384
+ teamId +
385
+ " a persistent choice for your app?" ,
386
+ choicesPersist
387
+ ) ;
388
+ switch ( choicesPersist . indexOf ( choicePersist ) ) {
389
+ case 0 :
390
+ const xcconfigFile = path . join (
391
+ projectData . appResourcesDirectoryPath ,
392
+ "iOS" ,
393
+ BUILD_XCCONFIG_FILE_NAME
394
+ ) ;
395
+ this . $fs . appendFile (
396
+ xcconfigFile ,
397
+ "\nDEVELOPMENT_TEAM = " + teamId + "\n"
398
+ ) ;
399
+ break ;
400
+ case 1 :
401
+ this . $fs . writeFile ( path . join ( projectRoot , "teamid" ) , teamId ) ;
402
+ break ;
403
+ default :
404
+ break ;
405
+ }
387
406
}
388
407
}
389
408
}
0 commit comments