@@ -7,8 +7,7 @@ export class BuildCommandBase {
77 protected $platformsData : IPlatformsData ,
88 protected $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
99 protected $platformService : IPlatformService ,
10- private $bundleValidatorHelper : IBundleValidatorHelper ,
11- private $platformEnvironmentRequirements : IPlatformEnvironmentRequirements ) {
10+ private $bundleValidatorHelper : IBundleValidatorHelper ) {
1211 this . $projectData . initializeProjectData ( ) ;
1312 }
1413
@@ -45,18 +44,16 @@ export class BuildCommandBase {
4544 }
4645 }
4746
48- protected async canExecuteCore ( platform : string ) : Promise < boolean > {
49- const result = await this . $platformEnvironmentRequirements . checkEnvironmentRequirements ( { platform : platform , cloudCommandName : "build" } ) ;
50- this . validatePlatform ( platform ) ;
51- return result ;
52- }
53-
54- private validatePlatform ( platform : string ) : void {
47+ protected async validatePlatform ( platform : string ) : Promise < void > {
5548 if ( ! this . $platformService . isPlatformSupportedForOS ( platform , this . $projectData ) ) {
5649 this . $errors . fail ( `Applications for platform ${ platform } can not be built on this OS` ) ;
5750 }
5851
5952 this . $bundleValidatorHelper . validate ( ) ;
53+
54+ const platformData = this . $platformsData . getPlatformData ( platform , this . $projectData ) ;
55+ const platformProjectService = platformData . platformProjectService ;
56+ await platformProjectService . validate ( this . $projectData ) ;
6057 }
6158}
6259
@@ -69,17 +66,17 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
6966 $platformsData : IPlatformsData ,
7067 $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
7168 $platformService : IPlatformService ,
72- $bundleValidatorHelper : IBundleValidatorHelper ,
73- $platformEnvironmentRequirements : IPlatformEnvironmentRequirements ) {
74- super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformService , $bundleValidatorHelper , $platformEnvironmentRequirements ) ;
69+ $bundleValidatorHelper : IBundleValidatorHelper ) {
70+ super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformService , $bundleValidatorHelper ) ;
7571 }
7672
7773 public async execute ( args : string [ ] ) : Promise < void > {
7874 return this . executeCore ( [ this . $platformsData . availablePlatforms . iOS ] ) ;
7975 }
8076
8177 public async canExecute ( args : string [ ] ) : Promise < boolean > {
82- return await super . canExecuteCore ( this . $devicePlatformsConstants . iOS ) && args . length === 0 && this . $platformService . validateOptions ( this . $options . provision , this . $options . teamId , this . $projectData , this . $platformsData . availablePlatforms . iOS ) ;
78+ await super . validatePlatform ( this . $devicePlatformsConstants . iOS ) ;
79+ return args . length === 0 && this . $platformService . validateOptions ( this . $options . provision , this . $options . teamId , this . $projectData , this . $platformsData . availablePlatforms . iOS ) ;
8380 }
8481}
8582
@@ -94,26 +91,20 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
9491 $platformsData : IPlatformsData ,
9592 $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
9693 $platformService : IPlatformService ,
97- $bundleValidatorHelper : IBundleValidatorHelper ,
98- $platformEnvironmentRequirements : IPlatformEnvironmentRequirements ) {
99- super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformService , $bundleValidatorHelper , $platformEnvironmentRequirements ) ;
94+ $bundleValidatorHelper : IBundleValidatorHelper ) {
95+ super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformService , $bundleValidatorHelper ) ;
10096 }
10197
10298 public async execute ( args : string [ ] ) : Promise < void > {
10399 return this . executeCore ( [ this . $platformsData . availablePlatforms . Android ] ) ;
104100 }
105101
106102 public async canExecute ( args : string [ ] ) : Promise < boolean > {
107- await super . canExecuteCore ( this . $devicePlatformsConstants . Android ) ;
108-
103+ await super . validatePlatform ( this . $devicePlatformsConstants . Android ) ;
109104 if ( this . $options . release && ( ! this . $options . keyStorePath || ! this . $options . keyStorePassword || ! this . $options . keyStoreAlias || ! this . $options . keyStoreAliasPassword ) ) {
110105 this . $errors . fail ( ANDROID_RELEASE_BUILD_ERROR_MESSAGE ) ;
111106 }
112107
113- const platformData = this . $platformsData . getPlatformData ( this . $devicePlatformsConstants . Android , this . $projectData ) ;
114- const platformProjectService = platformData . platformProjectService ;
115- await platformProjectService . validate ( this . $projectData ) ;
116-
117108 return args . length === 0 && await this . $platformService . validateOptions ( this . $options . provision , this . $options . teamId , this . $projectData , this . $platformsData . availablePlatforms . Android ) ;
118109 }
119110}
0 commit comments