Skip to content

Revisit the manual signing, revert the dialogs and add --provision switch #2393

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 1 commit into from
Jan 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ $injector.require("projectDataService", "./services/project-data-service");
$injector.require("projectService", "./services/project-service");
$injector.require("androidProjectService", "./services/android-project-service");
$injector.require("iOSProjectService", "./services/ios-project-service");
$injector.require("iOSProvisionService", "./services/ios-provision-service");

$injector.require("cocoapodsService", "./services/cocoapods-service");

Expand Down
17 changes: 11 additions & 6 deletions lib/commands/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export class BuildCommandBase {
constructor(protected $options: IOptions,
private $platformService: IPlatformService) { }
protected $platformsData: IPlatformsData,
protected $platformService: IPlatformService) { }

executeCore(args: string[]): IFuture<void> {
return (() => {
Expand All @@ -17,25 +18,29 @@ export class BuildCommandBase {

export class BuildIosCommand extends BuildCommandBase implements ICommand {
constructor(protected $options: IOptions,
private $platformsData: IPlatformsData,
$platformsData: IPlatformsData,
$platformService: IPlatformService) {
super($options, $platformService);
super($options, $platformsData, $platformService);
}

public allowedParameters: ICommandParameter[] = [];

public execute(args: string[]): IFuture<void> {
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
}

public canExecute(args: string[]): IFuture<boolean> {
return this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
}
}
$injector.registerCommand("build|ios", BuildIosCommand);

export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
constructor(protected $options: IOptions,
private $platformsData: IPlatformsData,
$platformsData: IPlatformsData,
private $errors: IErrors,
$platformService: IPlatformService) {
super($options, $platformService);
super($options, $platformsData, $platformService);
}

public execute(args: string[]): IFuture<void> {
Expand All @@ -49,7 +54,7 @@ export class BuildAndroidCommand extends BuildCommandBase 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 args.length === 0;
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android).wait();
}).future<boolean>()();
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class DeployOnDeviceCommand implements ICommand {
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
}

return true;
return this.$platformService.validateOptions(args[0]).wait();
}).future<boolean>()();
}

Expand Down
4 changes: 4 additions & 0 deletions lib/commands/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export class PrepareCommand implements ICommand {
}).future<void>()();
}

public canExecute(args: string[]): IFuture<boolean> {
return this.$platformService.validateOptions(args[0]);
}

allowedParameters = [this.$platformCommandParameter];
}
$injector.registerCommand("prepare", PrepareCommand);
13 changes: 9 additions & 4 deletions lib/commands/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class RunCommandBase {
constructor(private $platformService: IPlatformService,
private $usbLiveSyncService: ILiveSyncService,
constructor(protected $platformService: IPlatformService,
protected $usbLiveSyncService: ILiveSyncService,
protected $options: IOptions) { }

public executeCore(args: string[]): IFuture<void> {
Expand All @@ -16,7 +16,8 @@ export class RunIosCommand extends RunCommandBase implements ICommand {
constructor($platformService: IPlatformService,
private $platformsData: IPlatformsData,
$usbLiveSyncService: ILiveSyncService,
$options: IOptions) {
$options: IOptions,
private $injector: IInjector) {
super($platformService, $usbLiveSyncService, $options);
}

Expand All @@ -25,6 +26,10 @@ export class RunIosCommand extends RunCommandBase implements ICommand {
public execute(args: string[]): IFuture<void> {
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
}

public canExecute(args: string[]): IFuture<boolean> {
return this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
}
}
$injector.registerCommand("run|ios", RunIosCommand);

Expand All @@ -48,7 +53,7 @@ export class RunAndroidCommand extends RunCommandBase 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 args.length === 0;
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android).wait();
}).future<boolean>()();
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ interface IOptions extends ICommonOptions {
liveEdit: boolean;
chrome: boolean;
clean: boolean;
provision: any;
}

interface IInitService {
Expand Down
5 changes: 5 additions & 0 deletions lib/definitions/platform.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ interface IPlatformService {
*/
installApplication(device: Mobile.IDevice): IFuture<void>;

/**
* Gets first chance to validate the options provided as command line arguments.
*/
validateOptions(platform: string): IFuture<boolean>;

/**
* Executes prepare, build and installOnPlatform when necessary to ensure that the latest version of the app is installed on specified platform.
* - When --clean option is specified it builds the app on every change. If not, build is executed only when there are native changes.
Expand Down
2 changes: 2 additions & 0 deletions lib/definitions/project-changes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ interface IPrepareInfo {
release: boolean;
changesRequireBuild: boolean;
changesRequireBuildTime: string;

iOSProvisioningProfileUUID?: string;
}

interface IProjectChangesInfo {
Expand Down
5 changes: 5 additions & 0 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ interface IPlatformProjectService {
*/
afterCreateProject(projectRoot: string): void;

/**
* Gets first chance to validate the options provided as command line arguments.
*/
validateOptions(): IFuture<boolean>;

buildProject(projectRoot: string, buildConfig?: IBuildConfig): IFuture<void>;

/**
Expand Down
1 change: 1 addition & 0 deletions lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class Options extends commonOptionsLibPath.OptionsBase {
copyFrom: { type: OptionType.String },
linkTo: { type: OptionType.String },
forDevice: { type: OptionType.Boolean },
provision: { type: OptionType.Object },
client: { type: OptionType.Boolean, default: true },
production: { type: OptionType.Boolean },
debugTransport: { type: OptionType.Boolean },
Expand Down
4 changes: 4 additions & 0 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
return this._platformData;
}

public validateOptions(): IFuture<boolean> {
return Future.fromResult(true);
}

public getAppResourcesDestinationDirectoryPath(frameworkVersion?: string): string {
if (this.canUseGradle(frameworkVersion)) {
return path.join(this.platformData.projectRoot, "src", "main", "res");
Expand Down
Loading