Skip to content

Commit 920a4fc

Browse files
author
Akos Kitta
committed
fix(doc): review remarks
- fixed: added missing build step - fixed: reordered sections: Windows tool must come before build part - added: prerequisites link to Theia and link to recommended tool: Code - added: how to clone repo and change dir to repo root - added: section how to start code + link to further docs Signed-off-by: Akos Kitta <[email protected]>
1 parent 7ead2d9 commit 920a4fc

File tree

1 file changed

+92
-60
lines changed

1 file changed

+92
-60
lines changed

Diff for: docs/development.md

+92-60
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ This page includes technical documentation for developers who want to build the
55
## Architecture overview
66

77
The IDE consists of three major parts:
8-
- the _Electron main_ process,
9-
- the _backend_, and
10-
- the _frontend_.
8+
9+
- the _Electron main_ process,
10+
- the _backend_, and
11+
- the _frontend_.
1112

1213
The _Electron main_ process is responsible for:
13-
- creating the application,
14-
- managing the application lifecycle via listeners, and
15-
- creating and managing the web pages for the app.
14+
15+
- creating the application,
16+
- managing the application lifecycle via listeners, and
17+
- creating and managing the web pages for the app.
1618

1719
In Electron, the process that runs the main entry JavaScript file is called the main process. The _Electron main_ process can display a GUI by creating web pages. An Electron app always has exactly one main process.
1820

