1+ import { BuildPlatformService } from "../services/platform/build-platform-service" ;
2+
13// import { LiveSyncEvents } from "../constants";
24
35export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
46 public static MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR = "0.17.0" ;
57
6- constructor ( private $platformService : IPlatformService ,
8+ constructor (
79 private $projectData : IProjectData ,
810 private $options : IOptions ,
911 private $bundleWorkflowService : IBundleWorkflowService ,
10- // private $liveSyncService: ILiveSyncService,
1112 private $iosDeviceOperations : IIOSDeviceOperations ,
1213 private $mobileHelper : Mobile . IMobileHelper ,
1314 private $devicesService : Mobile . IDevicesService ,
1415 private $platformsData : IPlatformsData ,
16+ private $buildPlatformService : BuildPlatformService ,
1517 private $analyticsService : IAnalyticsService ,
1618 private $bundleValidatorHelper : IBundleValidatorHelper ,
1719 private $errors : IErrors ,
1820 private $iOSSimulatorLogProvider : Mobile . IiOSSimulatorLogProvider ,
1921 private $logger : ILogger ,
20- private $cleanupService : ICleanupService ) {
21- }
22+ private $cleanupService : ICleanupService
23+ ) { }
2224
2325 public getPlatformsForOperation ( platform : string ) : string [ ] {
2426 const availablePlatforms = platform ? [ platform ] : _ . values < string > ( this . $platformsData . availablePlatforms ) ;
@@ -70,11 +72,6 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
7072 }
7173 }
7274
73- if ( this . $options . release ) {
74- await this . runInReleaseMode ( platform , additionalOptions ) ;
75- return ;
76- }
77-
7875 // Now let's take data for each device:
7976 const deviceDescriptors : ILiveSyncDeviceInfo [ ] = devices
8077 . map ( d => {
@@ -95,7 +92,7 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
9592
9693 const buildAction = additionalOptions && additionalOptions . buildPlatform ?
9794 additionalOptions . buildPlatform . bind ( additionalOptions . buildPlatform , d . deviceInfo . platform , buildConfig , this . $projectData ) :
98- this . $platformService . buildPlatform . bind ( this . $platformService , d . deviceInfo . platform , buildConfig , this . $projectData ) ;
95+ this . $buildPlatformService . buildPlatform . bind ( this . $buildPlatformService , d . deviceInfo . platform , buildConfig , this . $projectData ) ;
9996
10097 const outputPath = additionalOptions && additionalOptions . getOutputDirectory && additionalOptions . getOutputDirectory ( {
10198 platform : d . deviceInfo . platform ,
@@ -125,9 +122,16 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
125122 } ,
126123 timeout : this . $options . timeout ,
127124 useHotModuleReload : this . $options . hmr ,
128- force : this . $options . force
125+ force : this . $options . force ,
126+ emulator : this . $options . emulator
129127 } ;
130128
129+ // if (this.$options.release) {
130+ // liveSyncInfo.skipWatcher = true;
131+ // await this.$bundleWorkflowService.deployPlatform(this.$projectData.projectDir, deviceDescriptors, liveSyncInfo);
132+ // return;
133+ // }
134+
131135 await this . $bundleWorkflowService . runPlatform ( this . $projectData . projectDir , deviceDescriptors , liveSyncInfo ) ;
132136
133137 // const remainingDevicesToSync = devices.map(d => d.deviceInfo.identifier);
@@ -158,47 +162,6 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
158162
159163 return result ;
160164 }
161-
162- private async runInReleaseMode ( platform : string , additionalOptions ?: ILiveSyncCommandHelperAdditionalOptions ) : Promise < void > {
163- const runPlatformOptions : IRunPlatformOptions = {
164- device : this . $options . device ,
165- emulator : this . $options . emulator ,
166- justlaunch : this . $options . justlaunch
167- } ;
168-
169- const deployOptions = _ . merge < IDeployPlatformOptions , IYargArgv > ( ( < IDeployPlatformOptions > {
170- projectDir : this . $projectData . projectDir ,
171- clean : true
172- } ) , this . $options . argv ) ;
173-
174- const availablePlatforms = this . getPlatformsForOperation ( platform ) ;
175- for ( const currentPlatform of availablePlatforms ) {
176- const deployPlatformInfo : IDeployPlatformInfo = {
177- platform : currentPlatform ,
178- appFilesUpdaterOptions : {
179- bundle : ! ! this . $options . bundle ,
180- release : this . $options . release ,
181- useHotModuleReload : this . $options . hmr
182- } ,
183- deployOptions,
184- buildPlatform : this . $platformService . buildPlatform . bind ( this . $platformService ) ,
185- projectData : this . $projectData ,
186- config : < any > this . $options ,
187- env : this . $options . env
188- } ;
189-
190- await this . $platformService . deployPlatform ( deployPlatformInfo ) ;
191-
192- await this . $platformService . startApplication (
193- currentPlatform ,
194- runPlatformOptions ,
195- {
196- appId : this . $projectData . projectIdentifiers [ currentPlatform . toLowerCase ( ) ] ,
197- projectName : this . $projectData . projectName
198- }
199- ) ;
200- }
201- }
202165}
203166
204167$injector . register ( "liveSyncCommandHelper" , LiveSyncCommandHelper ) ;
0 commit comments