@@ -7,33 +7,18 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
7
7
$projectData : IProjectData ,
8
8
$platformsData : IPlatformsData ,
9
9
protected $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
10
- $platformService : IPlatformService ,
10
+ protected $platformWorkflowDataFactory : IPlatformWorkflowDataFactory ,
11
+ private $platformWorkflowService : IPlatformWorkflowService ,
12
+ $platformValidationService : IPlatformValidationService ,
11
13
private $bundleValidatorHelper : IBundleValidatorHelper ,
12
14
protected $logger : ILogger ) {
13
- super ( $options , $platformsData , $platformService , $projectData ) ;
15
+ super ( $options , $platformsData , $platformValidationService , $projectData ) ;
14
16
this . $projectData . initializeProjectData ( ) ;
15
17
}
16
18
17
19
public async executeCore ( args : string [ ] ) : Promise < string > {
18
20
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
- } ;
35
21
36
- await this . $platformService . preparePlatform ( platformInfo ) ;
37
22
const buildConfig : IBuildConfig = {
38
23
buildForDevice : this . $options . forDevice ,
39
24
iCloudContainerEnvironment : this . $options . iCloudContainerEnvironment ,
@@ -50,19 +35,15 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
50
35
androidBundle : this . $options . aab
51
36
} ;
52
37
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 ) ;
60
41
61
42
return outputPath ;
62
43
}
63
44
64
45
protected validatePlatform ( platform : string ) : void {
65
- if ( ! this . $platformService . isPlatformSupportedForOS ( platform , this . $projectData ) ) {
46
+ if ( ! this . $platformValidationService . isPlatformSupportedForOS ( platform , this . $projectData ) ) {
66
47
this . $errors . fail ( `Applications for platform ${ platform } can not be built on this OS` ) ;
67
48
}
68
49
@@ -82,7 +63,7 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
82
63
return false ;
83
64
}
84
65
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 ) ;
86
67
return result ;
87
68
}
88
69
}
@@ -95,10 +76,12 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
95
76
$projectData : IProjectData ,
96
77
$platformsData : IPlatformsData ,
97
78
$devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
98
- $platformService : IPlatformService ,
79
+ $platformWorkflowDataFactory : IPlatformWorkflowDataFactory ,
80
+ $platformWorkflowService : IPlatformWorkflowService ,
81
+ $platformValidationService : IPlatformValidationService ,
99
82
$bundleValidatorHelper : IBundleValidatorHelper ,
100
83
$logger : ILogger ) {
101
- super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformService , $bundleValidatorHelper , $logger ) ;
84
+ super ( $options , $errors , $projectData , $platformsData , $devicePlatformsConstants , $platformWorkflowDataFactory , $platformWorkflowService , $platformValidationService , $bundleValidatorHelper , $logger ) ;
102
85
}
103
86
104
87
public async execute ( args : string [ ] ) : Promise < void > {
@@ -129,11 +112,13 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
129
112
$projectData : IProjectData ,
130
113
$platformsData : IPlatformsData ,
131
114
$devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
132
- $platformService : IPlatformService ,
115
+ $platformWorkflowDataFactory : IPlatformWorkflowDataFactory ,
116
+ $platformWorkflowService : IPlatformWorkflowService ,
117
+ $platformValidationService : IPlatformValidationService ,
133
118
$bundleValidatorHelper : IBundleValidatorHelper ,
134
119
protected $androidBundleValidatorHelper : IAndroidBundleValidatorHelper ,
135
120
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 ) ;
137
122
}
138
123
139
124
public async execute ( args : string [ ] ) : Promise < void > {
0 commit comments