Skip to content

Commit 0db29f0

Browse files
tdusnokirtakacs
authored andcommitted
Automate debug server launch and tizen studio package installation (#19)
IoT.js-VSCode-DCO-1.0-Signed-off-by: Tibor Dusnoki [email protected]
1 parent 88d670b commit 0db29f0

File tree

7 files changed

+396
-36
lines changed

7 files changed

+396
-36
lines changed

README.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- [Features](#features)
99
- [Requirements](#requirements)
1010
- [How to use](#how-to-use)
11+
- [Tizen Studio](#tizen-studio)
1112
- [License](#license)
1213

1314
# Introduction
@@ -31,12 +32,12 @@
3132
- Exception hint
3233
- Handle source receive from the engine
3334
- Sending source code from the vscode to the engine
35+
- Automatic IoT.js debug server launch
3436

3537
- Language support
3638
- Available features:
3739
- Require module name completer
3840
- Module's function completer
39-
- Work in progress:
4041
- Hover information provider for IoT.js specific module functions
4142

4243

@@ -70,18 +71,20 @@ You have to open (or create a new) project folder where you have to define a `la
7071
These configuration options are required. Manifest:
7172
- `name`: The name which will be visible in the debug view
7273
- `type`: This must be `iotjs` otherwise the debug session wont start
73-
- `request`: Type of the session start, only the `attach` available for now
74+
- `request`: Type of the session start
7475
- `address`: IP address on which the server listening. Default is `localhost`
7576
- `port`: Debug port to attach to. Default is `5001`
7677
- `localRoot`: The local source root directoy, most cases this is the `${workspaceRoot}`
7778
- `stopOnEntry`: Autmoatically stop the program after launch, the IoT.js will stop on the first breakpoint for now, no matter that is enabled or not.
78-
- `debugLog`: The type of the debug log, you can choose from 0 to 5:
79+
- `debugLog`: The type of the debug log, you can choose from 0 to 4:
7980
- 0: none
8081
- 1: Error (show errors only)
8182
- 2: Debug Session related (requests and their responses)
8283
- 3: Debug Protocol related (communication between the engine and the client)
8384
- 4: Verbose (each log type included)
8485

86+
You can also define [Launch](#launch) instead of Attach to automate starting debug server.
87+
8588
Now you can connect to a running engine.
8689
If you are using IoT.js you have to do the following:
8790

@@ -133,6 +136,45 @@ $ ./build/bin/jerry --start-debug-server --debug-port {number} {file}
133136
# NOTE: This is not fully supported for now
134137
$ ./build/bin/jerry --start-debug-server --debugger-wait-source
135138
```
139+
# Launch
140+
Alternatively you can use LaunchRequest instead of AttachRequest for automatic debug server launch.
141+
In case of IoT.js Debug it looks like this:
142+
```json
143+
{
144+
"name": "IoT.js: Launch",
145+
"type": "iotjs",
146+
"request": "launch",
147+
"program": "iotjs",
148+
"address": "localhost",
149+
"port": 5001,
150+
"localRoot": "${workspaceRoot}",
151+
"stopOnEntry": false,
152+
"debugLog": 0,
153+
"args": [
154+
"--start-debug-server",
155+
"--debugger-wait-source"
156+
]
157+
}
158+
```
159+
160+
These configuration options are required. Manifest:
161+
- `name`: The name which will be visible in the debug view
162+
- `type`: This must be `iotjs` otherwise the debug session wont start
163+
- `request`: Type of the session start
164+
- `program`: Runtime executable for debug server. Default is iotjs. If you debug on desktop use
165+
absolute path to executable (e.g.:/path/to/iotjs/build/x86_64-linux/debug/bin/iotjs)
166+
- `address`: IP address on which the server listening. Default is `localhost`
167+
- `port`: Debug port to attach to. Default is `5001`
168+
- `localRoot`: The local source root directoy, most cases this is the `${workspaceRoot}`
169+
- `stopOnEntry`: Autmoatically stop the program after launch, the IoT.js will stop on the first breakpoint for now, no matter that is enabled or not.
170+
- `debugLog`: The type of the debug log, you can choose from 0 to 4:
171+
- 0: none
172+
- 1: Error (show errors only)
173+
- 2: Debug Session related (requests and their responses)
174+
- 3: Debug Protocol related (communication between the engine and the client)
175+
- 4: Verbose (each log type included)
176+
- `args`: Arguments for debug server. In case of IoT.js use --start-debug-server and --debugger-wait-source.
177+
136178

137179
After the engine is running you can start the debug session inside the extension host by pressing the `F5` key or click on the green triangle in the debug panel.
138180
If the client (VSCode extension) is connected then you have to see that file which is running inside the engine or if you started the engine in waiting mode you will get a prompt window where you can select that file what you want to running and then you can see where the execution is stopped. Now you can use the VSCode debug action bar to control the debug session.
@@ -151,6 +193,19 @@ If you want to use the development extension just like any other extension in yo
151193
# After this just reload the VSCode and the extension will be "installed"
152194
$ cp . ~/.vscode/extensions/ -r
153195
```
196+
# Tizen Studio
197+
Now you can use the extension to debug Tizen applications.
198+
Requirements:
199+
- The latest version of [Tizen Studio with CLI](https://developer.tizen.org/development/tizen-studio/download)
200+
201+
After installing Tizen Studio you can add the following lines of information to launch.json:
202+
```json
203+
{
204+
"tizenStudioPath": "/absolute/path/to/tizen-studio",
205+
"IoTjsPath": "/absolute/path/to/iotjs"
206+
}
207+
```
208+
This enables the extension to install required packages for Tizen Studio to be able to create IoTjsApp native project. The installation may take several minutes.
154209

155210
# License
156211
IoT.js VSCode extension is Open Source software under the [Apache 2.0 license](LICENSE). Complete license and copyright information can be found within the code.

package.json

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
],
5252
"scripts": {
5353
"vscode:prepublish": "npm run compile",
54-
"copy": "cp ./src/IotjsFunctions.json ./out/",
54+
"copy": "cp ./src/IotjsFunctions.json ./tools/setup.sh ./tools/InstallTizenApp.sh ./out/",
5555
"compile": "tsc -p ./ && npm run copy",
5656
"watch": "tsc -watch -p ./",
5757
"postinstall": "node ./node_modules/vscode/bin/install",
@@ -71,6 +71,7 @@
7171
},
7272
"dependencies": {
7373
"babel-preset-env": "^1.6.1",
74+
"node-ssh": "^5.1.2",
7475
"vscode-debugadapter": "^1.29.0",
7576
"vscode-debugprotocol": "^1.29.0",
7677
"ws": "^5.1.1"
@@ -136,6 +137,89 @@
136137
"type": "number",
137138
"description": "Set log level for the debugger: 0 none, 1 error, 2 session, 3 protocol, 4 verbose",
138139
"default": 0
140+
},
141+
"tizenStudioPath": {
142+
"type": [
143+
"string",
144+
"null"
145+
],
146+
"description": "Absolute path to Tizen Studio.",
147+
"default": null
148+
},
149+
"IoTjsPath": {
150+
"type": [
151+
"string",
152+
"null"
153+
],
154+
"description": "Absolute path to IoTjs.",
155+
"default": null
156+
}
157+
}
158+
},
159+
"launch": {
160+
"required": [],
161+
"properties": {
162+
"program": {
163+
"type": "string",
164+
"description": "Absolute path to the program.",
165+
"default": "iotjs"
166+
},
167+
"stopOnEntry": {
168+
"type": "boolean",
169+
"description": "Automatically stop program after launch.",
170+
"default": false
171+
},
172+
"args": {
173+
"type": "array",
174+
"description": "Command line arguments passed to the program.",
175+
"items": {
176+
"type": "string"
177+
},
178+
"default": []
179+
},
180+
"localRoot": {
181+
"type": "string",
182+
"description": "Absolute path to the working directory of the program being debugged. Default is the current workspace.",
183+
"default": "${workspaceRoot}"
184+
},
185+
"debugLog": {
186+
"type": "number",
187+
"description": "Set log level for the debugger: 0 none, 1 error, 2 session, 3 protocol, 4 verbose",
188+
"default": 0
189+
},
190+
"env": {
191+
"type": "object",
192+
"additionalProperties": {
193+
"type": "string"
194+
},
195+
"description": "Environment variables passed to the program.",
196+
"default": {}
197+
},
198+
"address": {
199+
"type": "string",
200+
"description": "IP address on which the server listening. Default is 'localhost'.",
201+
"default": "localhost"
202+
},
203+
"port": {
204+
"type": "number",
205+
"description": "Debug port.",
206+
"default": 5001
207+
},
208+
"tizenStudioPath": {
209+
"type": [
210+
"string",
211+
"null"
212+
],
213+
"description": "Absolute path to Tizen Studio.",
214+
"default": null
215+
},
216+
"IoTjsPath": {
217+
"type": [
218+
"string",
219+
"null"
220+
],
221+
"description": "Absolute path to IoTjs.",
222+
"default": null
139223
}
140224
}
141225
}
@@ -151,9 +235,31 @@
151235
"address": "localhost",
152236
"port": 5001,
153237
"localRoot": "${workspaceRoot}",
238+
"tizenStudioPath": "",
154239
"stopOnEntry": false,
155240
"debugLog": 0
156241
}
242+
},
243+
{
244+
"label": "IoT.js: Launch",
245+
"description": "Launch IoT.js or JerryScript automatically.",
246+
"body": {
247+
"name": "IoT.js: Launch",
248+
"type": "iotjs",
249+
"request": "launch",
250+
"program": "iotjs",
251+
"stopOnEntry": false,
252+
"localRoot": "${workspaceRoot}",
253+
"tizenStudioPath": "",
254+
"IoTjsPath": "",
255+
"port": 5001,
256+
"address": "localhost",
257+
"debugLog": 0,
258+
"args": [
259+
"--start-debug-server",
260+
"--debugger-wait-source"
261+
]
262+
}
157263
}
158264
]
159265
}

0 commit comments

Comments
 (0)