@@ -21,13 +23,14 @@ By default, whenever the _Electron main_ process creates a web page, it will ins
2123
In normal browsers, web pages usually run in a sandboxed environment, and accessing native resources are disallowed. However, Electron has the power to use Node.js APIs in the web pages allowing lower-level OS interactions. Due to security reasons, accessing native resources is an undesired behavior in the IDE. So by convention, we do not use Node.js APIs. (Note: the Node.js integration is [not yet disabled](https://github.com/eclipse-theia/theia/issues/2018) although it is not used). In the IDE, only the _backend_ allows OS interaction.
2224

2325
The _backend_ process is responsible for:
24-
- providing access to the filesystem,
25-
- communicating with the [Arduino CLI](https://github.com/arduino/arduino-cli) via gRPC,
26-
- running your terminal,
27-
- exposing additional RESTful APIs,
28-
- performing the Git commands in the local repositories,
29-
- hosting and running any VS Code extensions, or
30-
- executing VS Code tasks<sup>[[2]]</sup>.
26+
27+
- providing access to the filesystem,
28+
- communicating with the [Arduino CLI](https://github.com/arduino/arduino-cli) via gRPC,
29+
- running your terminal,
30+
- exposing additional RESTful APIs,
31+
- performing the Git commands in the local repositories,
32+
- hosting and running any VS Code extensions, or
33+
- executing VS Code tasks<sup>[[2]]</sup>.
3134

3235
The _Electron main_ process spawns the _backend_ process. There is always exactly one _backend_ process. However, due to performance considerations, the _backend_ spawns several sub-processes for the filesystem watching, Git repository discovery, etc. The communication between the _backend_ process and its sub-processes is established via IPC. Besides spawning sub-processes, the _backend_ will start an HTTP server on a random available port, and serves the web application as static content. When the sub-processes are up and running, and the HTTP server is also listening, the _backend_ process sends the HTTP server port to the _Electron main_ process via IPC. The _Electron main_ process will load the _backend_'s endpoint in the `BrowserWindow`.
3336

@@ -43,6 +46,11 @@ This repository contains the main code, but two more repositories are included d
4346
- [vscode-arduino-tools](https://github.com/arduino/vscode-arduino-tools): provides support for the language server and the debugger
4447
- [arduino-language-server](https://github.com/arduino/arduino-language-server): provides the language server that parses Arduino code
4548

49+
## Prerequisites
50+
51+
- To build the application, follow the Theia IDE [prerequisites](https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisites).
52+
- This project recommends using [Visual Studio Code (VS Code)](https://code.visualstudio.com/) for the development.
53+
4654
## Build from source
4755

4856
---
@@ -61,56 +69,57 @@ Once you have all the tools installed, you can build the editor following these
6169

6270
If you want to develop the application, do the following:
6371

64-
1. Install the dependencies
72+
1. Clone the project from Git and change directory to the `arduino-ide` folder:
73+
74+
```sh
75+
git clone https://github.com/arduino/arduino-ide.git
76+
```
77+
78+
```sh
79+
cd arduino-ide
80+
```
81+
82+
2. Install the dependencies
6583

6684
```sh
6785
yarn
6886
```
6987

70-
2. Rebuild the native dependencies for electron
88+
3. Build the application in development mode
89+
90+
```sh
91+
yarn build:dev
92+
```
93+
94+
4. Open the project in VS Code
95+
96+
```sh
97+
code .
98+
```
99+
100+
> **** For more details on how to start VS Code form the command line, see [here](https://code.visualstudio.com/docs/editor/command-line#_launching-from-command-line).
101+
102+
5. Rebuild the native dependencies for electron
71103

72104
- <kbd>Ctrl/⌘</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> to open the _Command Palette_.
73105
- Type `Tasks: Run Task` and press <kbd>Enter</kbd>.
74106
- Type `Rebuild App` and press <kbd>Enter</kbd>.
75107
- Wait for the "Rebuild App" task to finish, as indicated by a "✔ Rebuild Complete" message in the Terminal.
76108

77-
3. Start the TypeScript compiler + `webpack` in watch mode
109+
6. Start the TypeScript compiler + `webpack` in watch mode
78110

79111
- <kbd>Ctrl/⌘</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>.
80112
- Type `Tasks: Run Task` and press <kbd>Enter</kbd>.
81113
- Type `Watch All` and press <kbd>Enter</kbd>.
82114
- Select how you want to scan the task output. You can press <kbd>Enter</kbd> or <kbd>Esc</kbd>. [Click](https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher) here to learn more.
83115

84-
4. Start the application in debug mode
116+
7. Start the application in debug mode
85117
- Open the _Run and Debug_ view with <kbd>Ctrl/⌘</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>,
86118
- Select `App` from the dropdown,
87119
- Start debugging with <kbd>F5</kbd>.
88120

89121
If you change the backend application, you must restart the electron app in debug mode to use the changes.
90-
If you change the frontend application, it's sufficient to reload the board window with _Reload Windows_ command from the _Command Palette_.
91-
92-
## Running Checks
93-
94-
To run the tests, you must rebuild the native dependencies for the browser target. See [this](https://github.com/arduino/arduino-ide/pull/1823#issuecomment-1400511031) for the technical explanation.
95-
96-
1. Rebuild the native dependencies for the browser
97-
98-
```sh
99-
yarn rebuild:browser
100-
```
101-
102-
2. To run the tests
103-
104-
```sh
105-
yarn test
106-
```
107-
108-
3. To run the slow tests
109-
```sh
110-
yarn test:slow
111-
```
112-
113-
If you want to debug an individual file, open the test module (`*.test.ts` or `*.slow-test.ts`), open the _Run and Debug_ view, select the `Run Test [current]` and press <kbd>F5</kbd>.
122+
If you change the frontend application, it's sufficient to reload the board window with _Reload Window_ command from the _Command Palette_.
114123

115124
### Bundle the Application
116125

@@ -133,40 +142,63 @@ If you want to bundle the application, execute the followings:
133142
yarn --cwd electron-app package
134143
```
135144

136-
137145
### Notes for Windows contributors
146+
138147
Windows requires the Microsoft Visual C++ (MSVC) compiler toolset to be installed on your development machine.
139148

140149
In case it's not already present, it can be downloaded from the "**Tools for Visual Studio 20XX**" section of the Visual Studio [downloads page](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) via the "**Build Tools for Visual Studio 20XX**" (e.g., "**Build Tools for Visual Studio 2022**") download link.
141150

142151
Select "**Desktop development with C++**" from the "**Workloads**" tab during the installation procedure.
143152

144-
### CI
153+
## Running Checks
145154

146-
This project is built on [GitHub Actions](https://github.com/arduino/arduino-ide/actions).
155+
To run the tests, you must rebuild the native dependencies for the browser target. See [this](https://github.com/arduino/arduino-ide/pull/1823#issuecomment-1400511031) for the technical explanation.
156+
157+
1. Rebuild the native dependencies for the browser
147158

148-
- _Snapshot_ builds run when changes are pushed to the `main` branch, or when a PR is created against the `main` branch. For the sake of the review and verification process, the build artifacts for each operating system can be downloaded from the GitHub Actions page.
149-
- _Nightly_ builds run every day at 03:00 GMT from the `main` branch.
150-
- _Release_ builds run when a new tag is pushed to the remote. The tag must follow the [semver](https://semver.org/). For instance, `1.2.3` is a correct tag, but `v2.3.4` won't work. Steps to trigger a new release build:
151-
- Create a local tag:
152-
```sh
153-
git tag -a 1.2.3 -m "Creating a new tag for the `1.2.3` release."
154-
```
155-
- Push it to the remote:
156159
```sh
157-
git push origin 1.2.3
160+
yarn rebuild:browser
158161
```
159162

163+
2. To run the tests
164+
165+
```sh
166+
yarn test
167+
```
168+
169+
3. To run the slow tests
170+
```sh
171+
yarn test:slow
172+
```
173+
174+
If you want to debug an individual file, open the test module (`*.test.ts` or `*.slow-test.ts`), open the _Run and Debug_ view, select the `Run Test [current]` and press <kbd>F5</kbd>.
175+
176+
### CI
177+
178+
This project is built on [GitHub Actions](https://github.com/arduino/arduino-ide/actions).
179+
180+
- _Snapshot_ builds run when changes are pushed to the `main` branch, or when a PR is created against the `main` branch. For the sake of the review and verification process, the build artifacts for each operating system can be downloaded from the GitHub Actions page.
181+
- _Nightly_ builds run every day at 03:00 GMT from the `main` branch.
182+
- _Release_ builds run when a new tag is pushed to the remote. The tag must follow the [semver](https://semver.org/). For instance, `1.2.3` is a correct tag, but `v2.3.4` won't work. Steps to trigger a new release build:
183+
- Create a local tag:
184+
```sh
185+
git tag -a 1.2.3 -m "Creating a new tag for the `1.2.3` release."
186+
```
187+
- Push it to the remote:
188+
```sh
189+
git push origin 1.2.3
190+
```
191+
160192
## FAQ
161193

162-
* *Can I manually change the version of the [`arduino-cli`](https://github.com/arduino/arduino-cli/) used by the IDE?*
194+
- _Can I manually change the version of the [`arduino-cli`](https://github.com/arduino/arduino-cli/) used by the IDE?_
163195

164-
Yes. It is possible but not recommended. The CLI exposes a set of functionality via [gRPC](https://github.com/arduino/arduino-cli/tree/master/rpc) and the IDE uses this API to communicate with the CLI. Before we build a new version of IDE, we pin a specific version of CLI and use the corresponding `proto` files to generate TypeScript modules for gRPC. This means, a particular version of IDE is compliant only with the pinned version of CLI. Mismatching IDE and CLI versions might not be able to communicate with each other. This could cause unpredictable IDE behavior.
196+
Yes. It is possible but not recommended. The CLI exposes a set of functionality via [gRPC](https://github.com/arduino/arduino-cli/tree/master/rpc) and the IDE uses this API to communicate with the CLI. Before we build a new version of IDE, we pin a specific version of CLI and use the corresponding `proto` files to generate TypeScript modules for gRPC. This means, a particular version of IDE is compliant only with the pinned version of CLI. Mismatching IDE and CLI versions might not be able to communicate with each other. This could cause unpredictable IDE behavior.
165197

166-
* *I have understood that not all versions of the CLI are compatible with my version of IDE but how can I manually update the `arduino-cli` inside the IDE?*
198+
- _I have understood that not all versions of the CLI are compatible with my version of IDE but how can I manually update the `arduino-cli` inside the IDE?_
167199

168-
[Get](https://arduino.github.io/arduino-cli/installation) the desired version of `arduino-cli` for your platform and manually replace the one inside the IDE. The CLI can be found inside the IDE at:
169-
- Windows: `C:\path\to\Arduino IDE\resources\app\lib\backend\resources\arduino-cli.exe`,
170-
- macOS: `/path/to/Arduino IDE.app/Contents/Resources/app/lib/backend/resources/arduino-cli`, and
171-
- Linux: `/path/to/Arduino IDE/resources/app/lib/backend/resources/arduino-cli`.
200+
[Get](https://arduino.github.io/arduino-cli/installation) the desired version of `arduino-cli` for your platform and manually replace the one inside the IDE. The CLI can be found inside the IDE at:
172201

202+
- Windows: `C:\path\to\Arduino IDE\resources\app\lib\backend\resources\arduino-cli.exe`,
203+
- macOS: `/path/to/Arduino IDE.app/Contents/Resources/app/lib/backend/resources/arduino-cli`, and
204+
- Linux: `/path/to/Arduino IDE/resources/app/lib/backend/resources/arduino-cli`.

0 commit comments

Comments
 (0)