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);
2626export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
2727 constructor ( $platformService : IPlatformService ,
2828 private $platformsData : IPlatformsData ,
29- private $options : IOptions ) {
29+ private $options : IOptions ,
30+ private $errors : IErrors ) {
3031 super ( $platformService ) ;
3132 }
3233
@@ -36,5 +37,14 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
3637 }
3738
3839 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+ }
3949}
4050$injector . registerCommand ( "build|android" , BuildAndroidCommand ) ;
Original file line number Diff line number Diff line change 33
44export class DeployOnDeviceCommand implements ICommand {
55 constructor ( private $platformService : IPlatformService ,
6- private $platformCommandParameter : ICommandParameter ) { }
6+ private $platformCommandParameter : ICommandParameter ,
7+ private $options : IOptions ,
8+ private $errors : IErrors ) { }
79
810 execute ( args : string [ ] ) : IFuture < void > {
911 return this . $platformService . deployOnDevice ( args [ 0 ] ) ;
1012 }
1113
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 [ ] = [ ] ;
1325}
1426$injector . registerCommand ( "deploy" , DeployOnDeviceCommand ) ;
Original file line number Diff line number Diff line change @@ -25,14 +25,25 @@ $injector.registerCommand("run|ios", RunIosCommand);
2525
2626export class RunAndroidCommand extends RunCommandBase implements ICommand {
2727 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 ) ;
3032 }
3133
3234 public allowedParameters : ICommandParameter [ ] = [ ] ;
3335
3436 public execute ( args : string [ ] ) : IFuture < void > {
3537 return this . executeCore ( [ this . $platformsData . availablePlatforms . Android ] ) ;
3638 }
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+ }
3748}
3849$injector . registerCommand ( "run|android" , RunAndroidCommand ) ;
You can’t perform that action at this time.
0 commit comments