Skip to content

Commit 59bc650

Browse files
committed
Revisit the manual signing, revert the dialogs and add --provision switch
1 parent 4876ada commit 59bc650

18 files changed

+319
-217
lines changed

lib/bootstrap.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ $injector.require("projectDataService", "./services/project-data-service");
1010
$injector.require("projectService", "./services/project-service");
1111
$injector.require("androidProjectService", "./services/android-project-service");
1212
$injector.require("iOSProjectService", "./services/ios-project-service");
13+
$injector.require("iOSProvisionService", "./services/ios-provision-service");
1314

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

lib/commands/build.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export class BuildCommandBase {
22
constructor(protected $options: IOptions,
3-
private $platformService: IPlatformService) { }
3+
protected $platformsData: IPlatformsData,
4+
protected $platformService: IPlatformService) { }
45

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

1819
export class BuildIosCommand extends BuildCommandBase implements ICommand {
1920
constructor(protected $options: IOptions,
20-
private $platformsData: IPlatformsData,
21+
$platformsData: IPlatformsData,
2122
$platformService: IPlatformService) {
22-
super($options, $platformService);
23+
super($options, $platformsData, $platformService);
2324
}
2425

2526
public allowedParameters: ICommandParameter[] = [];
2627

2728
public execute(args: string[]): IFuture<void> {
2829
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
2930
}
31+
32+
public canExecute(args: string[]): IFuture<boolean> {
33+
return this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
34+
}
3035
}
3136
$injector.registerCommand("build|ios", BuildIosCommand);
3237

3338
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
3439
constructor(protected $options: IOptions,
35-
private $platformsData: IPlatformsData,
40+
$platformsData: IPlatformsData,
3641
private $errors: IErrors,
3742
$platformService: IPlatformService) {
38-
super($options, $platformService);
43+
super($options, $platformsData, $platformService);
3944
}
4045

4146
public execute(args: string[]): IFuture<void> {
@@ -49,7 +54,7 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
4954
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
5055
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
5156
}
52-
return args.length === 0;
57+
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android).wait();
5358
}).future<boolean>()();
5459
}
5560
}

lib/commands/deploy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class DeployOnDeviceCommand implements ICommand {
2323
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
2424
}
2525

26-
return true;
26+
return this.$platformService.validateOptions(args[0]).wait();
2727
}).future<boolean>()();
2828
}
2929

lib/commands/prepare.ts

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export class PrepareCommand implements ICommand {
99
}).future<void>()();
1010
}
1111

12+
public canExecute(args: string[]): IFuture<boolean> {
13+
return this.$platformService.validateOptions(args[0]);
14+
}
15+
1216
allowedParameters = [this.$platformCommandParameter];
1317
}
1418
$injector.registerCommand("prepare", PrepareCommand);

lib/commands/run.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export class RunCommandBase {
2-
constructor(private $platformService: IPlatformService,
3-
private $usbLiveSyncService: ILiveSyncService,
2+
constructor(protected $platformService: IPlatformService,
3+
protected $usbLiveSyncService: ILiveSyncService,
44
protected $options: IOptions) { }
55

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

@@ -25,6 +26,10 @@ export class RunIosCommand extends RunCommandBase implements ICommand {
2526
public execute(args: string[]): IFuture<void> {
2627
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
2728
}
29+
30+
public canExecute(args: string[]): IFuture<boolean> {
31+
return this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
32+
}
2833
}
2934
$injector.registerCommand("run|ios", RunIosCommand);
3035

@@ -48,7 +53,7 @@ export class RunAndroidCommand extends RunCommandBase implements ICommand {
4853
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
4954
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
5055
}
51-
return args.length === 0;
56+
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android).wait();
5257
}).future<boolean>()();
5358
}
5459
}

lib/declarations.ts

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ interface IOptions extends ICommonOptions {
9696
liveEdit: boolean;
9797
chrome: boolean;
9898
clean: boolean;
99+
provision: any;
99100
}
100101

101102
interface IInitService {

lib/definitions/platform.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ interface IPlatformService {
7676
*/
7777
installApplication(device: Mobile.IDevice): IFuture<void>;
7878

79+
/**
80+
* Gets first chance to validate the options provided as command line arguments.
81+
*/
82+
validateOptions(platform: string): IFuture<boolean>;
83+
7984
/**
8085
* Executes prepare, build and installOnPlatform when necessary to ensure that the latest version of the app is installed on specified platform.
8186
* - When --clean option is specified it builds the app on every change. If not, build is executed only when there are native changes.

lib/definitions/project-changes.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ interface IPrepareInfo {
44
release: boolean;
55
changesRequireBuild: boolean;
66
changesRequireBuildTime: string;
7+
8+
iOSProvisioningProfileUUID?: string;
79
}
810

911
interface IProjectChangesInfo {

lib/definitions/project.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ interface IPlatformProjectService {
103103
*/
104104
afterCreateProject(projectRoot: string): void;
105105

106+
/**
107+
* Gets first chance to validate the options provided as command line arguments.
108+
*/
109+
validateOptions(): IFuture<boolean>;
110+
106111
buildProject(projectRoot: string, buildConfig?: IBuildConfig): IFuture<void>;
107112

108113
/**

lib/options.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class Options extends commonOptionsLibPath.OptionsBase {
1717
copyFrom: { type: OptionType.String },
1818
linkTo: { type: OptionType.String },
1919
forDevice: { type: OptionType.Boolean },
20+
provision: { type: OptionType.Object },
2021
client: { type: OptionType.Boolean, default: true },
2122
production: { type: OptionType.Boolean },
2223
debugTransport: { type: OptionType.Boolean },

lib/services/android-project-service.ts

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
7575
return this._platformData;
7676
}
7777

78+
public validateOptions(): IFuture<boolean> {
79+
return Future.fromResult(true);
80+
}
81+
7882
public getAppResourcesDestinationDirectoryPath(frameworkVersion?: string): string {
7983
if (this.canUseGradle(frameworkVersion)) {
8084
return path.join(this.platformData.projectRoot, "src", "main", "res");

0 commit comments

Comments
 (0)