-
-
Notifications
You must be signed in to change notification settings - Fork 414
[breaking] Implementation of sketch profiles #1713
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
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
803782c
cosmetic: renamed import
cmaglie e82a46d
Simplify function pm.DownloadPlatformRelease
cmaglie 1b1867f
Implementation of the Profiles parser
cmaglie da64af5
Added methods to get profiles from sketch
cmaglie 670c9f1
Added gRPC parameters to support profiles
cmaglie 79eb7f4
Added function to load packages for profiles
cmaglie 183a8bb
Added support for profiles in compile command
cmaglie 1b53f59
Added progress callback and installMissing flag (stubs) in pm.Prepare…
cmaglie 4f8244a
Added auto-install procedures for profiles
cmaglie c21147b
Handle platform not found errors
cmaglie 8527015
Draft implementation of upload with profiles
cmaglie 10d95b2
Made packagemamager.loadToolsFromPackage public
cmaglie 6cc5d65
Simplified callbacks in commands.Init
cmaglie 18b0d34
cosmetic: added shortcut variable for library manager
cmaglie 4a26bd4
cosmetic: added shortcut variable for package manager; small readabil…
cmaglie 5449677
Wiring profiles into arduino-cli and gRPC implementation
cmaglie 5972501
Made gRPC Init return a full Profile structure
cmaglie efa8899
(tech debt) Disable profiles if compiling with --libraries/--library
cmaglie 61081f1
Fixed some linter warnings
cmaglie 6156a26
Apply suggestions from code review
cmaglie 9d1ec03
Added profiles specification docs
cmaglie d998f7f
Allow both sketch.yaml and .yml (with priority for .yaml)
cmaglie be8b325
Correctly handle nil return value
cmaglie 614d652
Apply suggestions from code review
cmaglie 8cdb8cb
Apply suggestions from code review
cmaglie bae72d0
Provide `core install` suggestions only when compiling without profiles
cmaglie 170382d
Remove stray comment
cmaglie 633022f
Fixed some comments in protoc files
cmaglie 1fdbce6
Apply suggestions from code review
cmaglie b206d47
Apply suggestions from code review
cmaglie 453f750
Implemented missing AsYaml methods and added tests
cmaglie 75f4117
Apply suggestions from code review
cmaglie 8203266
run of prettier formatter
cmaglie e20117f
Preserve profiles ordering in profiles.yaml
cmaglie 21e8e86
Apply suggestions from code review
cmaglie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added profiles specification docs
- Loading branch information
commit 9d1ec03db448e73d5c9b6371d8e5dac52ffd7cd9
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
Arduino CLI provides support for reproducible builds through the use of build profiles. | ||
|
||
## Sketch project file `sketch.yaml` and build profiles. | ||
|
||
A profile is a complete description of all the resources needed to build a sketch. Profiles are defined in a project | ||
file called `sketch.yaml`. This file will be in YAML format and it will contain one or more profiles, in particular each | ||
profile will define: | ||
|
||
- The board FQBN | ||
- The target core platform name and version (with the 3rd party platform index URL if needed) | ||
- A possible core platform name and version, that is a dependency of the target core platform (with the 3rd party | ||
platform index URL if needed) | ||
- The libraries used in the sketch (including their version) | ||
|
||
The format of the file is the following: | ||
|
||
``` | ||
profiles: | ||
<PROFILE_NAME>: | ||
notes: <USER_NOTES> | ||
fqbn: <FQBN> | ||
platforms: | ||
- platform: <PLATFORM> (<PLATFORM_VERSION>) | ||
platform_index_url: <3RD_PARTY_PLATFORM_URL> | ||
- platform: <PLATFORM_DEPENDENCY> (<PLATFORM_DEPENDENCY_VERSION>) | ||
platform_index_url: <3RD_PARTY_PLATFORM_DEPENDENCY_URL> | ||
libraries: | ||
- <LIB_NAME> (<LIB_VERSION>) | ||
- <LIB_NAME> (<LIB_VERSION>) | ||
- <LIB_NAME> (<LIB_VERSION>) | ||
|
||
...more profiles here... | ||
``` | ||
|
||
There is a 'profiles:' section containing all the profiles. Each field is self-explanatory, in particular: | ||
|
||
- `<PROFILE_NAME>` is the profile identifier, it’s a user-defined field, and the allowed characters are alphanumerics, | ||
underscore `_`, dot `.`, and dash `-` | ||
- `<PLATFORM>` is the target core platform identifier, for example, `arduino:avr` or `adafruit:samd` | ||
- `<PLATFORM_VERSION>` is the target core platform version required | ||
- `<3RD_PARTY_PLATFORM_URL>` is the index URL to download the target core platform (also known as “Additional Boards | ||
Manager URLs” in the Arduino IDE). This field can be omitted for the official `arduino:*` platforms. | ||
- `<PLATFORM_DEPENDENCY>`, `<PLATFORM_DEPENDENCY_VERSION>`, and `<3RD_PARTY_PLATFORM_DEPENDENCY_URL>` contains the same | ||
information as `<PLATFORM>`, `<PLATFORM_VERSION>`, and `<3RD_PARTY_PLATFORM_URL>` but for the core platform dependency | ||
of the main core platform. These fields are optional. | ||
cmaglie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- `<LIB_VERSION>` is the version required for the library, for example, `1.0.0` | ||
- `<USER_NOTES>` is a free text string available to the developer to add comments | ||
- `<DEFAULT_PROFILE_NAME>` is the profile used by default (more on that later) | ||
cmaglie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
A complete example of a `sketch.yaml` may be the following: | ||
|
||
``` | ||
profiles: | ||
nanorp: | ||
fqbn: arduino:mbed_nano:nanorp2040connect | ||
platforms: | ||
- platform: arduino:mbed_nano (2.1.0) | ||
libraries: | ||
- ArduinoIoTCloud (1.0.2) | ||
- Arduino_ConnectionHandler (0.6.4) | ||
- TinyDHT sensor library (1.1.0) | ||
|
||
another_profile_name: | ||
notes: testing the limit of the AVR platform, may be unstable | ||
fqbn: arduino:avr:uno | ||
platforms: | ||
- platform: arduino:avr (1.8.4) | ||
libraries: | ||
- VitconMQTT (1.0.1) | ||
- Arduino_ConnectionHandler (0.6.4) | ||
- TinyDHT sensor library (1.1.0) | ||
|
||
tiny: | ||
notes: testing the very limit of the AVR platform, it will be very unstable | ||
fqbn: attiny:avr:ATtinyX5:cpu=attiny85,clock=internal16 | ||
platforms: | ||
- platform: attiny:avr@1.0.2 | ||
platform_index_url: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json | ||
- platform: arduino:avr@1.8.3 | ||
libraries: | ||
- ArduinoIoTCloud (1.0.2) | ||
- Arduino_ConnectionHandler (0.6.4) | ||
- TinyDHT sensor library (1.1.0) | ||
|
||
feather: | ||
fqbn: adafruit:samd:adafruit_feather_m0 | ||
platforms: | ||
- platform: adafruit:samd (1.6.0) | ||
platform_index_url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json | ||
libraries: | ||
- ArduinoIoTCloud (1.0.2) | ||
- Arduino_ConnectionHandler (0.6.4) | ||
- TinyDHT sensor library (1.1.0) | ||
``` | ||
|
||
### Building a sketch | ||
|
||
When a `sketch.yaml` file exists in the sketch, it can be leveraged to compile the sketch with the `--profile/-m` flag | ||
in the `compile` command: | ||
|
||
``` | ||
arduino-cli compile --profile nanorp | ||
``` | ||
|
||
In this case, the sketch will be compiled using the core platform and libraries specified in the nanorp profile. If a | ||
core platform or a library is missing it will be automatically downloaded and installed on the fly in a isolated | ||
directory inside the data folder. The dedicated storage is not accessible to the user and is meant as a "cache" of the | ||
resources used to build the sketch. | ||
|
||
When using the profile-based build, the globally installed platforms and libraries are excluded from the compile and can | ||
not be used in any way. In other words, the build is isolated from the system and will rely only on the resources | ||
specified in the profile: this will ensure that the build is portable and reproducible independently from the platforms | ||
and libraries installed in the system. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.