Skip to content
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
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ Note: You might need to run the Android Studio from the command line in order to

## How to Build

* Install dependencies from NPM:

```Shell
cd test-app/build-tools/jsparser
npm install
```

* Set environment variables:
- `JAVA_HOME` such that `$JAVA_HOME/bin/java` points to your Java executable
- `ANDROID_HOME` pointing to where you have installed the Android SDK
- `ANDROID_NDK_HOME` pointing to the version of the Android NDK needed for this version of NativeScript

* Run command

Windows:
Expand Down Expand Up @@ -87,8 +99,27 @@ Note: You might need to run the Android Studio from the command line in order to
``Note: Keep in mind the device or emulator needs to have an sdcard mounted.``
* Run command
```Shell
gradlew runtest
gradlew runtests
```

## How to Connect the Inspector

* Install dependencies: run command
```Shell
cd test-app
npm install
```
* Run the test app in Android Studio, or manually in the emulator.
* Run command
```Shell
npx ns debug android --start
```
(If you instead have the `nativescript` NPM module installed globally,
you can omit the `npm install` and the `npx` prefix.)
* This will print out a URL, such as
`devtools://devtools/bundled/inspector.html?ws=localhost:40000`.
Open this URL in Chrome or Chromium.

## Contribute
We love PRs! Check out the [contributing guidelines](CONTRIBUTING.md). If you want to contribute, but you are not sure where to start - look for [issues labeled `help wanted`](https://github.com/NativeScript/android-runtime/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).

Expand Down
6 changes: 3 additions & 3 deletions docs/extending-inspector.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This step involves fetching and building the V8 projectory, explanation for whic

> Note: When passing arguments to gn to have a project generate, make sure to include the inspector sources. For an overview of all available gn arguments run `gn args project-dir --list`

1. Modify `v8/src/inspector/js_protocol.json` to only contain the domains that will be used in the runtime project. The right way to go about this is to copy-paste the `js_protocol` from the runtime project, and add on top of it. For a complete list of all protocol domains supported by the Chrome browser refer to [browser_protocol.json](https://chromium.googlesource.com/chromium/src/+log/master/third_party/WebKit/Source/core/inspector/browser_protocol.json) in the Chromium project. Example browser_protocol.json file can be found [here](https://chromedevtools.github.io/devtools-protocol/tot/).
1. Modify `v8/include/js_protocol.pdl` to only contain the domains that will be used in the runtime project. The right way to go about this is to copy-paste the `js_protocol` from the runtime project, and add on top of it. For a complete list of all protocol domains supported by the Chrome browser refer to [browser_protocol.json](https://chromium.googlesource.com/chromium/src/+log/master/third_party/WebKit/Source/core/inspector/browser_protocol.json) in the Chromium project. Example browser_protocol.json file can be found [here](https://chromedevtools.github.io/devtools-protocol/tot/).
2. Modify `v8/src/inspector/inspector_protocol_config.json` and include the names for the additional protocol domain definitions that would need to be generated.
```json
{
Expand Down Expand Up @@ -47,9 +47,9 @@ This step involves fetching and building the V8 projectory, explanation for whic
```
3. Figure out which parts of the big `js_inspector.json` protocol you will want to keep for the inspector implementation. It is likely that a lot of it will be browser-specific, so you don't need to spend extra time doing stub implementations for methods and events the application will not be making notifications for.

4. Run the ninja build. Upon completion, the inspector protocol files would be at `project-dir/arch.release/gen/src/inspector/protocol`.
4. Run the ninja build. Upon completion, the inspector protocol files would be at `outgn/$ARCH-release/gen/src/inspector/protocol`.

5. Copy-Paste all `.cpp` and `.h` files in the runtime project at `runtime/src/main/cpp/v8_inspector/src/inspector/protocol`
5. Copy-Paste all `.cpp` and `.h` files in the runtime project at `test-app/runtime/src/main/cpp/v8_inspector/src/inspector/protocol`

6. Create a new C++ class extending the desired Domain (e.g. DOM). Name it according to the convention already established by the V8 team - `v8-<domain>-agent-impl.h/cpp` - See [v8-dom-agent-impl.h](https://github.com/NativeScript/android-runtime/blob/5a04e09439e2bc6a201577895b9ac6538441e758/test-app/runtime/src/main/cpp/v8_inspector/src/inspector/v8-dom-agent-impl.h#L18). Implement the Backend::<Domain>'s methods in the `.cpp` file.

Expand Down
Loading