8000 [breaking] Updated gRPC Platform API by cmaglie · Pull Request #2357 · arduino/arduino-cli · GitHub
[go: up one dir, main page]

Skip to content

[breaking] Updated gRPC Platform API #2357

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 33 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
28f1f71
Updated gRPC Pltform API, regenerated API
cmaglie Oct 6, 2023
86b171d
Adapted cores.Platform and PlatformRelease to the new gRPC API
cmaglie Oct 16, 2023
2031172
Fixed search_test.go
cmaglie Oct 16, 2023
28cc496
Removed gRPC PlatformList command
cmaglie Oct 16, 2023
24a1dd3
Other adaptation of platform structures
cmaglie Oct 16, 2023
9d2fd89
Adapt arguuments completion to use PlatformSearch instead of Platform…
cmaglie Oct 16, 2023
c80d0ff
Adapt 'core list' to use PlatformSearch instead of PlatformList
cmaglie Oct 16, 2023
175a6d2
Adapt 'core upgrade' command to use PlatformSearch instead of Platfor…
cmaglie Oct 16, 2023
3b41351
Adapted some integration tests
cmaglie Oct 16, 2023
3c7bc1a
Fix integreation test
cmaglie Oct 9, 2023
0a055a6
apply changes to search vidpid
alessio-perugini Oct 10, 2023
f11b45d
Better handling of 'core list' results
cmaglie Oct 10, 2023
abe05fa
Better handling of 'core search' results
cmaglie Oct 10, 2023
7f3a6cb
Better handling of 'core outdated' results
cmaglie Oct 10, 2023
aca91e6
add 'orderedmap' data structure
alessio-perugini Oct 10, 2023
b8ae4f3
Made orderedmap more generic
cmaglie Oct 11, 2023
8c98f74
fix regression on 'ParseReference'
alessio-perugini Oct 11, 2023
6a6897b
wip: fix 'core' integrationtests
alessio-perugini Oct 11, 2023
7ad2ca4
wip: fix 'core' sorting tests
alessio-perugini Oct 11, 2023
cccf397
fix regression which skipped mannually instaled core in core list
alessio-perugini Oct 12, 2023
8b8ce96
wip: add more 'core' integration tests
alessio-perugini Oct 12, 2023
3cee33b
regression: all flag takes precedence above updatable in core list
alessio-perugini Oct 12, 2023
064f57f
lint: ignore unexported-return (revive)
alessio-perugini Oct 12, 2023
ea0854e
license: regenerate and add missin headers
alessio-perugini Oct 12, 2023
64a2631
tests: fix 'board' integrations
alessio-perugini Oct 12, 2023
d010385
fix: regression not showing manually installed platform in 'core list'
alessio-perugini Oct 12, 2023
1d4b9e2
wip: add test to orderedmap
alessio-perugini Oct 12, 2023
87ea190
add more orderdmap tests
alessio-perugini Oct 13, 2023
655a5af
orderdmap: add json tests
alessio-perugini Oct 13, 2023
5fd313c
update DOCS
alessio-perugini Oct 13, 2023
d9dd825
apply CR suggestions
alessio-perugini Oct 16, 2023
494e923
fix proto numeration
alessio-perugini Oct 19, 2023
8528612
docs: update to release 0.36.0
alessio-perugini Oct 19, 2023
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
Prev Previous commit
Next Next commit
update DOCS
  • Loading branch information
alessio-perugini committed Oct 23, 2023
commit 5fd313c49c70a37aa52ad5293feb4ddb4ba67084
160 changes: 160 additions & 0 deletions docs/UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,166 @@ Here you can find a list of migration guides to handle breaking changes between

## v0.35.0

### CLI `core list` and `core search` changed JSON output.

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

```json
[
{
"id": "arduino:avr",
"maintainer": "Arduino",
"website": "http://www.arduino.cc/",
"email": "packages@arduino.cc",
"indexed": true,
"manually_installed": true,
"deprecated": true,
"releases": {
"1.6.2": {
"name": "Arduino AVR Boards",
"version": "1.6.2",
"type": [
"Arduino"
],
"installed": true,
"boards": [
{
"name": "Arduino Robot Motor"
}
],
"help": {
"online": "http://www.arduino.cc/en/Reference/HomePage"
},
"missing_metadata": true,
"deprecated": true
},
"1.8.3": { ... }
},
"installed_version": "1.6.2",
"latest_version": "1.8.3"
}
]
```

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

