@@ -7,33 +7,18 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
77 $projectData : IProjectData ,
88 $platformsData : IPlatformsData ,
99 protected $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
10- $platformService : IPlatformService ,
10+ protected $platformWorkflowDataFactory : IPlatformWorkflowDataFactory ,
11+ private $platformWorkflowService : IPlatformWorkflowService ,
12+ $platformValidationService : IPlatformValidationService ,
1113 private $bundleValidatorHelper : IBundleValidatorHelper ,
1214 protected $logger : ILogger ) {
13- super ( $options , $platformsData , $platformService , $projectData ) ;
15+ super ( $options , $platformsData , $platformValidationService , $projectData ) ;
1416 this . $projectData . initializeProjectData ( ) ;
1517 }
1618
1719 public async executeCore ( args : string [ ] ) : Promise < string > {
1820 const platform = args [ 0 ] . toLowerCase ( ) ;
19- const appFilesUpdaterOptions : IAppFilesUpdaterOptions = {
20- bundle : ! ! this . $options . bundle ,
21- release : this . $options . release ,
22- useHotModuleReload : this . $options . hmr
23- } ;
24- const platformInfo : IPreparePlatformInfo = {
25- platform,
26- appFilesUpdaterOptions,
27- projectData : this . $projectData ,
28- config : this . $options ,
29- env : this . $options . env ,
30- webpackCompilerConfig : {
31- watch : false ,
32- env : this . $options . env
33- }
34- } ;
3521
36- await this . $platformService . preparePlatform ( platformInfo ) ;
3722 const buildConfig : IBuildConfig = {
3823 buildForDevice : this . $options . forDevice ,
3924 iCloudContainerEnvironment : this . $options . iCloudContainerEnvironment ,
@@ -50,19 +35,15 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
5035 androidBundle : this . $options . aab
5136 } ;
5237
53- const outputPath = await this . $platformService . buildPlatform ( platform , buildConfig , this . $projectData ) ;
54-
55- if ( this . $options . copyTo ) {
56- this . $platformService . copyLastOutput ( platform , this . $options . copyTo , buildConfig , this . $projectData ) ;
57- } else {
58- this . $logger . info ( `The build result is located at: ${ outputPath } ` ) ;
59- }
38+ const platformData = this . $platformsData . getPlatformData ( platform , this . $projectData ) ;
39+ const workflowData = this . $platformWorkflowDataFactory . createPlatformWorkflowData ( platform , this . $options ) ;
40+ const outputPath = await this . $platformWorkflowService . buildPlatform ( platformData , this . $projectData , workflowData , buildConfig ) ;
6041
6142 return outputPath ;
6243 }
6344
6445 protected validatePlatform ( platform : string ) : void {
65- if ( ! this . $platformService . isPlatformSupportedForOS ( platform , this . $projectData ) ) {
46+ if ( ! this . $platformValidationService . isPlatformSupportedForOS ( platform , this . $projectData ) ) {
6647 this . $errors . fail ( `Applications for platform ${ platform } can not be built on this OS` ) ;
6748 }
6849
@@ -82,7 +63,7 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
8263 return false ;
8364 }
8465
85- const result = await this . $platformService . validateOptions ( this . $options . provision , this . $options . teamId , this . $projectData , platform ) ;
66+ const result = await this . $platformValidationService . validateOptions ( this . $options . provision , this . $options . teamId , this . $projectData , platform ) ;
8667 return result ;
8768 }
8869}
@@ -95,10 +76,12 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
9576 $projectData : IProjectData ,
9677 $platformsData : IPlatformsData ,
9778 $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
98- $platformService : IPlatformService ,
79+ $platformWorkflowDataFactory : IPlatformWorkflowDataFactory ,
80+ $platformWorkflowService : IPlatformWorkflowService ,
81+ $platformValidationService : IPlatformValidationService ,
9982 $bundleValidatorHelper : IBundleValidatorHelper ,
10083 $logger : ILogger ) {
101- super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformService , $bundleValidatorHelper , $logger ) ;
84+ super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformWorkflowDataFactory , $platformWorkflowService , $platformValidationService , $bundleValidatorHelper , $logger ) ;
10285 }
10386
10487 public async execute ( args : string [ ] ) : Promise < void > {
@@ -129,11 +112,13 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
129112 $projectData : IProjectData ,
130113 $platformsData : IPlatformsData ,
131114 $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
132- $platformService : IPlatformService ,
115+ $platformWorkflowDataFactory : IPlatformWorkflowDataFactory ,
116+ $platformWorkflowService : IPlatformWorkflowService ,
117+ $platformValidationService : IPlatformValidationService ,
133118 $bundleValidatorHelper : IBundleValidatorHelper ,
134119 protected $androidBundleValidatorHelper : IAndroidBundleValidatorHelper ,
135120 protected $logger : ILogger ) {
136- super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformService , $bundleValidatorHelper , $logger ) ;
121+ super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformWorkflowDataFactory , $platformWorkflowService , $platformValidationService , $bundleValidatorHelper , $logger ) ;
137122 }
138123
139124 public async execute ( args : string [ ] ) : Promise < void > {
0 commit comments