Upgrading

‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌

Upgrading

Here you can find a list of migration guides to handle breaking changes, deprecations, and bugfixes that may cause problems between releases of the CLI.

1.0.4

The build cache path specified with
compile --build-cache-path
or
build_cache.path
now affects also sketches.

Previously the specified build cache path only affected cores and it was ignored for sketches. This is now fixed and both cores and sketches are cached in the given directory.

A full build of the sketch is performed if a build path is specified in
compile --build-path ...
.

Previously if a build path was specified a cached core could have been used from the global build cache path resulting in a partial build inside the given build path.

Now if a build path is specified, the global build cache path is ignored and the full build is done in the given build path.

compile --build-cache-path
is deprecated.

The change above, makes the

compile --build-cache-path
flag useless. It is kept just for backward compatibility.

The default
build_cache.path
has been moved from the temp folder to the user's cache folder.

Previously the

build_cache.path
was in
$TMP/arduino
. Now it has been moved to the specific OS user's cache folder, for example in Linux it happens to be
$HOME/.cache/arduino
.

1.0.0

compile --build-cache-path
slightly changed directory format

Now compiled cores are cached under the

cores
subdir of the path specified in
--build-cache-path
, previously it was saved under the
core
subdir. The new behaviour is coherent with the default cache directory
/tmp/arduino/cores/...
when the cache directory is not set by the user.

Configuration file now supports only YAML format.

The Arduino CLI configuration file now supports only the YAML format.

gRPC Setting API important changes

The Settings API has been heavily refactored. Here a quick recap of the new methods:

  • SettingsGetValue
    returns the value of a setting given the key. The returned value is a string encoded in JSON, or YAML

    1message SettingsGetValueRequest {
    2 // The key to get
    3 string key = 1;
    4 // The format of the encoded_value (default is
    5 // "json", allowed values are "json" and "yaml)
    6 string value_format = 2;
    7}
    8
    9message SettingsGetValueResponse {
    10 // The value of the key (encoded)
    11 string encoded_value = 1;
    12}
  • SettingsSetValue
    change the value of a setting. The value may be specified in JSON, YAML, or as a command-line argument. If
    encoded_value
    is an empty string the setting is deleted.

    1message SettingsSetValueRequest {
    2 // The key to change
    3 string key = 1;
    4 // The new value (encoded), no objects,
    5 // only scalar, or array of scalars are
    6 // allowed.
    7 string encoded_value = 2;
    8 // The format of the encoded_value (default is
    9 // "json", allowed values are "json", "yaml",
    10 // and "cli")
    11 string value_format = 3;
    12}
  • SettingsEnumerate
    returns all the available keys and their type (
    string
    ,
    int
    ,
    []string
    ...)

  • ConfigurationOpen
    replaces the current configuration with the one passed as argument. Differently from
    SettingsSetValue
    , this call replaces the whole configuration.

  • ConfigurationSave
    outputs the current configuration in the specified format. The configuration is not saved in a file, this call returns just the content, it's a duty of the caller to store the content in a file.

  • ConfigurationGet
    return the current configuration in a structured gRPC message
    Configuration
    .

The previous gRPC Setting rpc call may be replaced as follows:

  • The old
    SettingsMerge
    rpc call can now be done trough
    SettingsSetValue
    .
  • The old
    SettingsDelete
    rpc call can now be done trough
    SettingsSetValue
    passing the
    key
    to delete with an empty
    value
    .
  • The old
    SettingsGetAll
    rpc call has been replaced by
    ConfigurationGet
    that returns a structured message
    Configuration
    with all the settings populated.
  • The old
    SettingsWrite
    rpc call has been removed. It is partially replaced by
    ConfigurationSave
    but the actual file save must be performed by the caller.

golang: importing
arduino-cli
as a library now requires the creation of a gRPC service.

Previously the methods implementing the Arduino business logic were available in the global namespace

