File tree Expand file tree Collapse file tree 3 files changed +38
-5
lines changed Expand file tree Collapse file tree 3 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ $injector.registerCommand("build|ios", BuildIosCommand);
26
26
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
27
27
constructor ( $platformService : IPlatformService ,
28
28
private $platformsData : IPlatformsData ,
29
- private $options : IOptions ) {
29
+ private $options : IOptions ,
30
+ private $errors : IErrors ) {
30
31
super ( $platformService ) ;
31
32
}
32
33
@@ -36,5 +37,14 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
36
37
}
37
38
38
39
public allowedParameters : ICommandParameter [ ] = [ ] ;
40
+
41
+ public canExecute ( args : string [ ] ) : IFuture < boolean > {
42
+ return ( ( ) => {
43
+ if ( this . $options . release && ( ! this . $options . keyStorePath || ! this . $options . keyStorePassword || ! this . $options . keyStoreAlias || ! this . $options . keyStoreAliasPassword ) ) {
44
+ this . $errors . fail ( "When producing a release build, you need to specify all --key-store-* options." ) ;
45
+ }
46
+ return args . length === 0 ;
47
+ } ) . future < boolean > ( ) ( ) ;
48
+ }
39
49
}
40
50
$injector . registerCommand ( "build|android" , BuildAndroidCommand ) ;
Original file line number Diff line number Diff line change 3
3
4
4
export class DeployOnDeviceCommand implements ICommand {
5
5
constructor ( private $platformService : IPlatformService ,
6
- private $platformCommandParameter : ICommandParameter ) { }
6
+ private $platformCommandParameter : ICommandParameter ,
7
+ private $options : IOptions ,
8
+ private $errors : IErrors ) { }
7
9
8
10
execute ( args : string [ ] ) : IFuture < void > {
9
11
return this . $platformService . deployOnDevice ( args [ 0 ] ) ;
10
12
}
11
13
12
- allowedParameters = [ this . $platformCommandParameter ] ;
14
+ public canExecute ( args : string [ ] ) : IFuture < boolean > {
15
+ return ( ( ) => {
16
+ if ( this . $options . release && ( ! this . $options . keyStorePath || ! this . $options . keyStorePassword || ! this . $options . keyStoreAlias || ! this . $options . keyStoreAliasPassword ) ) {
17
+ this . $errors . fail ( "When producing a release build, you need to specify all --key-store-* options." ) ;
18
+ }
19
+ let res = ( args . length === 1 ) && this . $platformCommandParameter . validate ( args [ 0 ] ) . wait ( ) ;
20
+ return res ;
21
+ } ) . future < boolean > ( ) ( ) ;
22
+ }
23
+
24
+ allowedParameters : ICommandParameter [ ] = [ ] ;
13
25
}
14
26
$injector . registerCommand ( "deploy" , DeployOnDeviceCommand ) ;
Original file line number Diff line number Diff line change @@ -25,14 +25,25 @@ $injector.registerCommand("run|ios", RunIosCommand);
25
25
26
26
export class RunAndroidCommand extends RunCommandBase implements ICommand {
27
27
constructor ( $platformService : IPlatformService ,
28
- private $platformsData : IPlatformsData ) {
29
- super ( $platformService ) ;
28
+ private $platformsData : IPlatformsData ,
29
+ private $options : IOptions ,
30
+ private $errors : IErrors ) {
31
+ super ( $platformService ) ;
30
32
}
31
33
32
34
public allowedParameters : ICommandParameter [ ] = [ ] ;
33
35
34
36
public execute ( args : string [ ] ) : IFuture < void > {
35
37
return this . executeCore ( [ this . $platformsData . availablePlatforms . Android ] ) ;
36
38
}
39
+
40
+ public canExecute ( args : string [ ] ) : IFuture < boolean > {
41
+ return ( ( ) => {
42
+ if ( this . $options . release && ( ! this . $options . keyStorePath || ! this . $options . keyStorePassword || ! this . $options . keyStoreAlias || ! this . $options . keyStoreAliasPassword ) ) {
43
+ this . $errors . fail ( "When producing a release build, you need to specify all --key-store-* options." ) ;
44
+ }
45
+ return args . length === 0 ;
46
+ } ) . future < boolean > ( ) ( ) ;
47
+ }
37
48
}
38
49
$injector . registerCommand ( "run|android" , RunAndroidCommand ) ;
You can’t perform that action at this time.
0 commit comments