Skip to content

Make debug-ios default to Chrome DevTools #3200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/man_pages/project/testing/debug-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ While debugging, prints the output from the application in the console and watch
* `--timeout` - Sets the number of seconds that NativeScript CLI will wait for the simulator/device to boot. If not set, the default timeout is 90 seconds.
* `--no-watch` - If set, changes in your code will not be reflected during the execution of this command.
* `--clean` - If set, forces rebuilding the native application.
* `--chrome` - Allows debugging in Chrome Developer Tools. If set Safari Web Inspector is not started and debugging is attached to Chrome Developer Tools.
* `--chrome` - Deprecated - default behavior uses '--chrome' implicitly. Allows debugging in Chrome Developer Tools. If set, Safari Web Inspector is not started and debugging is attached to Chrome Developer Tools.
* `--inspector` - If set, the developer tools in the Safari Web Inspector are used for debugging the application.

### Attributes
* `<Device ID>` is the device identifier of the target device as listed by `$ tns device ios`
Expand Down
1 change: 1 addition & 0 deletions lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ interface IOptions extends ICommonOptions, IBundle, IPlatformTemplate, IEmulator
syncAllFiles: boolean;
liveEdit: boolean;
chrome: boolean;
inspector: boolean; // the counterpart to --chrome
}

interface IEnvOptions {
Expand Down
5 changes: 5 additions & 0 deletions lib/definitions/debug.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ interface IDebugOptions {
* Default value is 02e6bde1bbe34e43b309d4ef774b1168d25fd024 which corresponds to 55.0.2883 Chrome version
*/
devToolsCommit?: string;

/**
* Defines if the iOS App Inspector should be used instead of providing URL to debug the application with Chrome DevTools
*/
inspector?: boolean;
}

/**
Expand Down
13 changes: 8 additions & 5 deletions lib/services/ios-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,17 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
}

private async wireDebuggerClient(debugData: IDebugData, debugOptions: IDebugOptions, device?: Mobile.IiOSDevice): Promise<string> {
if (debugOptions.chrome || !this.$hostInfo.isDarwin) {
this._socketProxy = await this.$socketProxyFactory.createWebSocketProxy(this.getSocketFactory(device));

return this.getChromeDebugUrl(debugOptions, this._socketProxy.options.port);
} else {
if (debugOptions.inspector && this.$hostInfo.isDarwin) {
this._socketProxy = await this.$socketProxyFactory.createTCPSocketProxy(this.getSocketFactory(device));
await this.openAppInspector(this._socketProxy.address(), debugData, debugOptions);
return null;
} else {
if (debugOptions.chrome) {
this.$logger.info("'--chrome' is the default behavior. Use --inspector to debug iOS applications using the Safari Web Inspector.");
}

this._socketProxy = await this.$socketProxyFactory.createWebSocketProxy(this.getSocketFactory(device));
return this.getChromeDebugUrl(debugOptions, this._socketProxy.options.port);
}
}

Expand Down