github.com/arduino/arduino-cli/commands/*
and could be called directly.

The above is no more true. All the global

commands.*
functions have been converted to methods of the
arduinoCoreServerImpl
struct that implements the gRPC
ArduinoCoreServer
interface. The configuration is now part of the server internal state. Developers may create a "daemon-less" server by calling the
commands.NewArduinoCoreServer()
function and can use the returned object to call all the needed gRPC functions.

The methods of the

ArduinoCoreServer
are generated through the gRPC protobuf definitions, some of those methods are gRPC "streaming" methods and requires a streaming object to be passed as argument, we provided helper methods to create these objects.

For example if previously we could call

commands.Init
like this:

1// old Init signature
2func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) error { ... }
3
4// ...
5
6// Initialize instance
7if err := commands.Init(&rpc.InitRequest{Instance: req.GetInstance()}, respCB); err != nil {
8 return err
9}

now the

responseCallback
must be wrapped into an
rpc.ArduinoCoreService_InitServer
, and we provided a method exactly for that:

1// new Init method
2func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCoreService_InitServer) error { ... }
3
4/// ...
5
6// Initialize instance
7initStream := InitStreamResponseToCallbackFunction(ctx, respCB)
8if err := srv.Init(&rpc.InitRequest{Instance: req.GetInstance()}, initStream); err != nil {
9 return err
10}

Each gRPC method has an helper method to obtain the corresponding

ArduinoCoreService_*Server
parameter. Here a simple, but complete, example:

1package main
2
3import (
4 "context"
5 "fmt"
6 "io"
7 "log"
8
9 "github.com/arduino/arduino-cli/commands"
10 rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
11 "github.com/sirupsen/logrus"
12)
13
14func main() {
15 // Create a new ArduinoCoreServer
16 srv := commands.NewArduinoCoreServer()
17
18 // Disable logging
19 logrus.SetOutput(io.Discard)
20
21 // Create a new instance in the server
22 ctx := context.Background()
23 resp, err := srv.Create(ctx, &rpc.CreateRequest{})
24 if err != nil {
25 log.Fatal("Error creating instance:", err)
26 }
27 instance := resp.GetInstance()
28
29 // Defer the destruction of the instance
30 defer func() {
31 if _, err := srv.Destroy(ctx, &rpc.DestroyRequest{Instance: instance}); err != nil {
32 log.Fatal("Error destroying instance:", err)
33 }
34 fmt.Println("Instance successfully destroyed")
35 }()
36
37 // Initialize the instance
38 initStream := commands.InitStreamResponseToCallbackFunction(ctx, func(r *rpc.InitResponse) error {
39 fmt.Println("INIT> ", r)
40 return nil
41 })
42 if err := srv.Init(&rpc.InitRequest{Instance: instance}, initStream); err != nil {
43 log.Fatal("Error during initialization:", err)
44 }
45
46 // Search for platforms and output the result
47 searchResp, err := srv.PlatformSearch(ctx, &rpc.PlatformSearchRequest{Instance: instance})
48 if err != nil {
49 log.Fatal("Error searching for platforms:", err)
50 }
51 for _, platformSummary := range searchResp.GetSearchOutput() {
52 installed := platformSummary.GetInstalledRelease()
53 meta := platformSummary.GetMetadata()
54 fmt.Printf("%30s %8s %s\n", meta.GetId(), installed.GetVersion(), installed.GetName())
55 }
56}

YAML output format is no more supported

The

yaml
option of the
--format
flag is no more supported. Use
--format json
if machine parsable output is needed.

gRPC: The
type
field has been renamed to
types
in the
cc.arduino.cli.commands.v1.PlatformRelease
message.

Rebuilding the gRPC bindings from the proto files requires to rename all access to

type
field as
types
.

By the way, the wire protocol is not affected by this change, existing clients should work fine without modification.

The
type
field has been renamed to
types
in the JSON output including a platform release.

Since the

type
field may contain multiple values has been renamed to
types
to better express this aspect.

Previously:

1$ arduino-cli core list --json | jq '.platforms[4].releases."1.8.13"'
2{
3 "name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
4 "version": "1.8.13",
5 "type": [
6 "Arduino"
7 ],
8 ...

Now:

1$ arduino-cli core list --json | jq '.platforms[4].releases."1.8.13"'
2{
3 "name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
4 "version": "1.8.13",
5 "types": [
6 "Arduino"
7 ],
8 ...

The gRPC
cc.arduino.cli.commands.v1.CompileRequest.export_binaries
changed type.

Previously the field

export_binaries
was a
google.protobuf.BoolValue
. We used this type because it expresses this field's optional nature (that is, it could be
true
,
false
, and
null
if not set).

Now the field is an

optional bool
, since the latest protobuf protocol changes now allows optional fields.

Some gRPC responses messages now uses the
oneof
clause.

The following responses message:

  • cc.arduino.cli.commands.v1.PlatformInstallResponse
  • cc.arduino.cli.commands.v1.PlatformDownloadResponse
  • cc.arduino.cli.commands.v1.PlatformUninstallResponse
  • cc.arduino.cli.commands.v1.PlatformUpgradeResponse
  • cc.arduino.cli.commands.v1.DebugResponse
  • cc.arduino.cli.commands.v1.LibraryDownloadResponse
  • cc.arduino.cli.commands.v1.LibraryInstallResponse
  • cc.arduino.cli.commands.v1.LibraryUpgradeResponse
  • cc.arduino.cli.commands.v1.LibraryUninstallResponse
  • cc.arduino.cli.commands.v1.LibraryUpgradeAllResponse
  • cc.arduino.cli.commands.v1.ZipLibraryInstallResponse
  • cc.arduino.cli.commands.v1.GitLibraryInstallResponse
  • cc.arduino.cli.commands.v1.MonitorResponse

now use the

oneof
clause to make the stream nature of the message more explicit. Just to give an example, the
PlatformInstallResponse
message has been changed from:

1message PlatformInstallResponse {
2 // Progress of the downloads of the platform and tool files.
3 DownloadProgress progress = 1;
4 // Description of the current stage of the installation.
5 TaskProgress task_progress = 2;
6}

to:

1message PlatformInstallResponse {
2 message Result {
3 // Empty message, reserved for future expansion.
4 }
5 oneof message {
6 // Progress of the downloads of the platform and tool files.
7 DownloadProgress progress = 1;
8 // Description of the current stage of the installation.
9 TaskProgress task_progress = 2;
10 // The installation result.
11 Result result = 3;
12 }
13}

The other messages have been changed in a similar way.

The gRPC
cc.arduino.cli.commands.v1.UpdateIndexResponse
and
UpdateLibrariesIndexResponse
have changed.

The responses coming from the update index commands:

1message UpdateIndexResponse {
2 // Progress of the package index download.
3 DownloadProgress download_progress = 1;
4}
5
6message UpdateLibrariesIndexResponse {
7 // Progress of the libraries index download.
8 DownloadProgress download_progress = 1;
9}

are now more explicit and contains details about the result of the operation:

1message UpdateIndexResponse {
2 message Result {
3 // The result of the packages index update.
4 repeated IndexUpdateReport updated_indexes = 1;
5 }
6 oneof message {
7 // Progress of the package index download.
8 DownloadProgress download_progress = 1;
9 // The result of the index update.
10 Result result = 2;
11 }
12}
13
14message UpdateLibrariesIndexResponse {
15 message Result {
16 // The result of the libraries index update.
17 IndexUpdateReport libraries_index = 1;
18 }
19 oneof message {
20 // Progress of the libraries index download.
21 DownloadProgress download_progress = 1;
22 // The result of the index update.
23 Result result = 2;
24 }
25}

The

IndexUpdateReport
message contains details for each index update operation performed:

1message IndexUpdateReport {
2 enum Status {
3 // The status of the index update is unspecified.
4 STATUS_UNSPECIFIED = 0;
5 // The index has been successfully updated.
6 STATUS_UPDATED = 1;
7 // The index was already up to date.
8 STATUS_ALREADY_UP_TO_DATE = 2;
9 // The index update failed.
10 STATUS_FAILED = 3;
11 // The index update was skipped.
12 STATUS_SKIPPED = 4;
13 }
14
15 // The URL of the index that was updated.
16 string index_url = 1;
17 // The result of the index update.
18 Status status = 2;
19}

The gRPC
cc.arduino.cli.commands.v1.Profile
message has been removed in favor of
SketchProfile

The message

Profile
has been replaced with
SketchProfile
in the
InitResponse.profile
field:

1message InitResponse {
2 oneof message {
3 Progress init_progress = 1;
4 google.rpc.Status error = 2;
5 // Selected profile information
6 SketchProfile profile = 3;
7 }
8}

The gRPC
cc.arduino.cli.commands.v1.LoadSketchResponse
message has been changed.

Previously the

LoadSketchResponse
containted all the information about the sketch:

1message LoadSketchResponse {
2 string main_file = 1;
3 string location_path = 2;
4 repeated string other_sketch_files = 3;
5 repeated string additional_files = 4;
6 repeated string root_folder_files = 5;
7 string default_fqbn = 6;
8 string default_port = 7;
9 string default_protocol = 8;
10 repeated SketchProfile profiles = 9;
11 SketchProfile default_profile = 10;
12}

Now all the metadata have been moved into a specific

Sketch
message:

1message LoadSketchResponse {
2 Sketch sketch = 1;
3}
4
5message Sketch {
6 string main_file = 1;
7 string location_path = 2;
8 repeated string other_sketch_files = 3;
9 repeated string additional_files = 4;
10 repeated string root_folder_files = 5;
11 string default_fqbn = 6;
12 string default_port = 7;
13 string default_protocol = 8;
14 repeated SketchProfile profiles = 9;
15 SketchProfile default_profile = 10;
16}

Drop support for
builtin.tools

We're dropping the

builtin.tools
support. It was the equivalent of Arduino IDE 1.x bundled tools directory.

The gRPC
cc.arduino.cli.commands.v1.MonitorRequest
message has been changed.

Previously the

MonitorRequest
was a single message used to open the monitor, to stream data, and to change the port configuration:

1message MonitorRequest {
2 // Arduino Core Service instance from the `Init` response.
3 Instance instance = 1;
4 // Port to open, must be filled only on the first request
5 Port port = 2;
6 // The board FQBN we are trying to connect to. This is optional, and it's
7 // needed to disambiguate if more than one platform provides the pluggable
8 // monitor for a given port protocol.
9 string fqbn = 3;
10 // Data to send to the port
11 bytes tx_data = 4;
12 // Port configuration, optional, contains settings of the port to be applied
13 MonitorPortConfiguration port_configuration = 5;
14}

Now the meaning of the fields has been clarified with the

oneof
clause, making it more explicit:

1message MonitorRequest {
2 oneof message {
3 // Open request, it must be the first incoming message
4 MonitorPortOpenRequest open_request = 1;
5 // Data to send to the port
6 bytes tx_data = 2;
7 // Port configuration, contains settings of the port to be changed
8 MonitorPortConfiguration updated_configuration = 3;
9 // Close message, set to true to gracefully close a port (this ensure
10 // that the gRPC streaming call is closed by the daemon AFTER the port
11 // has been successfully closed)
12 bool close = 4;
13 }
14}
15
16message MonitorPortOpenRequest {
17 // Arduino Core Service instance from the `Init` response.
18 Instance instance = 1;
19 // Port to open, must be filled only on the first request
20 Port port = 2;
21 // The board FQBN we are trying to connect to. This is optional, and it's
22 // needed to disambiguate if more than one platform provides the pluggable
23 // monitor for a given port protocol.
24 string fqbn = 3;
25 // Port configuration, optional, contains settings of the port to be applied
26 MonitorPortConfiguration port_configuration = 4;
27}

Now the message field

MonitorPortOpenRequest.open_request
must be sent in the first message after opening the streaming gRPC call.

The identification number of the fields has been changed, this change is not binary compatible with old clients.

Some golang modules from
github.com/arduino/arduino-cli/*
have been made private.

The following golang modules are no longer available as public API:

  • github.com/arduino/arduino-cli/arduino
  • github.com/arduino/arduino-cli/buildcache
  • github.com/arduino/arduino-cli/client_example
  • github.com/arduino/arduino-cli/configuration
  • github.com/arduino/arduino-cli/docsgen
  • github.com/arduino/arduino-cli/executils
  • github.com/arduino/arduino-cli/i18n
  • github.com/arduino/arduino-cli/table

Most of the

executils
library has been integrated inside the
go-paths
library
github.com/arduino/go-paths-helper
. The other packages are not intended for usage outside the Arduino CLI, we will keep them internal to allow future breaking changes as needed.

CLI changed JSON output for some
lib
,
core
,
config
,
board
, and
sketch
commands.

  • arduino-cli lib list --format json
    results are now wrapped under
    installed_libraries
    key

    1{ "installed_libraries": [ {...}, {...} ] }
  • arduino-cli lib examples --format json
    results are now wrapped under
    examples
    key

    1{ "examples": [ {...}, {...} ] }
  • arduino-cli core search --format json
    and
    arduino-cli core list --format json
    results are now wrapped under
    platforms
    key

    1{ "platforms": [ {...}, {...} ] }
  • arduino-cli config init --format json
    now correctly returns a json object containg the config path

    1{ "config_path": "/home/user/.arduino15/arduino-cli.yaml" }
  • arduino-cli config dump --format json
    results are now wrapped under
    config
    key

    1{ "config": { ... } }
  • arduino-cli board search --format json
    results are now wrapped under
    boards
    key

    1{ "boards": [ {...}, {...} ] }
  • arduino-cli board list --format json
    results are now wrapped under
    detected_ports
    key

    1{ "detected_ports": [ {...}, {...} ] }
  • arduino-cli sketch new
    now correctly returns a json object containing the sketch path

    1{ "sketch_path": "/tmp/my_sketch" }

config dump
no longer returns default configuration values

Previously, the

config dump
CLI command returned the effective configuration, including both the values explicitly set via the configuration file and environment variables as well as the values provided by defaults.

It now only returns the explicitly set configuration data.

Use

config get <configuration key>
to get the effective value of the configuration

The gRPC response
cc.arduino.cli.commands.v1.CompileResponse
has been changed.

The

CompilerResponse
message has been refactored to made explicit which fields are intended for streaming the build process and which fields are part of the build result.

The old

CompilerResponse
:

1message CompileResponse {
2 // The output of the compilation process (stream)
3 bytes out_stream = 1;
4 // The error output of the compilation process (stream)
5 bytes err_stream = 2;
6 // The compiler build path
7 string build_path = 3;
8 // The libraries used in the build
9 repeated Library used_libraries = 4;
10 // The size of the executable split by sections
11 repeated ExecutableSectionSize executable_sections_size = 5;
12 // The platform where the board is defined
13 InstalledPlatformReference board_platform = 6;
14 // The platform used for the build (if referenced from the board platform)
15 InstalledPlatformReference build_platform = 7;
16 // Completions reports of the compilation process (stream)
17 TaskProgress progress = 8;
18 // Build properties used for compiling
19 repeated string build_properties = 9;
20 // Compiler errors and warnings
21 repeated CompileDiagnostic diagnostics = 10;
22}

has been split into a

CompilerResponse
and a
BuilderResult
:

1message CompileResponse {
2 oneof message {
3 // The output of the compilation process (stream)
4 bytes out_stream = 1;
5 // The error output of the compilation process (stream)
6 bytes err_stream = 2;
7 // Completions reports of the compilation process (stream)
8 TaskProgress progress = 3;
9 // The compilation result
10 BuilderResult result = 4;
11 }
12}
13
14message BuilderResult {
15 // The compiler build path
16 string build_path = 1;
17 // The libraries used in the build
18 repeated Library used_libraries = 2;
19 // The size of the executable split by sections
20 repeated ExecutableSectionSize executable_sections_size = 3;
21 // The platform where the board is defined
22 InstalledPlatformReference board_platform = 4;
23 // The platform used for the build (if referenced from the board platform)
24 InstalledPlatformReference build_platform = 5;
25 // Build properties used for compiling
26 repeated string build_properties = 7;
27 // Compiler errors and warnings
28 repeated CompileDiagnostic diagnostics = 8;
29}

with a clear distinction on which fields are streamed.

The gRPC response
cc.arduino.cli.commands.v1.UploadUsingProgrammerResponse
and
cc.arduino.cli.commands.v1.BurnBootloaderResponse
has been changed.

The old messages:

1message UploadUsingProgrammerResponse {
2 // The output of the upload process.
3 bytes out_stream = 1;
4 // The error output of the upload process.
5 bytes err_stream = 2;
6}
7
8message BurnBootloaderResponse {
9 // The output of the burn bootloader process.
10 bytes out_stream = 1;
11 // The error output of the burn bootloader process.
12 bytes err_stream = 2;
13}

now have the

oneof
clause that makes explicit the streaming nature of the response:

1message UploadUsingProgrammerResponse {
2 oneof message {
3 // The output of the upload process.
4 bytes out_stream = 1;
5 // The error output of the upload process.
6 bytes err_stream = 2;
7 }
8}
9
10message BurnBootloaderResponse {
11 oneof message {
12 // The output of the burn bootloader process.
13 bytes out_stream = 1;
14 // The error output of the burn bootloader process.
15 bytes err_stream = 2;
16 }
17}

The gRPC
cc.arduino.cli.commands.v1.PlatformRelease
has been changed.

We've added a new field called

compatible
. This field indicates if the current platform release is installable or not. It may happen that a platform doesn't have a dependency available for an OS/ARCH, in such cases, if we try to install the platform it will fail. The new field can be used to know upfront if a specific release is installable.

The gRPC
cc.arduino.cli.commands.v1.PlatformSummary
has been changed.

We've modified the behavior of

latest_version
. Now this field indicates the latest version that can be installed in the current OS/ARCH.

core list
now returns only the latest version that can be installed.

Previously, we showed the latest version without checking if all the dependencies were available in the current OS/ARCH. Now, the latest version will always point to an installable one even if a newer incompatible one is present.

core search
now returns the latest installable version of a core.

We now show in the

version
column the latest installable version. If none are available then we show a
n/a
label. The corresponding command with
--format json
now returns the same output of
arduino-cli core search --all --format json
.

core upgrade
and
core install
will install the latest compatible version.

Previously, we'd have tried the installation/upgrade of a core even if all the required tools weren't available in the current OS/ARCH. Now we check this upfront, and allowing the installation of incompatible versions only if a user explicitly provides it like:

core install arduino:renesas_uno@1.0.2

gRPC service
cc.arduino.cli.settings.v1
has been removed, and all RPC calls have been migrated to
cc.arduino.cli.commands.v1

The service

cc.arduino.cli.settings.v1
no longer exists and all existing RPC calls have been moved to the
cc.arduino.cli.commands.v1
service adding a
Settings
prefix to the names of all messages. The existing RPC calls:

  • rpc GetAll(GetAllRequest) returns (GetAllResponse)
  • rpc Merge(MergeRequest) returns (MergeResponse)
  • rpc GetValue(GetValueRequest) returns (GetValueResponse)
  • rpc SetValue(SetValueRequest) returns (SetValueResponse)
  • rpc Write(WriteRequest) returns (WriteResponse)
  • rpc Delete(DeleteRequest) returns (DeleteResponse)

are now renamed to:

  • rpc SettingsGetAll(SettingsGetAllRequest) returns (SettingsGetAllResponse)
  • rpc SettingsMerge(SettingsMergeRequest) returns (SettingsMergeResponse)
  • rpc SettingsGetValue(SettingsGetValueRequest) returns (SettingsGetValueResponse)
  • rpc SettingsSetValue(SettingsSetValueRequest) returns (SettingsSetValueResponse)
  • rpc SettingsWrite(SettingsWriteRequest) returns (SettingsWriteResponse)
  • rpc SettingsDelete(SettingsDeleteRequest) returns (SettingsDeleteResponse)

gRPC
cc.arduino.cli.commands.v1.LibrarySearchRequest
message has been changed.

The

query
field has been removed, use
search_args
instead.

CLI
core list
and
core search
changed JSON output.

Below is an example of the response containing an object with all possible keys set.

1[
2 {
3 "id": "arduino:avr",
4 "maintainer": "Arduino",
5 "website": "http://www.arduino.cc/",
6 "email": "packages@arduino.cc",
7 "indexed": true,
8 "manually_installed": true,
9 "deprecated": true,
10 "releases": {
11 "1.6.2": {
12 "name": "Arduino AVR Boards",
13 "version": "1.6.2",
14 "type": [
15 "Arduino"
16 ],
17 "installed": true,
18 "boards": [
19 {
20 "name": "Arduino Robot Motor"
21 }
22 ],
23 "help": {
24 "online": "http://www.arduino.cc/en/Reference/HomePage"
25 },
26 "missing_metadata": true,
27 "deprecated": true
28 },
29 "1.8.3": { ... }
30 },
31 "installed_version": "1.6.2",
32 "latest_version": "1.8.3"
33 }
34]

gRPC
cc.arduino.cli.commands.v1.PlatformSearchResponse
message has been changed.

The old behavior was a bit misleading to the client because, to list all the available versions for each platform, we used to use the

latest
as it was describing the current platform version. We introduced a new message:
PlatformSummary
, with the intent to make the response more straightforward and less error-prone.

1message PlatformSearchResponse {
2 // Results of the search.
3 repeated PlatformSummary search_output = 1;
4}
5
6// PlatformSummary is a structure containing all the information about
7// a platform and all its available releases.
8message PlatformSummary {
9 // Generic information about a platform
10 PlatformMetadata metadata = 1;
11 // Maps version to the corresponding PlatformRelease
12 map<string, PlatformRelease> releases = 2;
13 // The installed version of the platform, or empty string if none installed
14 string installed_version = 3;
15 // The latest available version of the platform, or empty if none available
16 string latest_version = 4;
17}

The new response contains an array of

PlatformSummary
.
PlatformSummary
contains all the information about a platform and all its available releases. Releases contain all the PlatformReleases of a specific platform, and the key is the semver string of a specific version. We've added the
installed_version
and
latest_version
to make more convenient the access of such values in the map. A few notes about the behavior of the
releases
map:

  • It can be empty if no releases are found
  • It can contain a single-release
  • It can contain multiple releases
  • If in the request we provide the
    manually_installed=true
    , the key of such release is an empty string.

Removed gRPC API:
cc.arduino.cli.commands.v1.PlatformList
,
PlatformListRequest
, and
PlatformListResponse
.

The following gRPC API have been removed:

  • cc.arduino.cli.commands.v1.PlatformList
    : you can use the already available gRPC method
    PlatformSearch
    to perform the same task. Setting the
    all_versions=true
    and
    manually_installed=true
    in the
    PlatformSearchRequest
    returns all the data needed to produce the same result of the old api.
  • cc.arduino.cli.commands.v1.PlatformListRequest
    .
  • cc.arduino.cli.commands.v1.PlatformListResponse
    .

gRPC
cc.arduino.cli.commands.v1.Platform
message has been changed.

The old

Platform
and other information such as name, website, and email... contained details about the currently installed version and the latest available. We noticed an ambiguous use of the
latest
field, especially when such a message came in the
PlatformSearchResponse
response. In that use case, the latest field contained the specific version of a particular platform: this is a hack because the value doesn't always reflect the meaning of that property. Another inconsistent case occurs when a platform maintainer changes the name of a particular release. We always pick the value from the latest release, but this might not be what we want to do all the time. We concluded that the design of that message isn't something to be considered future-proof proof, so we decided to modify it as follows:

1// Platform is a structure containing all the information about a single
2// platform release.
3message Platform {
4 // Generic information about a platform
5 PlatformMetadata metadata = 1;
6 // Information about a specific release of a platform
7 PlatformRelease release = 2;
8}
9
10// PlatformMetadata contains generic information about a platform (not
11// correlated to a specific release).
12message PlatformMetadata {
13 // Platform ID (e.g., `arduino:avr`).
14 string id = 1;
15 // Maintainer of the platform's package.
16 string maintainer = 2;
17 // A URL provided by the author of the platform's package, intended to point
18 // to their website.
19 string website = 3;
20 // Email of the maintainer of the platform's package.
21 string email = 4;
22 // If true this Platform has been installed manually in the user' sketchbook
23 // hardware folder
24 bool manually_installed = 5;
25 // True if the latest release of this Platform has been deprecated
26 bool deprecated = 6;
27 // If true the platform is indexed
28 bool indexed = 7;
29}
30
31// PlatformRelease contains information about a specific release of a platform.
32message PlatformRelease {
33 // Name used to identify the platform to humans (e.g., "Arduino AVR Boards").
34 string name = 1;
35 // Version of the platform release
36 string version = 5;
37 // Type of the platform.
38 repeated string type = 6;
39 // True if the platform is installed
40 bool installed = 7;
41 // List of boards provided by the platform. If the platform is installed,
42 // this is the boards listed in the platform's boards.txt. If the platform is
43 // not installed, this is an arbitrary list of board names provided by the
44 // platform author for display and may not match boards.txt.
45 repeated Board boards = 8;
46 // A URL provided by the author of the platform's package, intended to point
47 // to their online help service.
48 HelpResources help = 9;
49 // This field is true if the platform is missing installation metadata (this
50 // happens if the platform has been installed with the legacy Arduino IDE
51 // <=1.8.x). If the platform miss metadata and it's not indexed through a
52 // package index, it may fail to work correctly in some circumstances, and it
53 // may need to be reinstalled. This should be evaluated only when the
54 // PlatformRelease is `Installed` otherwise is an undefined behaviour.
55 bool missing_metadata = 10;
56 // True this release is deprecated
57 bool deprecated = 11;
58}

To address all the inconsistencies/inaccuracies we introduced two messages:

  • PlatformMetadata
    contains generic information about a platform (not correlated to a specific release).
  • PlatformRelease
    contains information about a specific release of a platform.

debugging_supported
field has been removed from gRPC
cc.arduino.cli.commands.v1.BoardDetails
and
board details
command in CLI

The

debugging_supported
field has been removed, since the possibility to debug is determined by:

  • the board selected
  • the board option selected
  • the programmer selected

the

board details
command has no sufficient information to determine it. If you need to determine if a specific selection of board + option + programmer supports debugging, use the gRPC call
cc.arduino.cli.commands.v1.GetDebugConfig
: if the call is successful, it means that the debugging is supported.

0.35.0

CLI
debug --info
changed JSON output.

The string field

server_configuration.script
is now an array and has been renamed
scripts
, here an example:

1{
2 "executable": "/tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf",
3 "toolchain": "gcc",
4 "toolchain_path": "/home/user/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/",
5 "toolchain_prefix": "arm-none-eabi",
6 "server": "openocd",
7 "server_path": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
8 "server_configuration": {
9 "path": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
10 "scripts_dir": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/share/openocd/scripts/",
11 "scripts": [
12 "/home/user/Workspace/arduino-cli/internal/integrationtest/debug/testdata/hardware/my/samd/variants/arduino:mkr1000/openocd_scripts/arduino_zero.cfg"
13 ]
14 }
15}

gRPC
cc.arduino.cli.commands.v1.GetDebugConfigResponse
message has been changed.

The fields

toolchain_configuration
and
server_configuration
are no more generic
map<string, string>
but they have changed type to
goog.protobuf.Any
, the concrete type is assigned at runtime based on the value of
toolchain
and
server
fields respectively.

For the moment:

  • only
    gcc
    is supported for
    toolchain
    , and the concrete type for
    toolchain_configuration
    is
    DebugGCCToolchainConfiguration
    .
  • only
    openocd
    is supported for
    server
    , and the concrete type for
    server_configuration
    is
    DebugOpenOCDServerConfiguration

More concrete type may be added in the future as more servers/toolchains support is implemented.

gRPC service
cc.arduino.cli.debug.v1
moved to
cc.arduino.cli.commands.v1
.

The gRPC service

cc.arduino.cli.debug.v1
has been removed and all gRPC messages and rpc calls have been moved to
cc.arduino.cli.commands.v1
.

The gRPC message

DebugConfigRequest
has been renamed to the proper
GetDebugConfigRequest
.

All the generated API has been updated as well.

The gRPC
cc.arduino.cli.commands.v1.BoardListWatchRequest
command request has been changed.

The gRPC message

BoardListWatchRequest
has been changed from:

1message BoardListWatchRequest {
2 // Arduino Core Service instance from the `Init` response.
3 Instance instance = 1;
4 // Set this to true to stop the discovery process
5 bool interrupt = 2;
6}

to

1message BoardListWatchRequest {
2 // Arduino Core Service instance from the `Init` response.
3 Instance instance = 1;
4}

The gRPC
cc.arduino.cli.commands.v1.BoardListWatch
service is now server stream only.

1rpc BoardListWatch(BoardListWatchRequest)
2 returns (stream BoardListWatchResponse);

0.34.0

The gRPC
cc.arduino.cli.commands.v1.UploadRepsonse
command response has been changed.

Previously the

UploadResponse
was used only to stream the tool output:

1message UploadResponse {
2 // The output of the upload process.
3 bytes out_stream = 1;
4 // The error output of the upload process.
5 bytes err_stream = 2;
6}

Now the API logic has been clarified using the

oneof
clause and another field has been added providing an
UploadResult
message that is sent when a successful upload completes.

1message UploadResponse {
2 oneof message {
3 // The output of the upload process.
4 bytes out_stream = 1;
5 // The error output of the upload process.
6 bytes err_stream = 2;
7 // The upload result
8 UploadResult result = 3;
9 }
10}
11
12message UploadResult {
13 // When a board requires a port disconnection to perform the upload, this
14 // field returns the port where the board reconnects after the upload.
15 Port updated_upload_port = 1;
16}

golang API: method
github.com/arduino/arduino-cli/commands/upload.Upload
changed signature

The

Upload
method signature has been changed from:

1func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, errStream io.Writer) error { ... }

to:

1func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, errStream io.Writer) (*rpc.UploadResult, error) { ... }

Now an

UploadResult
structure is returned together with the error. If you are not interested in the information contained in the structure you can safely ignore it.

golang package
github.com/arduino/arduino-cli/inventory
removed from public API

The package

inventory
is no more a public golang API.

board list --watch
command JSON output has changed

board list --watch
command JSON output changed from:

1{
2 "type": "add",
3 "address": "COM3",
4 "label": "COM3",
5 "protocol": "serial",
6 "protocol_label": "Serial Port (USB)",
7 "hardwareId": "93B0245008567CB2",
8 "properties": {
9 "pid": "0x005E",
10 "serialNumber": "93B0245008567CB2",
11 "vid": "0x2341"
12 },
13 "boards": [
14 {
15 "name": "Arduino Nano RP2040 Connect",
16 "fqbn": "arduino:mbed_nano:nanorp2040connect"
17 }
18 ]
19}

to:

1{
2 "eventType": "add",
3 "matching_boards": [
4 {
5 "name": "Arduino Nano RP2040 Connect",
6 "fqbn": "arduino:mbed_nano:nanorp2040connect"
7 }
8 ],
9 "port": {
10 "address": "COM3",
11 "label": "COM3",
12 "protocol": "serial",
13 "protocol_label": "Serial Port (USB)",
14 "properties": {
15 "pid": "0x005E",
16 "serialNumber": "93B0245008567CB2",
17 "vid": "0x2341"
18 },
19 "hardware_id": "93B0245008567CB2"
20 }
21}

Updated sketch name specifications

Sketch name specifications have been updated to achieve cross-platform compatibility.

Existing sketch names violating the new constraint need to be updated.

golang API:
LoadSketch
function has been moved

The function

github.com/arduino/arduino-cli/commands.LoadSketch
has been moved to package
github.com/arduino/arduino-cli/commands/sketch.LoadSketch
. You must change the import accordingly.

0.33.0

gRPC
cc.arduino.cli.commands.v1.Compile
command now return expanded build_properties by default.

The gRPC

cc.arduino.cli.commands.v1.Compile
command now return expanded
build_properties
by default. If you want the unexpanded
build_properties
you must set to
true
the field
do_not_expand_build_properties
in the
CompileRequest
.

compile --show-properties
now return the expanded build properties.

The command

compile --show-properties
now returns the expanded build properties, with the variable placeholders replaced with their current value. If you need the unexpanded build properties you must change the command line to
compile --show-properties=unexpanded
.

Before:

1$ arduino-cli board details -b arduino:avr:uno --show-properties | grep ^tools.avrdude.path
2tools.avrdude.path={runtime.tools.avrdude.path}

Now:

1$ arduino-cli board details -b arduino:avr:uno --show-properties | grep ^tools.avrdude.path
2tools.avrdude.path=/home/megabug/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
3$ arduino-cli board details -b arduino:avr:uno --show-properties=unexpanded | grep ^tools.avrdude.path
4tools.avrdude.path={runtime.tools.avrdude.path}

0.32.2

golang API: method
github.com/arduino/arduino-cli/arduino/cores/Board.GetBuildProperties
changed signature

The method:

1func (b *Board) GetBuildProperties(userConfigs *properties.Map) (*properties.Map, error) { ... }

now requires a full

FQBN
object;

1func (b *Board) GetBuildProperties(fqbn *FQBN) (*properties.Map, error) { ... }

Existing code may be updated from:

1b.GetBuildProperties(fqbn.Configs)

to

1b.GetBuildProperties(fqbn)

0.32.0

arduino-cli
doesn't lookup anymore in the current directory for configuration file.

Configuration file lookup in current working directory and its parents is dropped. The command line flag

--config-file
must be specified to use an alternative configuration file from the one in the data directory.

Command
outdated
output change

For

text
format (default), the command prints now a single table for platforms and libraries instead of two separate tables.

Similarly, for JSON and YAML formats, the command prints now a single valid object, with

platform
and
libraries
top-level keys. For example, for JSON output:

1$ arduino-cli outdated --format json
2{
3 "platforms": [
4 {
5 "id": "arduino:avr",
6 "installed": "1.6.3",
7 "latest": "1.8.6",
8 "name": "Arduino AVR Boards",
9 ...
10 }
11 ],
12 "libraries": [
13 {
14 "library": {
15 "name": "USBHost",
16 "author": "Arduino",
17 "maintainer": "Arduino \u003cinfo@arduino.cc\u003e",
18 "category": "Device Control",
19 "version": "1.0.0",
20 ...
21 },
22 "release": {
23 "author": "Arduino",
24 "version": "1.0.5",
25 "maintainer": "Arduino \u003cinfo@arduino.cc\u003e",
26 "category": "Device Control",
27 ...
28 }
29 }
30 ]
31}

Command
compile
does not support
--vid-pid
flag anymore

It was a legacy and undocumented feature that is now useless. The corresponding field in gRPC

CompileRequest.vid_pid
has been removed as well.

golang API: method
github.com/arduino/arduino-cli/arduino/libraries/Library.LocationPriorityFor
removed

That method was outdated and must not be used.

golang API: method
github.com/arduino/arduino-cli/commands/core/GetPlatforms
renamed

The following method in

github.com/arduino/arduino-cli/commands/core
:

1func GetPlatforms(req *rpc.PlatformListRequest) ([]*rpc.Platform, error) { ... }

has been changed to:

1func PlatformList(req *rpc.PlatformListRequest) (*rpc.PlatformListResponse, error) { ... }

now it better follows the gRPC API interface. Old code like the following:

1platforms, _ := core.GetPlatforms(&rpc.PlatformListRequest{Instance: inst})
2for _, i := range platforms {
3 ...
4}

must be changed as follows:

1// Use PlatformList function instead of GetPlatforms
2platforms, _ := core.PlatformList(&rpc.PlatformListRequest{Instance: inst})
3// Access installed platforms through the .InstalledPlatforms field
4for _, i := range platforms.InstalledPlatforms {
5 ...
6}

0.31.0

Added
post_install
script support for tools

The

post_install
script now runs when a tool is correctly installed and the CLI is in "interactive" mode. This behavior can be configured.

golang API: methods in
github.com/arduino/arduino-cli/arduino/cores/packagemanager
changed signature

The following methods in

github.com/arduino/arduino-cli/arduino/cores/packagemanager
:

1func (pme *Explorer) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB) error { ... }
2func (pme *Explorer) RunPostInstallScript(platformRelease *cores.PlatformRelease) error { ... }

have changed.

InstallTool
requires the new
skipPostInstall
parameter, which must be set to
true
to skip the post install script.
RunPostInstallScript
does not require a
*cores.PlatformRelease
parameter but requires a
*paths.Path
parameter:

1func (pme *Explorer) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB, skipPostInstall bool) error {...}
2func (pme *Explorer) RunPostInstallScript(installDir *paths.Path) error { ... }

0.30.0

Sketch name validation

The sketch name submitted via the

sketch new
command of the CLI or the gRPC command
cc.arduino.cli.commands.v1.NewSketch
are now validated. The applied rules follow the sketch specifications.

Existing sketch names violating the new constraint need to be updated.

daemon
CLI command's
--ip
flag removal

The

daemon
CLI command no longer allows to set a custom ip for the gRPC communication. Currently there is not enough bandwith to support this feature. For this reason, the
--ip
flag has been removed.

board attach
CLI command changed behaviour

The

board attach
CLI command has changed behaviour: now it just pick whatever port and FQBN is passed as parameter and saves it in the
sketch.yaml
file, without any validity check or board autodetection.

The

sketch.json
file is now completely ignored.

cc.arduino.cli.commands.v1.BoardAttach
gRPC interface command removal

The

cc.arduino.cli.commands.v1.BoardAttach
gRPC command has been removed. This feature is no longer available through gRPC.

golang API: methods in
github.com/arduino/arduino-cli/commands/upload
changed return type

The following methods in

github.com/arduino/arduino-cli/commands/upload
:

1func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, errStream io.Writer) (*rpc.UploadResponse, error) { ... }
2func UsingProgrammer(ctx context.Context, req *rpc.UploadUsingProgrammerRequest, outStream io.Writer, errStream io.Writer) (*rpc.UploadUsingProgrammerResponse, error) { ... }

do not return anymore the response (because it's always empty):

1func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, errStream io.Writer) error { ... }
2func UsingProgrammer(ctx context.Context, req *rpc.UploadUsingProgrammerRequest, outStream io.Writer, errStream io.Writer) error { ... }

golang API: methods in
github.com/arduino/arduino-cli/commands/compile
changed signature

The following method in

github.com/arduino/arduino-cli/commands/compile
:

1func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream io.Writer, progressCB rpc.TaskProgressCB, debug bool) (r *rpc.CompileResponse, e error) { ... }

do not require the

debug
parameter anymore:

1func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream io.Writer, progressCB rpc.TaskProgressCB) (r *rpc.CompileResponse, e error) { ... }

golang API: package
github.com/arduino/arduino-cli/cli
is no more public

The package

cli
has been made internal. The code in this package is no more public API and can not be directly imported in other projects.

golang API change in
github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.LibrariesManager

The following

LibrariesManager.InstallPrerequisiteCheck
methods have changed prototype, from:

1func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesindex.Release, installLocation libraries.LibraryLocation) (*paths.Path, *libraries.Library, error) { ... }
2func (lm *LibrariesManager) InstallZipLib(ctx context.Context, archivePath string, overwrite bool) error { ... }

to

1func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesindex.Release, installLocation libraries.LibraryLocation) (*paths.Path, *libraries.Library, error) { ... }
2func (lm *LibrariesManager) InstallZipLib(ctx context.Context, archivePath *paths.Path, overwrite bool) error { ... }

InstallPrerequisiteCheck
now requires an explicit
name
and
version
instead of a
librariesindex.Release
, because it can now be used to check any library, not only the libraries available in the index. Also the return value has changed to a
LibraryInstallPlan
structure, it contains the same information as before (
TargetPath
and
ReplacedLib
) plus
Name
,
Version
, and an
UpToDate
boolean flag.

InstallZipLib
method
archivePath
is now a
paths.Path
instead of a
string
.

golang API change in
github.com/arduino/arduino-cli/rduino/cores/packagemanager.Explorer

The

packagemanager.Explorer
method
FindToolsRequiredForBoard
:

1func (pme *Explorer) FindToolsRequiredForBoard(board *cores.Board) ([]*cores.ToolRelease, error) { ... }

has been renamed to `FindToolsRequiredForBuild:

1func (pme *Explorer) FindToolsRequiredForBuild(platform, buildPlatform *cores.PlatformRelease) ([]*cores.ToolRelease, error) { ... }

moreover it now requires the

platform
and the
buildPlatform
(a.k.a. the referenced platform core used for the compile) instead of the
board
. Usually these two value are obtained from the
Explorer.ResolveFQBN(...)
method.

0.29.0

Removed gRPC API:
cc.arduino.cli.commands.v1.UpdateCoreLibrariesIndex
,
Outdated
, and
Upgrade

The following gRPC API have been removed:

  • cc.arduino.cli.commands.v1.UpdateCoreLibrariesIndex
    : you can use the already available gRPC methods
    UpdateIndex
    and
    UpdateLibrariesIndex
    to perform the same tasks.
  • cc.arduino.cli.commands.v1.Outdated
    : you can use the already available gRPC methods
    PlatformList
    and
    LibraryList
    to perform the same tasks.
  • cc.arduino.cli.commands.v1.Upgrade
    : you can use the already available gRPC methods
    PlatformUpgrade
    and
    LibraryUpgrade
    to perform the same tasks.

The golang API implementation of the same functions has been removed as well, so the following function are no more available:

1github.com/arduino/arduino-cli/commands.UpdateCoreLibrariesIndex(...)
2github.com/arduino/arduino-cli/commands/outdated.Outdated(...)
3github.com/arduino/arduino-cli/commands/upgrade.Upgrade(...)

you can use the following functions as a replacement to do the same tasks:

1github.com/arduino/arduino-cli/commands.UpdateLibrariesIndex(...)
2github.com/arduino/arduino-cli/commands.UpdateIndex(...)
3github.com/arduino/arduino-cli/commands/core.GetPlatforms(...)
4github.com/arduino/arduino-cli/commands/lib.LibraryList(...)
5github.com/arduino/arduino-cli/commands/lib.LibraryUpgrade(...)
6github.com/arduino/arduino-cli/commands/lib.LibraryUpgradeAll(...)
7github.com/arduino/arduino-cli/commands/core.PlatformUpgrade(...)

Changes in golang functions
github.com/arduino/arduino-cli/cli/instance.Init
and
InitWithProfile

The following functions:

1func Init(instance *rpc.Instance) []error { }
2func InitWithProfile(instance *rpc.Instance, profileName string, sketchPath *paths.Path) (*rpc.Profile, []error) { }

no longer return the errors array:

1func Init(instance *rpc.Instance) { }
2func InitWithProfile(instance *rpc.Instance, profileName string, sketchPath *paths.Path) *rpc.Profile { }

The errors are automatically sent to output via

feedback
package, as for the other
Init*
functions.

0.28.0

Breaking changes in libraries name handling

In the structure

github.com/arduino/arduino-cli/arduino/libraries.Library
the field:

  • RealName
    has been renamed to
    Name
  • Name
    has been renamed to
    DirName

Now

Name
is the name of the library as it appears in the
library.properties
file and
DirName
it's the name of the directory containing the library. The
DirName
is usually the name of the library with non-alphanumeric characters converted to underscore, but it could be actually anything since the directory where the library is installed can be freely renamed.

This change improves the overall code base naming coherence since all the structures involving libraries have the

Name
field that refers to the library name as it appears in the
library.properties
file.

gRPC message
cc.arduino.cli.commands.v1.Library
no longer has
real_name
field

You must use the

name
field instead.

Machine readable
lib list
output no longer has "real name" field

JSON

The

[*].library.real_name
field has been removed.

You must use the

[*].library.name
field instead.

YAML

The

[*].library.realname
field has been removed.

You must use the

[*].library.name
field instead.

github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.LibrariesManager.Install
removed parameter
installLocation

The method:

1func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path, installLocation libraries.LibraryLocation) error { ... }

no more needs the

installLocation
parameter:

1func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path) error { ... }

The install location is determined from the libPath.

github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.LibrariesManager.FindByReference
now returns a list of libraries.

The method:

1func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference, installLocation libraries.LibraryLocation) *libraries.Library { ... }

has been changed to:

1func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference, installLocation libraries.LibraryLocation) libraries.List { ... }

the method now returns all the libraries matching the criteria and not just the first one.

github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.LibraryAlternatives
removed

The structure

librariesmanager.LibraryAlternatives
has been removed. The
libraries.List
object can be used as a replacement.

Breaking changes in UpdateIndex API (both gRPC and go-lang)

The gRPC message

cc.arduino.cli.commands.v1.DownloadProgress
has been changed from:

1message DownloadProgress {
2 // URL of the download.
3 string url = 1;
4 // The file being downloaded.
5 string file = 2;
6 // Total size of the file being downloaded.
7 int64 total_size = 3;
8 // Size of the downloaded portion of the file.
9 int64 downloaded = 4;
10 // Whether the download is complete.
11 bool completed = 5;
12}

to

1message DownloadProgress {
2 oneof message {
3 DownloadProgressStart start = 1;
4 DownloadProgressUpdate update = 2;
5 DownloadProgressEnd end = 3;
6 }
7}
8
9message DownloadProgressStart {
10 // URL of the download.
11 string url = 1;
12 // The label to display on the progress bar.
13 string label = 2;
14}
15
16message DownloadProgressUpdate {
17 // Size of the downloaded portion of the file.
18 int64 downloaded = 1;
19 // Total size of the file being downloaded.
20 int64 total_size = 2;
21}
22
23message DownloadProgressEnd {
24 // True if the download is successful
25 bool success = 1;
26 // Info or error message, depending on the value of 'success'. Some examples:
27 // "File xxx already downloaded" or "Connection timeout"
28 string message = 2;
29}

The new message format allows a better handling of the progress update reports on downloads. Every download now will report a sequence of message as follows:

1DownloadProgressStart{url="https://...", label="Downloading package index..."}
2DownloadProgressUpdate{downloaded=0, total_size=103928}
3DownloadProgressUpdate{downloaded=29380, total_size=103928}
4DownloadProgressUpdate{downloaded=69540, total_size=103928}
5DownloadProgressEnd{success=true, message=""}

or if an error occurs:

1DownloadProgressStart{url="https://...", label="Downloading package index..."}
2DownloadProgressUpdate{downloaded=0, total_size=103928}
3DownloadProgressEnd{success=false, message="Server closed connection"}

or if the file is already cached:

1DownloadProgressStart{url="https://...", label="Downloading package index..."}
2DownloadProgressEnd{success=true, message="Index already downloaded"}

About the go-lang API the following functions in

github.com/arduino/arduino-cli/commands
:

1func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rpc.DownloadProgressCB) (*rpc.UpdateIndexResponse, error) { ... }

have changed their signature to:

1func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rpc.DownloadProgressCB, downloadResultCB rpc.DownloadResultCB) error { ... }

UpdateIndex
do not return anymore the latest
UpdateIndexResponse
(beacuse it was always empty).

0.27.0

Breaking changes in golang API
github.com/arduino/arduino-cli/arduino/cores/packagemanager.PackageManager

The

PackageManager
API has been heavily refactored to correctly handle multitasking and concurrency. Many fields in the PackageManager object are now private. All the
PackageManager
methods have been moved into other objects. In particular:

  • the methods that query the
    PackageManager
    without changing its internal state, have been moved into the new
    Explorer
    object
  • the methods that change the
    PackageManager
    internal state, have been moved into the new
    Builder
    object.

The

Builder
object must be used to create a new
PackageManager
. Previously the function
NewPackageManager
was used to get a clean
PackageManager
object and then use the
LoadHardware*
methods to build it. Now the function
NewBuilder
must be used to create a
Builder
, run the
LoadHardware*
methods to load platforms, and finally call the
Builder.Build()
method to obtain the final
PackageManager
.

Previously we did:

1pm := packagemanager.NewPackageManager(...)
2err = pm.LoadHardware()
3err = pm.LoadHardwareFromDirectories(...)
4err = pm.LoadHardwareFromDirectory(...)
5err = pm.LoadToolsFromPackageDir(...)
6err = pm.LoadToolsFromBundleDirectories(...)
7err = pm.LoadToolsFromBundleDirectory(...)
8pack = pm.GetOrCreatePackage("packagername")
9// ...use `pack` to tweak or load more hardware...
10err = pm.LoadPackageIndex(...)
11err = pm.LoadPackageIndexFromFile(...)
12err = pm.LoadHardwareForProfile(...)
13
14// ...use `pm` to implement business logic...

Now we must do:

1var pm *packagemanager.PackageManager
2
3{
4 pmb := packagemanager.Newbuilder(...)
5 err = pmb.LoadHardware()
6 err = pmb.LoadHardwareFromDirectories(...)
7 err = pmb.LoadHardwareFromDirectory(...)
8 err = pmb.LoadToolsFromPackageDir(...)
9 err = pmb.LoadToolsFromBundleDirectories(...)
10 err = pmb.LoadToolsFromBundleDirectory(...)
11 pack = pmb.GetOrCreatePackage("packagername")
12 // ...use `pack` to tweak or load more hardware...
13 err = pmb.LoadPackageIndex(...)
14 err = pmb.LoadPackageIndexFromFile(...)
15 err = pmb.LoadHardwareForProfile(...)
16 pm = pmb.Build()
17}
18
19// ...use `pm` to implement business logic...

It's not mandatory but highly recommended, to drop the

Builder
object once it has built the
PackageManager
(that's why in the example the
pmb
builder is created in a limited scope between braces).

To query the

PackagerManager
now it is required to obtain an
Explorer
object through the
PackageManager.NewExplorer()
method.

Previously we did:

1func DoStuff(pm *packagemanager.PackageManager, ...) {
2 // ...implement business logic through PackageManager methods...
3 ... := pm.Packages
4 ... := pm.CustomGlobalProperties
5 ... := pm.FindPlatform(...)
6 ... := pm.FindPlatformRelease(...)
7 ... := pm.FindPlatformReleaseDependencies(...)
8 ... := pm.DownloadToolRelease(...)
9 ... := pm.DownloadPlatformRelease(...)
10 ... := pm.IdentifyBoard(...)
11 ... := pm.DownloadAndInstallPlatformUpgrades(...)
12 ... := pm.DownloadAndInstallPlatformAndTools(...)
13 ... := pm.InstallPlatform(...)
14 ... := pm.InstallPlatformInDirectory(...)
15 ... := pm.RunPostInstallScript(...)
16 ... := pm.IsManagedPlatformRelease(...)
17 ... := pm.UninstallPlatform(...)
18 ... := pm.InstallTool(...)
19 ... := pm.IsManagedToolRelease(...)
20 ... := pm.UninstallTool(...)
21 ... := pm.IsToolRequired(...)
22 ... := pm.LoadDiscoveries(...)
23 ... := pm.GetProfile(...)
24 ... := pm.GetEnvVarsForSpawnedProcess(...)
25 ... := pm.DiscoveryManager(...)
26 ... := pm.FindPlatformReleaseProvidingBoardsWithVidPid(...)
27 ... := pm.FindBoardsWithVidPid(...)
28 ... := pm.FindBoardsWithID(...)
29 ... := pm.FindBoardWithFQBN(...)
30 ... := pm.ResolveFQBN(...)
31 ... := pm.Package(...)
32 ... := pm.GetInstalledPlatformRelease(...)
33 ... := pm.GetAllInstalledToolsReleases(...)
34 ... := pm.InstalledPlatformReleases(...)
35 ... := pm.InstalledBoards(...)
36 ... := pm.FindToolsRequiredFromPlatformRelease(...)
37 ... := pm.GetTool(...)
38 ... := pm.FindToolsRequiredForBoard(...)
39 ... := pm.FindToolDependency(...)
40 ... := pm.FindDiscoveryDependency(...)
41 ... := pm.FindMonitorDependency(...)
42}

Now we must obtain the

Explorer
object to access the same methods, moreover, we must call the
release
callback function once we complete the task:

1func DoStuff(pm *packagemanager.PackageManager, ...) {
2 pme, release := pm.NewExplorer()
3 defer release()
4
5 ... := pme.GetPackages()
6 ... := pme.GetCustomGlobalProperties()
7 ... := pme.FindPlatform(...)
8 ... := pme.FindPlatformRelease(...)
9 ... := pme.FindPlatformReleaseDependencies(...)
10 ... := pme.DownloadToolRelease(...)
11 ... := pme.DownloadPlatformRelease(...)
12 ... := pme.IdentifyBoard(...)
13 ... := pme.DownloadAndInstallPlatformUpgrades(...)
14 ... := pme.DownloadAndInstallPlatformAndTools(...)
15 ... := pme.InstallPlatform(...)
16 ... := pme.InstallPlatformInDirectory(...)
17 ... := pme.RunPostInstallScript(...)
18 ... := pme.IsManagedPlatformRelease(...)
19 ... := pme.UninstallPlatform(...)
20 ... := pme.InstallTool(...)
21 ... := pme.IsManagedToolRelease(...)
22 ... := pme.UninstallTool(...)
23 ... := pme.IsToolRequired(...)
24 ... := pme.LoadDiscoveries(...)
25 ... := pme.GetProfile(...)
26 ... := pme.GetEnvVarsForSpawnedProcess(...)
27 ... := pme.DiscoveryManager(...)
28 ... := pme.FindPlatformReleaseProvidingBoardsWithVidPid(...)
29 ... := pme.FindBoardsWithVidPid(...)
30 ... := pme.FindBoardsWithID(...)
31 ... := pme.FindBoardWithFQBN(...)
32 ... := pme.ResolveFQBN(...)
33 ... := pme.Package(...)
34 ... := pme.GetInstalledPlatformRelease(...)
35 ... := pme.GetAllInstalledToolsReleases(...)
36 ... := pme.InstalledPlatformReleases(...)
37 ... := pme.InstalledBoards(...)
38 ... := pme.FindToolsRequiredFromPlatformRelease(...)
39 ... := pme.GetTool(...)
40 ... := pme.FindToolsRequiredForBoard(...)
41 ... := pme.FindToolDependency(...)
42 ... := pme.FindDiscoveryDependency(...)
43 ... := pme.FindMonitorDependency(...)
44}

The

Explorer
object keeps a read-lock on the underlying
PackageManager
that must be released once the task is done by calling the
release
callback function. This ensures that no other task will change the status of the
PackageManager
while the current task is in progress.

The

PackageManager.Clean()
method has been removed and replaced by the methods:

  • PackageManager.NewBuilder() (*Builder, commit func())
  • Builder.BuildIntoExistingPackageManager(target *PackageManager)

Previously, to update a

PackageManager
instance we did:

1func Reload(pm *packagemanager.PackageManager) {
2 pm.Clear()
3 ... = pm.LoadHardware(...)
4 // ...other pm.Load* calls...
5}

now we have two options:

1func Reload(pm *packagemanager.PackageManager) {
2 // Create a new builder and build a package manager
3 pmb := packagemanager.NewBuilder(.../* config params */)
4 ... = pmb.LoadHardware(...)
5 // ...other pmb.Load* calls...
6
7 // apply the changes to the original pm
8 pmb.BuildIntoExistingPackageManager(pm)
9}