```protobuf
message PlatformSearchResponse {
// Results of the search.
repeated PlatformSummary search_output = 1;
}

// PlatformSummary is a structure containing all the information about
// a platform and all its available releases.
message PlatformSummary {
// Generic information about a platform
PlatformMetadata metadata = 1;
// Maps version to the corresponding PlatformRelease
map<string, PlatformRelease> releases = 2;
// The installed version of the platform, or empty string if none installed
string installed_version = 3;
// The latest available version of the platform, or empty if none available
string latest_version = 4;
}
```

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:

```protobuf
// Platform is a structure containing all the information about a single
// platform release.
message Platform {
// Generic information about a platform
PlatformMetadata metadata = 1;
// Information about a specific release of a platform
PlatformRelease release = 2;
}

// PlatformMetadata contains generic information about a platform (not
// correlated to a specific release).
message PlatformMetadata {
// Platform ID (e.g., `arduino:avr`).
string id = 1;
// Maintainer of the platform's package.
string maintainer = 2;
// A URL provided by the author of the platform's package, intended to point
// to their website.
string website = 3;
// Email of the maintainer of the platform's package.
string email = 4;
// If true this Platform has been installed manually in the user' sketchbook
// hardware folder
bool manually_installed = 5;
// True if the latest release of this Platform has been deprecated
bool deprecated = 6;
// If true the platform is indexed
bool indexed = 7;
}

// PlatformRelease contains information about a specific release of a platform.
message PlatformRelease {
// Name used to identify the platform to humans (e.g., "Arduino AVR Boards").
string name = 1;
// Version of the platform release
string version = 5;
// Type of the platform.
repeated string type = 6;
// True if the platform is installed
bool installed = 7;
// List of boards provided by the platform. If the platform is installed,
// this is the boards listed in the platform's boards.txt. If the platform is
// not installed, this is an arbitrary list of board names provided by the
// platform author for display and may not match boards.txt.
repeated Board boards = 8;
// A URL provided by the author of the platform's package, intended to point
// to their online help service.
HelpResources help = 9;
// This field is true when the platform is installed with the Arduino IDE 1.8.
// If the platform is also not indexed it may fail to work correctly in some
// circumstances, and it may need to be re-installed.
bool missing_metadata = 10;
// True this release is deprecated
bool deprecated = 11;
}
```

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.

### CLI `debug --info` changed JSON output.

The string field `server_configuration.script` is now an array and has been renamed `scripts`, here an example:
Expand Down
13 changes: 8 additions & 5 deletions rpc/cc/arduino/cli/commands/v1/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions rpc/cc/arduino/cli/commands/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ message Programmer {
// Platform is a structure containing all the information about a single
// platform release.
message Platform {
// Generic information about a platform
PlatformMetadata metadata = 1;
// Information about a specific release of a platform
PlatformRelease release = 2;
}

// PlatformSummary is a structure containing all the information about
// a platform and all its available releases.
message PlatformSummary {
// Generic information about a platform
PlatformMetadata metadata = 1;
// Maps version to the corresponding PlatformRelease
map<string, PlatformRelease> releases = 2;
Expand All @@ -94,14 +97,14 @@ message PlatformSummary {
// correlated to a specific release).
message PlatformMetadata {
// Platform ID (e.g., `arduino:avr`).
string id = 1; // package + architecture
string id = 1;
// Maintainer of the platform's package.
string maintainer = 2; // from parent-package
string maintainer = 2;
// A URL provided by the author of the platform's package, intended to point
// to their website.
string website = 3; // from parent-package
string website = 3;
// Email of the maintainer of the platform's package.
string email = 4; // from parent-package
string email = 4;
// If true this Platform has been installed manually in the user' sketchbook
// hardware folder
bool manually_installed = 5;
Expand Down
0