77 private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
88 private $config : IConfiguration ,
99 private $usbLiveSyncService : ILiveSyncService ,
10+ private $platformService : IPlatformService ,
1011 protected $options : IOptions ) { }
1112
1213 execute ( args : string [ ] ) : IFuture < void > {
13-
14- if ( this . $options . watch ) {
15- this . $options . rebuild = false ;
14+ if ( this . $options . start ) {
15+ return this . debugService . debug ( ) ;
1616 }
1717
18- if ( ! this . $options . rebuild && ! this . $options . start ) {
19- this . $config . debugLivesync = true ;
20- let applicationReloadAction = ( deviceAppData : Mobile . IDeviceAppData , localToDevicePaths : Mobile . ILocalToDevicePathData [ ] ) : IFuture < void > => {
21- return ( ( ) => {
22- let projectData : IProjectData = this . $injector . resolve ( "projectData" ) ;
23-
24- this . debugService . debugStop ( ) . wait ( ) ;
18+ this . $platformService . deployPlatform ( this . $devicesService . platform ) . wait ( ) ;
19+ this . $config . debugLivesync = true ;
20+ let applicationReloadAction = ( deviceAppData : Mobile . IDeviceAppData ) : IFuture < void > => {
21+ return ( ( ) => {
22+ let projectData : IProjectData = this . $injector . resolve ( "projectData" ) ;
2523
26- let applicationId = deviceAppData . appIdentifier ;
27- if ( deviceAppData . device . isEmulator && deviceAppData . platform . toLowerCase ( ) === this . $devicePlatformsConstants . iOS . toLowerCase ( ) ) {
28- applicationId = projectData . projectName ;
29- }
30- deviceAppData . device . applicationManager . stopApplication ( applicationId ) . wait ( ) ;
24+ this . debugService . debugStop ( ) . wait ( ) ;
3125
32- this . debugService . debug ( ) . wait ( ) ;
33- } ) . future < void > ( ) ( ) ;
34- } ;
26+ let applicationId = deviceAppData . appIdentifier ;
27+ if ( deviceAppData . device . isEmulator && deviceAppData . platform . toLowerCase ( ) === this . $devicePlatformsConstants . iOS . toLowerCase ( ) ) {
28+ applicationId = projectData . projectName ;
29+ }
30+ deviceAppData . device . applicationManager . stopApplication ( applicationId ) . wait ( ) ;
3531
36- return this . $usbLiveSyncService . liveSync ( this . $devicesService . platform , applicationReloadAction ) ;
37- }
38- return this . debugService . debug ( ) ;
32+ this . debugService . debug ( ) . wait ( ) ;
33+ } ) . future < void > ( ) ( ) ;
34+ } ;
35+ return this . $usbLiveSyncService . liveSync ( this . $devicesService . platform , applicationReloadAction ) ;
3936 }
4037
4138 allowedParameters : ICommandParameter [ ] = [ ] ;
@@ -69,8 +66,9 @@ export class DebugIOSCommand extends DebugPlatformCommand {
6966 $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
7067 $config : IConfiguration ,
7168 $usbLiveSyncService : ILiveSyncService ,
69+ $platformService : IPlatformService ,
7270 $options : IOptions ) {
73- super ( $iOSDebugService , $devicesService , $injector , $logger , $childProcess , $devicePlatformsConstants , $config , $usbLiveSyncService , $options ) ;
71+ super ( $iOSDebugService , $devicesService , $injector , $logger , $childProcess , $devicePlatformsConstants , $config , $usbLiveSyncService , $platformService , $ options) ;
7472 }
7573}
7674$injector . registerCommand ( "debug|ios" , DebugIOSCommand ) ;
@@ -84,8 +82,9 @@ export class DebugAndroidCommand extends DebugPlatformCommand {
8482 $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
8583 $config : IConfiguration ,
8684 $usbLiveSyncService : ILiveSyncService ,
85+ $platformService : IPlatformService ,
8786 $options : IOptions ) {
88- super ( $androidDebugService , $devicesService , $injector , $logger , $childProcess , $devicePlatformsConstants , $config , $usbLiveSyncService , $options ) ;
87+ super ( $androidDebugService , $devicesService , $injector , $logger , $childProcess , $devicePlatformsConstants , $config , $usbLiveSyncService , $platformService , $ options) ;
8988 }
9089}
9190$injector . registerCommand ( "debug|android" , DebugAndroidCommand ) ;
0 commit comments