@@ -2,6 +2,7 @@ export class BuildCommandBase {
22constructor ( protected $options : IOptions ,
33protected $projectData : IProjectData ,
44protected $platformsData : IPlatformsData ,
5+ protected $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
56protected $platformService : IPlatformService ) {
67this . $projectData . initializeProjectData ( ) ;
78}
@@ -35,17 +36,23 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
3536public allowedParameters : ICommandParameter [ ] = [ ] ;
3637
3738constructor ( 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
4447public async execute ( args : string [ ] ) : Promise < void > {
4548return this . executeCore ( [ this . $platformsData . availablePlatforms . iOS ] ) ;
4649}
4750
4851public 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+
4956return 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 {
5663public allowedParameters : ICommandParameter [ ] = [ ] ;
5764
5865constructor ( 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
6674public async execute ( args : string [ ] ) : Promise < void > {
6775return this . executeCore ( [ this . $platformsData . availablePlatforms . Android ] ) ;
6876}
6977
7078public 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+
7183if ( this . $options . release && ( ! this . $options . keyStorePath || ! this . $options . keyStorePassword || ! this . $options . keyStoreAlias || ! this . $options . keyStoreAliasPassword ) ) {
7284this . $errors . fail ( "When producing a release build, you need to specify all --key-store-* options." ) ;
7385}
0 commit comments