Skip to content

Commit 9fb0efc

Browse files
Fix xcode9 provision, provide --quiet by default, enable -allowProvisioningUpdates (#3070)
* Setup the provisioningProfiles in the exportOptions plist, provide quiet flags to xcodebuild and gradle, provide -allowProvisioningUpdates to xcodebuild > 9.0 * Using teamId without arg will print all teams, teamId and provision are mutually exclusive, teamId now should work with name if a provision that has the team id for the provided team name is found * Add documentation on --team-id near --provision * Fix versionCompare for the '8.0' and '9.0' versions we compare in ios-project-service * Address PR review * Address another PR comment, native builds will now print short friendly message...
1 parent 0d536f4 commit 9fb0efc

22 files changed

+243
-179
lines changed

docs/man_pages/project/testing/build-ios.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Builds the project for iOS and produces an `APP` or `IPA` that you can manually
1515
* `--release` - If set, produces a release build. Otherwise, produces a debug build.
1616
* `--for-device` - If set, produces an application package that you can deploy on device. Otherwise, produces a build that you can run only in the native iOS Simulator.
1717
* `--copy-to` - Specifies the file path where the built `.ipa` will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.
18+
* `--team-id` - If used without parameter, lists all team names and ids. If used with team name or id, it will switch to automatic signing mode and configure the .xcodeproj file of your app. In this case .xcconfig should not contain any provisioning/team id flags. This team id will be further used for codesigning the app. For Xcode 9.0+, xcodebuild will be allowed to update and modify automatically managed provisioning profiles.
1819
* `--provision` - If used without parameter, lists all eligible provisioning profiles. If used with UUID or name of your provisioning profile, it will switch to manual signing mode and configure the .xcodeproj file of your app. In this case xcconfig should not contain any provisioning/team id flags. This provisioning profile will be further used for codesigning the app.
1920
<% } %>
2021
<% if(isHtml) { %>

lib/commands/appstore-upload.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class PublishIOS implements ICommand {
8383
let archivePath = await iOSProjectService.archive(this.$projectData);
8484
this.$logger.info("Archive at: " + archivePath);
8585

86-
let exportPath = await iOSProjectService.exportArchive(this.$projectData, { archivePath, teamID });
86+
let exportPath = await iOSProjectService.exportArchive(this.$projectData, { archivePath, teamID, provision: mobileProvisionIdentifier || this.$options.provision });
8787
this.$logger.info("Export at: " + exportPath);
8888

8989
ipaFilePath = exportPath;

lib/commands/build.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
5757

5858
public canExecute(args: string[]): Promise<boolean> {
5959
super.validatePlatform(this.$devicePlatformsConstants.iOS);
60-
return args.length === 0 && this.$platformService.validateOptions(this.$options.provision, this.$projectData, this.$platformsData.availablePlatforms.iOS);
60+
return args.length === 0 && this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, this.$platformsData.availablePlatforms.iOS);
6161
}
6262
}
6363

@@ -89,7 +89,7 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
8989
const platformProjectService = platformData.platformProjectService;
9090
await platformProjectService.validate(this.$projectData);
9191

92-
return args.length === 0 && await this.$platformService.validateOptions(this.$options.provision, this.$projectData, this.$platformsData.availablePlatforms.Android);
92+
return args.length === 0 && await this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, this.$platformsData.availablePlatforms.Android);
9393
}
9494
}
9595

lib/commands/debug.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export class DebugIOSCommand implements ICommand {
154154
this.$errors.fail(`Applications for platform ${this.$devicePlatformsConstants.iOS} can not be built on this OS`);
155155
}
156156

157-
return await this.debugPlatformCommand.canExecute(args) && await this.$platformService.validateOptions(this.$options.provision, this.$projectData, this.$platformsData.availablePlatforms.iOS);
157+
return await this.debugPlatformCommand.canExecute(args) && await this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, this.$platformsData.availablePlatforms.iOS);
158158
}
159159

160160
public platform = this.$devicePlatformsConstants.iOS;
@@ -186,7 +186,7 @@ export class DebugAndroidCommand implements ICommand {
186186
return this.debugPlatformCommand.execute(args);
187187
}
188188
public async canExecute(args: string[]): Promise<boolean> {
189-
return await this.debugPlatformCommand.canExecute(args) && await this.$platformService.validateOptions(this.$options.provision, this.$projectData, this.$platformsData.availablePlatforms.Android);
189+
return await this.debugPlatformCommand.canExecute(args) && await this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, this.$platformsData.availablePlatforms.Android);
190190
}
191191

192192
public platform = this.$devicePlatformsConstants.Android;

lib/commands/deploy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class DeployOnDeviceCommand implements ICommand {
4848
const platformProjectService = platformData.platformProjectService;
4949
await platformProjectService.validate(this.$projectData);
5050

51-
return this.$platformService.validateOptions(this.$options.provision, this.$projectData, args[0]);
51+
return this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, args[0]);
5252
}
5353
}
5454

lib/commands/prepare.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class PrepareCommand implements ICommand {
1616

1717
public async canExecute(args: string[]): Promise<boolean> {
1818
const platform = args[0];
19-
const result = await this.$platformCommandParameter.validate(platform) && await this.$platformService.validateOptions(this.$options.provision, this.$projectData, platform);
19+
const result = await this.$platformCommandParameter.validate(platform) && await this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, platform);
2020
if (result) {
2121
const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
2222
const platformProjectService = platformData.platformProjectService;

lib/commands/run.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class RunIosCommand implements ICommand {
9797
}
9898

9999
public async canExecute(args: string[]): Promise<boolean> {
100-
return await this.runCommand.canExecute(args) && await this.$platformService.validateOptions(this.$options.provision, this.$projectData, this.$platformsData.availablePlatforms.iOS);
100+
return await this.runCommand.canExecute(args) && await this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, this.$platformsData.availablePlatforms.iOS);
101101
}
102102
}
103103

