Skip to content

Fix xcode9 provision, provide --quiet by default, enable -allowProvisioningUpdates #3070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 23, 2017
Merged
1 change: 1 addition & 0 deletions docs/man_pages/project/testing/build-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Builds the project for iOS and produces an `APP` or `IPA` that you can manually
* `--release` - If set, produces a release build. Otherwise, produces a debug build.
* `--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.
* `--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.
* `--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.
* `--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.
<% } %>
<% if(isHtml) { %>
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/appstore-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class PublishIOS implements ICommand {
let archivePath = await iOSProjectService.archive(this.$projectData);
this.$logger.info("Archive at: " + archivePath);

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

ipaFilePath = exportPath;
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class DebugIOSCommand implements ICommand {
this.$errors.fail(`Applications for platform ${this.$devicePlatformsConstants.iOS} can not be built on this OS`);
}

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

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

public platform = this.$devicePlatformsConstants.Android;
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class DeployOnDeviceCommand implements ICommand {
const platformProjectService = platformData.platformProjectService;
await platformProjectService.validate(this.$projectData);

return this.$platformService.validateOptions(this.$options.provision, this.$projectData, args[0]);
return this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, args[0]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class PrepareCommand implements ICommand {

public async canExecute(args: string[]): Promise<boolean> {
const platform = args[0];
const result = await this.$platformCommandParameter.validate(platform) && await this.$platformService.validateOptions(this.$options.provision, this.$projectData, platform);
const result = await this.$platformCommandParameter.validate(platform) && await this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, platform);
if (result) {
const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
const platformProjectService = platformData.platformProjectService;
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class RunIosCommand implements ICommand {
}

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

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

Expand Down
4 changes: 2 additions & 2 deletions lib/definitions/platform.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ interface IPlatformService extends NodeJS.EventEmitter {
* If no platform is provided or a falsy (null, undefined, "", false...) platform is provided,
* the options will be validated for all available platforms.
*/
validateOptions(provision: any, projectData: IProjectData, platform?: string): Promise<boolean>;
validateOptions(provision: true | string, teamId: true | string, projectData: IProjectData, platform?: string): Promise<boolean>;

/**
* Executes prepare, build and installOnPlatform when necessary to ensure that the latest version of the app is installed on specified platform.
Expand Down Expand Up @@ -218,7 +218,7 @@ interface IPlatformOptions extends IPlatformSpecificData, ICreateProjectOptions
/**
* Platform specific data required for project preparation.
*/
interface IPlatformSpecificData extends IProvision {
interface IPlatformSpecificData extends IProvision, ITeamIdentifier {
/**
* Target SDK for Android.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/definitions/project-changes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ interface IProjectChangesInfo extends IAddedNativePlatform {
readonly changesRequirePrepare: boolean;
}

interface IProjectChangesOptions extends IAppFilesUpdaterOptions, IProvision {
interface IProjectChangesOptions extends IAppFilesUpdaterOptions, IProvision, ITeamIdentifier {
nativePlatformStatus?: "1" | "2" | "3";
}

interface IProjectChangesService {
checkForChanges(platform: string, projectData: IProjectData, buildOptions: IProjectChangesOptions): IProjectChangesInfo;
checkForChanges(platform: string, projectData: IProjectData, buildOptions: IProjectChangesOptions): Promise<IProjectChangesInfo>;
getPrepareInfo(platform: string, projectData: IProjectData): IPrepareInfo;
savePrepareInfo(platform: string, projectData: IProjectData): void;
getPrepareInfoFilePath(platform: string, projectData: IProjectData): string;
Expand Down
4 changes: 2 additions & 2 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ interface IPlatformProjectService extends NodeJS.EventEmitter {
* @param {any} provision UUID of the provisioning profile used in iOS option validation.
* @returns {void}
*/
validateOptions(projectId?: string, provision?: true | string): Promise<boolean>;
validateOptions(projectId?: string, provision?: true | string, teamId?: true | string): Promise<boolean>;

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

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

interface IAndroidProjectPropertiesManager {
Expand Down
2 changes: 1 addition & 1 deletion lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Options extends commonOptionsLibPath.OptionsBase {
androidTypings: { type: OptionType.Boolean },
bundle: { type: OptionType.Boolean },
all: { type: OptionType.Boolean },
teamId: { type: OptionType.String },
teamId: { type: OptionType.Object },
syncAllFiles: { type: OptionType.Boolean, default: false },
liveEdit: { type: OptionType.Boolean },
chrome: { type: OptionType.Boolean },
Expand Down
10 changes: 8 additions & 2 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
await adb.executeShellCommand(["rm", "-rf", deviceRootPath]);
}

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

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

const localArgs = [...gradleArgs];
if (this.$logger.getLevel() === "INFO") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use $loggingLevels.info here instead of a string

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep it this way, $loggingLevels has a different purpose. I'll handle the logging levels in a separate PR and will change this code with a constant in it.

localArgs.push("--quiet");
this.$logger.info("Gradle build...");
}

childProcessOpts = childProcessOpts || {};
childProcessOpts.cwd = childProcessOpts.cwd || projectRoot;
childProcessOpts.stdio = childProcessOpts.stdio || "inherit";

return await this.spawn(gradlew,
gradleArgs,
localArgs,
childProcessOpts,
spawnFromEventOptions);
}
Expand Down
Loading