Skip to content

Add a project contributor guide #1419

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 6 commits into from
Sep 15, 2022
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
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ contact_links:
- name: Support request
url: https://forum.arduino.cc/
about: We can help you out on the Arduino Forum!
- name: Issue report guide
url: https://github.com/arduino/arduino-ide/blob/main/docs/issues.md#issue-report-guide
about: Learn about submitting issue reports to this repository.
- name: Contributor guide
url: https://github.com/arduino/arduino-ide/blob/main/docs/CONTRIBUTING.md#contributor-guide
about: Learn about contributing to this project.
- name: Discuss development work on the project
url: https://groups.google.com/a/arduino.cc/g/developers
about: Arduino Developers Mailing List
121 changes: 2 additions & 119 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,120 +1,3 @@
# Development

This page includes technical documentation for developers who want to build the IDE locally and contribute to the project.

## Architecture overview

The IDE consists of three major parts:
- the _Electron main_ process,
- the _backend_, and
- the _frontend_.

The _Electron main_ process is responsible for:
- creating the application,
- managing the application lifecycle via listeners, and
- creating and managing the web pages for the app.

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.

By default, whenever the _Electron main_ process creates a web page, it will instantiate a new `BrowserWindow` instance. Since Electron uses Chromium for displaying web pages, Chromium's multi-process architecture is also used. Each web page in Electron runs in its own process, which is called the renderer process. Each `BrowserWindow` instance runs the web page in its own renderer process. When a `BrowserWindow` instance is destroyed, the corresponding renderer process is also terminated. The main process manages all web pages and their corresponding renderer processes. Each renderer process is isolated and only cares about the web page running in it.<sup>[[1]]</sup>

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.

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

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`.

The _frontend_ is running as an Electron renderer process and can invoke services implemented on the _backend_. The communication between the _backend_ and the _frontend_ is done via JSON-RPC over a websocket connection. This means, the services running in the _frontend_ are all proxies, and will ask the corresponding service implementation on the _backend_.

[1]: https://www.electronjs.org/docs/tutorial/application-architecture#differences-between-main-process-and-renderer-process
[2]: https://code.visualstudio.com/Docs/editor/tasks


## Build from source

If you’re familiar with TypeScript, the [Theia IDE](https://theia-ide.org/), and if you want to contribute to the
project, you should be able to build the Arduino IDE locally.
Please refer to the [Theia IDE prerequisites](https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisites) documentation for the setup instructions.
> **Note**: Node.js 14 must be used instead of the version 12 recommended at the link above.

Once you have all the tools installed, you can build the editor following these steps

1. Install the dependencies and build
```sh
yarn
```

2. Rebuild the dependencies
```sh
yarn rebuild:browser
```

3. Rebuild the electron dependencies
```sh
yarn rebuild:electron
```

4. Start the application
```sh
yarn start
```

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

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.

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

### CI

This project is built on [GitHub Actions](https://github.com/arduino/arduino-ide/actions).

- _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.
- _Nightly_ builds run every day at 03:00 GMT from the `main` branch.
- _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:
- Create a local tag:
```sh
git tag -a 1.2.3 -m "Creating a new tag for the `1.2.3` release."
```
- Push it to the remote:
```sh
git push origin 1.2.3
```

## Notes for macOS contributors
Beginning in macOS 10.14.5, the software [must be notarized to run](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution). The signing and notarization processes for the Arduino IDE are managed by our Continuous Integration (CI) workflows, implemented with GitHub Actions. On every push and pull request, the Arduino IDE is built and saved to a workflow artifact. These artifacts can be used by contributors and beta testers who don't want to set up a build system locally.
For security reasons, signing and notarization are disabled for workflow runs for pull requests from forks of this repository. This means that macOS will block you from running those artifacts.
Due to this limitation, Mac users have two options for testing contributions from forks:

### The Safe approach (recommended)

Follow [the instructions above](#build-from-source) to create the build environment locally, then build the code you want to test.

### The Risky approach

*Please note that this approach is risky as you are lowering the security on your system, therefore we strongly discourage you from following it.*
1. Use [this guide](https://help.apple.com/xcode/mac/10.2/index.html?localePath=en.lproj#/dev9b7736b0e), in order to disable Gatekeeper (at your own risk!).
1. Download the unsigned artifact provided by the CI workflow run related to the Pull Request at each push.
1. Re-enable Gatekeeper after tests are done, following the guide linked above.

## FAQ

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

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.

* *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?*

[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:
- Windows: `C:\path\to\Arduino IDE\resources\app\node_modules\arduino-ide-extension\build\arduino-cli.exe`,
- macOS: `/path/to/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-cli`, and
- Linux: `/path/to/Arduino IDE/resources/app/node_modules/arduino-ide-extension/build/arduino-cli`.
# Development Guide

This documentation has been moved [**here**](docs/development.md#development-guide).
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ If you need assistance, see the [Help Center](https://support.arduino.cc/hc/en-u

## Bugs & Issues

If you want to report an issue, you can submit it to the [issue tracker](https://github.com/arduino/arduino-ide/issues) of this repository. A few rules apply:
If you want to report an issue, you can submit it to the [issue tracker](https://github.com/arduino/arduino-ide/issues) of this repository.

- Before posting, please check if the same problem has been already reported by someone else to avoid duplicates.
- Remember to include as much detail as you can about your hardware set-up, code and steps for reproducing the issue. Make sure you're using an original Arduino board.
See [**the issue report guide**](docs/contributor-guide/issues.md#issue-report-guide) for instructions.

### Security

Expand All @@ -35,16 +34,15 @@ e-mail contact: [email protected]

## Contributions and development

Contributions are very welcome! You can browse the list of open issues to see what's needed and then you can submit your code using a Pull Request. Please provide detailed descriptions. We also appreciate any help in testing issues and patches contributed by other users.
Contributions are very welcome! There are several ways to participate in this project, including:

This repository contains the main code, but two more repositories are included during the build process:
- Fixing bugs
- Beta testing
- Translation

- [vscode-arduino-tools](https://github.com/arduino/vscode-arduino-tools): provides support for the language server and the debugger
- [arduino-language-server](https://github.com/arduino/arduino-language-server): provides the language server that parses Arduino code
See [**the contributor guide**](docs/CONTRIBUTING.md#contributor-guide) for more information.

See the [BUILDING.md](BUILDING.md) for a technical overview of the application and instructions for building the code.

You can help with the translation of the Arduino IDE to your language here: [Arduino IDE on Transifex](https://www.transifex.com/arduino-1/ide2/dashboard/).
See the [**development guide**](docs/development.md) for a technical overview of the application and instructions for building the code.

## Donations

Expand Down
29 changes: 29 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!-- Source: https://github.com/arduino/tooling-project-assets/blob/main/documentation-templates/contributor-guide/general/CONTRIBUTING.md -->

# Contributor Guide

Thanks for your interest in contributing to this project!

There are several ways you can get involved:

| Type of contribution | Contribution method |
| ----------------------------------------- | -------------------------------------------------------------------------------- |
| - Support<br/>- Question<br/>- Discussion | Post on the [**Arduino Forum**][forum] |
| - Bug report<br/>- Feature request | Issue report (see the guide [**here**][issues]) |
| Testing | Beta testing, PR review (see the guide [**here**][beta-testing]) |
| Translation | [Transifex project][translate] |
| - Bug fix<br/>- Enhancement | Pull request (see the guide [**here**][prs]) |
| Monetary | - [Donate][donate]<br/>- [Sponsor][sponsor]<br/>- [Buy official products][store] |

[forum]: https://forum.arduino.cc
[issues]: contributor-guide/issues.md#issue-report-guide
[beta-testing]: contributor-guide/beta-testing.md#beta-testing-guide
[translate]: https://www.transifex.com/arduino-1/ide2/dashboard/
[prs]: contributor-guide/pull-requests.md#pull-request-guide
[donate]: https://www.arduino.cc/en/donate/
[sponsor]: https://github.com/sponsors/arduino
[store]: https://store.arduino.cc

## Resources

- [**Development Guide**](development.md#development-guide)
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Remote Sketchbook

Arduino IDE provides a Remote Sketchbook feature that can be used to upload sketches to Arduino Cloud.
![](static/remote.png)
![](assets/remote.png)



Expand All @@ -13,7 +13,7 @@ A developer could use the content of this repo to create a customized version of

### 1. Changing remote connection parameters in the Preferences panel (be careful while editing the Preferences panel!)
Here a screenshot of the Preferences panel
![](static/preferences.png)
![](assets/preferences.png)
- The settings under _Arduino > Auth_ should be edited to match the OAuth2 configuration of your custom remote sketchbook storage
- The setting under _Arduino > Sketch Sync Endpoint_ should be edited to point to your custom remote sketchbook storage service
### 2. Implementing the Arduino Cloud Store APIs for your custom remote sketchbook storage
Expand Down
File renamed without changes
File renamed without changes
Binary file added docs/contributor-guide/assets/checks-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/contributor-guide/assets/checks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions docs/contributor-guide/beta-testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!-- Source: https://github.com/arduino/tooling-project-assets/blob/main/documentation-templates/contributor-guide/application/contributor-guide/beta-testing.md -->

# Beta Testing Guide

Beta testing of development versions is a valuable contribution to the project. You can help to ensure the quality of the production release that will be distributed to the user community.

Builds of the project are automatically created after every relevant change to the project in order to make it easy for anyone to participate in the testing effort.

---

❗ Make sure to always download the newest available tester build in order to ensure effective results from your beta testing efforts.

---

Beta testing is done during both the proposal (pull request) and pre-release (nightly build) phases of development:

## Testing Pull Requests

Tester builds are automatically created for every [pull request](https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) (PR) that proposes a relevant change.

The builds are updated if the author pushes changes to the PR.

### Installation

The tester build for a PR can be downloaded by following these instructions:

1. Sign in to your [**GitHub**](https://github.com/) account.<br />
(GitHub only allows downloads of the tester builds when you are signed in.)
1. Open the PR you are interested in.<br />
They are listed here:<br />
https://github.com/arduino/arduino-ide/pulls
1. Click the "**Checks**" tab at the top of the PR's page.
1. From the list on the left side of the page, click on "**Arduino IDE**".
1. Scroll down to the "**Artifacts**" section of the page that opens.
1. Click the download link for your operating system.<br />
**ⓘ** For example, if you are using Windows, click the "**Windows_X86-64_zip**" link.
1. Wait for the download to finish.
1. Extract or install the downloaded file as usual.

![checks tab](assets/checks-tab.png)

![tester build link](assets/tester-build-link.png)

![tester build artifacts](assets/tester-build-artifacts.png)

#### Notes for macOS

Beginning in macOS 10.14.5, the software [must be notarized to run](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution).

For security reasons, signing and notarization are disabled when creating tester builds for pull requests from forks of this repository. This means that macOS will block you from running the tester builds for those PRs.

Due to this limitation, Mac users have two options for testing PRs from forks:

##### The Safe Approach

Build the version of the Arduino IDE you want to test from source instead of using the automatically created tester build.

[Instructions for building the project](../development.md#build-from-source)

##### The Risky Approach

---

⚠ Please note that this approach is risky as you are lowering the security on your system, therefore we strongly discourage you from following it.

---

1. Start the tester build.<br />
A warning will appear:
> "Arduino IDE" cannot be opened because the developer cannot be verified.
1. Follow the instructions from the "**If you want to open an app that hasn't been notarized or is from an unidentified developer**" section of this page to bypass the security restriction:<br />
[https://support.apple.com/en-us/HT202491](https://support.apple.com/en-us/HT202491#:~:text=If%20you%20want%20to%20open%20an%20app%20that%20hasn%E2%80%99t%20been%20notarized%20or%20is%20from%20an%20unidentified%20developer)

### Feedback

Feedback after beta testing a pull request is always valuable, regardless of which categories your findings fall under:

- working as expected
- problems encountered
- areas for improvement

Please submit feedback related to the changes made in the pull request as a PR review:

https://docs.github.com/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews

---

If you discover problems or areas for improvement that are unrelated to the changes made by the PR (i.e., they also occur when using the [nightly build](#testing-nightly-build)), please submit that feedback as an issue report instead of a review.

[More information on issue reports](issues.md#issue-report-guide)

## Testing Nightly Build

Builds of the project's production branch are produced daily. This build represents the current pre-release state of the project, which is planned for distribution in the next release.

### Installation

1. Open Arduino's "**Software**" page:<br />
https://www.arduino.cc/en/software#nightly-builds
1. Select the appropriate download link from the "**Nightly Builds**" section of the page.
1. Wait for the download to finish.
1. Extract or install the downloaded file as usual.

### Feedback

If you discover any problems or areas for improvement please submit an issue report.

[More information on issue reports](issues.md#issue-report-guide)
Loading