You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose enable/disable debugging when CLI is required as a library.
Includes:
* Unify `debug-livesync-service` and `livesync-service` into one class. Enable said class to attach a debugger at runtime during LiveSync
* Remove redundant `debugLivesync` property from `$config` and its every usage
* Remove redundant `debugStop` code in `android-debug-service`
* Raise events in the event of inability to start/stop the app on iOS
Copy file name to clipboardExpand all lines: PublicAPI.md
+98
Original file line number
Diff line number
Diff line change
@@ -552,6 +552,8 @@ After calling the method once, you can add new devices to the same LiveSync oper
552
552
553
553
> NOTE: In case a consecutive call to `liveSync` method requires change in the pattern for watching files (i.e. `liveSyncData.syncAllFiles` option has changed), current watch operation will be stopped and a new one will be started.
554
554
555
+
> NOTE: In case `debugggingEnabled` is set to `true` in a deviceDescriptor, debugging will initially be enabled for that device and a debugger will be attached after a successful livesync operation.
Enables debugging during a LiveSync operation. This method will try to attach a debugger to the application. Note that `userInteractionNeeded` event may be raised. Additional details about the arguments can be seen [here](https://github.com/NativeScript/nativescript-cli/blob/master/lib/definitions/livesync.d.ts).
630
+
631
+
* Definition
632
+
```TypeScript
633
+
/**
634
+
* Enables debugging for the specified devices
635
+
* @param{IEnableDebuggingDeviceOptions[]}deviceOpts Settings used for enabling debugging for each device.
636
+
* @param{IDebuggingAdditionalOptions}enableDebuggingOptions Settings used for enabling debugging.
637
+
* @returns{Promise<void>[]} Array of promises for each device.
Attaches a debugger to the specified device. Additional details about the argument can be seen [here](https://github.com/NativeScript/nativescript-cli/blob/master/lib/definitions/livesync.d.ts).
660
+
661
+
* Definition
662
+
```TypeScript
663
+
/**
664
+
* Attaches a debugger to the specified device.
665
+
* @param{IAttachDebuggerOptions}settings Settings used for controling the attaching process.
Disables debugging during a LiveSync operation. This method will try to detach a debugger from the application. Additional details about the arguments can be seen [here](https://github.com/NativeScript/nativescript-cli/blob/master/lib/definitions/livesync.d.ts).
681
+
682
+
* Definition
683
+
```TypeScript
684
+
/**
685
+
* Disables debugging for the specified devices
686
+
* @param{IDisableDebuggingDeviceOptions[]}deviceOptions Settings used for disabling debugging for each device.
687
+
* @param{IDebuggingAdditionalOptions}debuggingAdditionalOptions Settings used for disabling debugging.
688
+
* @returns{Promise<void>[]} Array of promises for each device.
Gives information for currently running LiveSync operation and parameters used to start it on each device.
628
716
@@ -741,6 +829,16 @@ tns.liveSyncService.on("notify", data => {
741
829
});
742
830
```
743
831
832
+
* userInteractionNeeded - raised whenever CLI needs to restart an application but cannot so the user has to restart it manually. The event is raised with an object, which can later be passed to `attachDebugger` method of `liveSyncService`:
CLI is designed as command line tool and when it is used as a library, it does not give you access to all of the methods. This is mainly implementation detail. Most of the CLI's code is created to work in command line, not as a library, so before adding method to public API, most probably it will require some modification.
746
844
For example the `$options` injected module contains information about all `--` options passed on the terminal. When the CLI is used as a library, the options are not populated. Before adding method to public API, make sure its implementation does not rely on `$options`.
$injector.require("usbLiveSyncService","./services/livesync/livesync-service");// The name is used in https://github.com/NativeScript/nativescript-dev-typescript
@@ -135,7 +137,6 @@ export class DebugIOSCommand implements ICommand {
135
137
private$injector: IInjector,
136
138
private$projectData: IProjectData,
137
139
private$platformsData: IPlatformsData,
138
-
private$iOSDebugService: IDebugService,
139
140
$iosDeviceOperations: IIOSDeviceOperations){
140
141
this.$projectData.initializeProjectData();
141
142
// Do not dispose ios-device-lib, so the process will remain alive and the debug application (NativeScript Inspector or Chrome DevTools) will be able to connect to the socket.
@@ -166,7 +167,7 @@ export class DebugAndroidCommand implements ICommand {
publicstaticUNABLE_TO_USE_FOR_DEVICE_AND_EMULATOR="The options --for-device and --emulator cannot be used simultaneously. Please use only one of them.";
94
96
publicstaticNO_DEVICES_EMULATORS_FOUND_FOR_OPTIONS="Unable to find device or emulator for specified options.";
97
+
publicstaticUNSUPPORTED_DEVICE_OS_FOR_DEBUGGING="Unsupported device OS for debugging";
0 commit comments