arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.33k stars 374 forks source link

[breaking] gRPC `UpdateIndex` and `UpdateLibrariesIndex` improvements #2569

Closed cmaglie closed 6 months ago

cmaglie commented 6 months ago

Please check if the PR fulfills these requirements

See how to contribute

What kind of change does this PR introduce?

UpdateIndex and UpdateLibrariesIndex now have the update_if_older_than_secs field that prevents updating the index if it has already been updated. Also, the response is more explicit with oneof(..) clause, and the status of each update (in case of multiple index updates) is returned in the response.

The JSON output has been implemented for commands core update-index and lib update-index.

What is the current behavior?

$ arduino-cli lib update-index --format json
$ arduino-cli core update-index --additional-urls=file:///home/cmaglie/Workspace/arduino-cli/internal/integrationtest/testdata/test_index.json  --format json
$

What is the new behavior?

$ arduino-cli lib update-index --format json
{
  "libraries_index": {
    "index_url": "https://downloads.arduino.cc/libraries/library_index.tar.bz2",
    "status": "updated"
  }
}
$ arduino-cli core update-index --additional-urls=file:///home/cmaglie/Workspace/arduino-cli/internal/integrationtest/testdata/test_index.json  --format json
{
  "updated_indexes": [
    {
      "index_url": "https://downloads.arduino.cc/packages/package_index.tar.bz2",
      "status": "updated"
    },
    {
      "index_url": "file:///home/megabug/Workspace/arduino-cli/internal/integrationtest/testdata/test_index.json",
      "status": "skipped"
    }
  ]
}
$

Does this PR introduce a breaking change, and is titled accordingly?

Yes

Other information

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 74.66667% with 38 lines in your changes are missing coverage. Please review.

Project coverage is 69.58%. Comparing base (31e3288) to head (e92a812). Report is 1 commits behind head on master.

Files Patch % Lines
commands/instances.go 73.77% 14 Missing and 2 partials :warning:
commands/daemon/daemon.go 50.00% 11 Missing :warning:
internal/cli/lib/search.go 55.55% 2 Missing and 2 partials :warning:
internal/cli/core/search.go 75.00% 2 Missing and 1 partial :warning:
internal/cli/feedback/result/rpc.go 92.59% 2 Missing :warning:
internal/cli/lib/update_index.go 77.77% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2569 +/- ## ========================================== + Coverage 69.48% 69.58% +0.09% ========================================== Files 205 205 Lines 20204 20267 +63 ========================================== + Hits 14038 14102 +64 - Misses 5045 5049 +4 + Partials 1121 1116 -5 ``` | [Flag](https://app.codecov.io/gh/arduino/arduino-cli/pull/2569/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=arduino) | Coverage Δ | | |---|---|---| | [unit](https://app.codecov.io/gh/arduino/arduino-cli/pull/2569/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=arduino) | `69.58% <74.66%> (+0.09%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=arduino#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cmaglie commented 6 months ago

Related to #2565