in this case, we create a new

Builder
with the given config params and once the package manager is built we apply the changes atomically with
BuildIntoExistingPackageManager
. This procedure may be even more simplified with:

1func Reload(pm *packagemanager.PackageManager) {
2 // Create a new builder using the same config params
3 // as the original package manager
4 pmb, commit := pm.NewBuilder()
5
6 // build the new package manager
7 ... = pmb.LoadHardware(...)
8 // ...other pmb.Load* calls...
9
10 // apply the changes to the original pm
11 commit()
12}

In this case, we don't even need to bother to provide the configuration parameters because they are taken from the previous

PackageManager
instance.

Some gRPC-mapped methods now accepts the gRPC request instead of the instance ID as parameter

The following methods in subpackages of

github.com/arduino/arduino-cli/commands/*
:

1func Watch(instanceID int32) (<-chan *rpc.BoardListWatchResponse, func(), error) { ... }
2func LibraryUpgradeAll(instanceID int32, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }
3func LibraryUpgrade(instanceID int32, libraryNames []string, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }

have been changed to:

1func Watch(req *rpc.BoardListWatchRequest) (<-chan *rpc.BoardListWatchResponse, func(), error) { ... }
2func LibraryUpgradeAll(req *rpc.LibraryUpgradeAllRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }
3func LibraryUpgrade(ctx context.Context, req *rpc.LibraryUpgradeRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }

The following methods in package

github.com/arduino/arduino-cli/commands

1func GetInstance(id int32) *CoreInstance { ... }
2func GetPackageManager(id int32) *packagemanager.PackageManager { ... }
3func GetLibraryManager(instanceID int32) *librariesmanager.LibrariesManager { ... }

have been changed to:

1func GetPackageManager(instance rpc.InstanceCommand) *packagemanager.PackageManager { ... } // Deprecated
2func GetPackageManagerExplorer(req rpc.InstanceCommand) (explorer *packagemanager.Explorer, release func()) { ... }
3func GetLibraryManager(req rpc.InstanceCommand) *librariesmanager.LibrariesManager { ... }

Old code passing the

instanceID
inside the gRPC request must be changed to pass directly the whole gRPC request, for example:

1eventsChan, closeWatcher, err := board.Watch(req.Instance.Id)

must be changed to:

1eventsChan, closeWatcher, err := board.Watch(req)

Removed detection of Arduino IDE bundling

Arduino CLI does not check anymore if it's bundled with the Arduino IDE 1.x. Previously this check allowed the Arduino CLI to automatically use the libraries and tools bundled in the Arduino IDE, now this is not supported anymore unless the configuration keys

directories.builtin.libraries
and
directories.builtin.tools
are set.

gRPC enumeration renamed enum value in
cc.arduino.cli.commands.v1.LibraryLocation

LIBRARY_LOCATION_IDE_BUILTIN
has been renamed to
LIBRARY_LOCATION_BUILTIN

go-lang API change in
LibraryManager

The following methods:

1func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesindex.Release) (*paths.Path, *libraries.Library, error) { ... }
2func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path) error { ... ]
3func (alts *LibraryAlternatives) FindVersion(version *semver.Version, installLocation libraries.LibraryLocation) *libraries.Library { ... }
4func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference) *libraries.Library { ... }

now requires a new parameter

LibraryLocation
:

1func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesindex.Release, installLocation libraries.LibraryLocation) (*paths.Path, *libraries.Library, error) { ... }
2func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path, installLocation libraries.LibraryLocation) error { ... ]
3func (alts *LibraryAlternatives) FindVersion(version *semver.Version, installLocation libraries.LibraryLocation) *libraries.Library { ... }
4+func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference, installLocation libraries.LibraryLocation) *libraries.Library { ... }

If you're not interested in specifying the

LibraryLocation
you can use
libraries.User
to refer to the user directory.

go-lang functions changes in
github.com/arduino/arduino-cli/configuration

  • github.com/arduino/arduino-cli/configuration.IsBundledInDesktopIDE
    function has been removed.
  • github.com/arduino/arduino-cli/configuration.BundleToolsDirectories
    has been renamed to
    BuiltinToolsDirectories
  • github.com/arduino/arduino-cli/configuration.IDEBundledLibrariesDir
    has been renamed to
    IDEBuiltinLibrariesDir

Removed
utils.FeedStreamTo
and
utils.ConsumeStreamFrom

github.com/arduino/arduino-cli/arduino/utils.FeedStreamTo
and
github.com/arduino/arduino-cli/arduino/utils.ConsumeStreamFrom
are now private. They are mainly used internally for gRPC stream handling and are not suitable to be public API.

0.26.0

github.com/arduino/arduino-cli/commands.DownloadToolRelease
, and
InstallToolRelease
functions have been removed

This functionality was duplicated and already available via

PackageManager
methods.

github.com/arduino/arduino-cli/commands.Outdated
and
Upgrade
functions have been moved

  • github.com/arduino/arduino-cli/commands.Outdated
    is now
    github.com/arduino/arduino-cli/commands/outdated.Outdated
  • github.com/arduino/arduino-cli/commands.Upgrade
    is now
    github.com/arduino/arduino-cli/commands/upgrade.Upgrade

Old code must change the imports accordingly.

github.com/arduino-cli/arduino/cores/packagemanager.PackageManager
methods and fields change

  • The

    PackageManager.Log
    and
    TempDir
    fields are now private.

  • The

    PackageManager.DownloadToolRelease
    method has no more the
    label
    parameter:

    1func (pm *PackageManager) DownloadToolRelease(tool *cores.ToolRelease, config *downloader.Config, label string, progressCB rpc.DownloadProgressCB) error {

    has been changed to:

    1func (pm *PackageManager) DownloadToolRelease(tool *cores.ToolRelease, config *downloader.Config, progressCB rpc.DownloadProgressCB) error {

    Old code should remove the

    label
    parameter.

  • The

    PackageManager.UninstallPlatform
    ,
    PackageManager.InstallTool
    , and
    PackageManager.UninstallTool
    methods now requires a
    github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1.TaskProgressCB

    1func (pm *PackageManager) UninstallPlatform(platformRelease *cores.PlatformRelease) error {
    2func (pm *PackageManager) InstallTool(toolRelease *cores.ToolRelease) error {
    3func (pm *PackageManager) UninstallTool(toolRelease *cores.ToolRelease) error {

    have been changed to:

    1func (pm *PackageManager) UninstallPlatform(platformRelease *cores.PlatformRelease, taskCB rpc.TaskProgressCB) error {
    2func (pm *PackageManager) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB) error {
    3func (pm *PackageManager) UninstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB) error {

    If you're not interested in getting the task events you can pass an empty callback function.

0.25.0

go-lang function
github.com/arduino/arduino-cli/arduino/utils.FeedStreamTo
has been changed

The function

FeedStreamTo
has been changed from:

1func FeedStreamTo(writer func(data []byte)) io.Writer

to

1func FeedStreamTo(writer func(data []byte)) (io.WriteCloser, context.Context)

The user must call the

Close
method on the returned
io.WriteClose
to correctly dispose the streaming channel. The context
Done()
method may be used to wait for the internal subroutines to complete.

0.24.0

The gRPC