@@ -140,7 +140,7 @@ export class RunAndroidCommand implements ICommand {
140140
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
141141
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
142142
}
143-
return this.$platformService.validateOptions(this.$options.provision, this.$projectData, this.$platformsData.availablePlatforms.Android);
143+
return this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, this.$platformsData.availablePlatforms.Android);
144144
}
145145
}
146146

lib/definitions/platform.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ interface IPlatformService extends NodeJS.EventEmitter {
101101
* If no platform is provided or a falsy (null, undefined, "", false...) platform is provided,
102102
* the options will be validated for all available platforms.
103103
*/
104-
validateOptions(provision: any, projectData: IProjectData, platform?: string): Promise<boolean>;
104+
validateOptions(provision: true | string, teamId: true | string, projectData: IProjectData, platform?: string): Promise<boolean>;
105105

106106
/**
107107
* Executes prepare, build and installOnPlatform when necessary to ensure that the latest version of the app is installed on specified platform.
@@ -218,7 +218,7 @@ interface IPlatformOptions extends IPlatformSpecificData, ICreateProjectOptions
218218
/**
219219
* Platform specific data required for project preparation.
220220
*/
221-
interface IPlatformSpecificData extends IProvision {
221+
interface IPlatformSpecificData extends IProvision, ITeamIdentifier {
222222
/**
223223
* Target SDK for Android.
224224
*/

lib/definitions/project-changes.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ interface IProjectChangesInfo extends IAddedNativePlatform {
2222
readonly changesRequirePrepare: boolean;
2323
}
2424

25-
interface IProjectChangesOptions extends IAppFilesUpdaterOptions, IProvision {
25+
interface IProjectChangesOptions extends IAppFilesUpdaterOptions, IProvision, ITeamIdentifier {
2626
nativePlatformStatus?: "1" | "2" | "3";
2727
}
2828

2929
interface IProjectChangesService {
30-
checkForChanges(platform: string, projectData: IProjectData, buildOptions: IProjectChangesOptions): IProjectChangesInfo;
30+
checkForChanges(platform: string, projectData: IProjectData, buildOptions: IProjectChangesOptions): Promise<IProjectChangesInfo>;
3131
getPrepareInfo(platform: string, projectData: IProjectData): IPrepareInfo;
3232
savePrepareInfo(platform: string, projectData: IProjectData): void;
3333
getPrepareInfoFilePath(platform: string, projectData: IProjectData): string;

lib/definitions/project.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ interface IPlatformProjectService extends NodeJS.EventEmitter {
178178
* @param {any} provision UUID of the provisioning profile used in iOS option validation.
179179
* @returns {void}
180180
*/
181-
validateOptions(projectId?: string, provision?: true | string): Promise<boolean>;
181+
validateOptions(projectId?: string, provision?: true | string, teamId?: true | string): Promise<boolean>;
182182

183183
validatePlugins(projectData: IProjectData): Promise<void>;
184184

@@ -265,7 +265,7 @@ interface IPlatformProjectService extends NodeJS.EventEmitter {
265265
* Check the current state of the project, and validate against the options.
266266
* If there are parts in the project that are inconsistent with the desired options, marks them in the changeset flags.
267267
*/
268-
checkForChanges(changeset: IProjectChangesInfo, options: IProjectChangesOptions, projectData: IProjectData): void;
268+
checkForChanges(changeset: IProjectChangesInfo, options: IProjectChangesOptions, projectData: IProjectData): Promise<void>;
269269
}
270270

271271
interface IAndroidProjectPropertiesManager {

lib/options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class Options extends commonOptionsLibPath.OptionsBase {
3434
androidTypings: { type: OptionType.Boolean },
3535
bundle: { type: OptionType.Boolean },
3636
all: { type: OptionType.Boolean },
37-
teamId: { type: OptionType.String },
37+
teamId: { type: OptionType.Object },
3838
syncAllFiles: { type: OptionType.Boolean, default: false },
3939
liveEdit: { type: OptionType.Boolean },
4040
chrome: { type: OptionType.Boolean },

lib/services/android-project-service.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
447447
await adb.executeShellCommand(["rm", "-rf", deviceRootPath]);
448448
}
449449

450-
public checkForChanges(changesInfo: IProjectChangesInfo, options: IProjectChangesOptions, projectData: IProjectData): void {
450+
public async checkForChanges(changesInfo: IProjectChangesInfo, options: IProjectChangesOptions, projectData: IProjectData): Promise<void> {
451451
// Nothing android specific to check yet.
452452
}
453453

@@ -517,12 +517,18 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
517517
if (this.$androidToolsInfo.getToolsInfo().androidHomeEnvVar) {
518518
const gradlew = this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew";
519519

520+
const localArgs = [...gradleArgs];
521+
if (this.$logger.getLevel() === "INFO") {
522+
localArgs.push("--quiet");
523+
this.$logger.info("Gradle build...");
524+
}
525+
520526
childProcessOpts = childProcessOpts || {};
521527
childProcessOpts.cwd = childProcessOpts.cwd || projectRoot;
522528
childProcessOpts.stdio = childProcessOpts.stdio || "inherit";
523529

524530
return await this.spawn(gradlew,
525-
gradleArgs,
531+
localArgs,
526532
childProcessOpts,
527533
spawnFromEventOptions);
528534
}

0 commit comments

Comments
 (0)