@@ -2,6 +2,7 @@ export class BuildCommandBase {
22 constructor ( protected $options : IOptions ,
33 protected $projectData : IProjectData ,
44 protected $platformsData : IPlatformsData ,
5+ protected $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
56 protected $platformService : IPlatformService ) {
67 this . $projectData . initializeProjectData ( ) ;
78 }
@@ -35,17 +36,23 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
3536 public allowedParameters : ICommandParameter [ ] = [ ] ;
3637
3738 constructor ( protected $options : IOptions ,
39+ private $errors : IErrors ,
3840 $projectData : IProjectData ,
3941 $platformsData : IPlatformsData ,
42+ $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
4043 $platformService : IPlatformService ) {
41- super ( $options , $projectData , $platformsData , $platformService ) ;
44+ super ( $options , $projectData , $platformsData , $devicePlatformsConstants , $ platformService) ;
4245 }
4346
4447 public async execute ( args : string [ ] ) : Promise < void > {
4548 return this . executeCore ( [ this . $platformsData . availablePlatforms . iOS ] ) ;
4649 }
4750
4851 public canExecute ( args : string [ ] ) : Promise < boolean > {
52+ if ( ! this . $platformService . isPlatformSupportedForOS ( this . $devicePlatformsConstants . iOS , this . $projectData ) ) {
53+ this . $errors . fail ( "Applications for platform %s can not be built on this OS - %s" , this . $devicePlatformsConstants . iOS , process . platform ) ;
54+ }
55+
4956 return args . length === 0 && this . $platformService . validateOptions ( this . $options . provision , this . $projectData , this . $platformsData . availablePlatforms . iOS ) ;
5057 }
5158}
@@ -56,18 +63,23 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
5663 public allowedParameters : ICommandParameter [ ] = [ ] ;
5764
5865 constructor ( protected $options : IOptions ,
66+ private $errors : IErrors ,
5967 $projectData : IProjectData ,
6068 $platformsData : IPlatformsData ,
61- private $errors : IErrors ,
69+ $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
6270 $platformService : IPlatformService ) {
63- super ( $options , $projectData , $platformsData , $platformService ) ;
71+ super ( $options , $projectData , $platformsData , $devicePlatformsConstants , $ platformService) ;
6472 }
6573
6674 public async execute ( args : string [ ] ) : Promise < void > {
6775 return this . executeCore ( [ this . $platformsData . availablePlatforms . Android ] ) ;
6876 }
6977
7078 public async canExecute ( args : string [ ] ) : Promise < boolean > {
79+ if ( ! this . $platformService . isPlatformSupportedForOS ( this . $devicePlatformsConstants . Android , this . $projectData ) ) {
80+ this . $errors . fail ( "Applications for platform %s can not be built on this OS - %s" , this . $devicePlatformsConstants . Android , process . platform ) ;
81+ }
82+
7183 if ( this . $options . release && ( ! this . $options . keyStorePath || ! this . $options . keyStorePassword || ! this . $options . keyStoreAlias || ! this . $options . keyStoreAliasPassword ) ) {
7284 this . $errors . fail ( "When producing a release build, you need to specify all --key-store-* options." ) ;
7385 }
0 commit comments