Skip to content
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

[breaking] Refactor initialization steps #1274

Merged
merged 22 commits into from
Jun 16, 2021
Merged

Conversation

silvanocerza
Copy link
Contributor

@silvanocerza silvanocerza commented Apr 23, 2021

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

A big refactoring of the initialization steps run by the CLI both when run "one shot" or in daemon mode.

  • What is the current behavior?

Currently the gRPC Init function that creates and initializes a new CoreInstance to handle platforms and libraries that are both installed and installable returns an error and fail completely if even just one installed platform or library fails to load for any reason.

This issue breaks completely the CLI or any gRPC consumer when the initialization step fails because no CoreInstance is created, thus preventing any other further operation.

  • What is the new behavior?

The Init gRPC function has now been split into two separate functions, Create to create a new CoreInstance and folders necessary to correctly execute the CLI, and Init that loads indexes, platforms and libraries.

The Create function will only fail if the creation of the necessary folders will fail, in any other case a valid CoreInstance is returned.

The Init function has been greatly improved, now failure to load a single platform or library doesn't completely stop the loading, but a message is sent to the client to notify the failure, the client will decide how to handle the error.

The CLI will print an error to the user whenever a platform or library fails to load but execution won't stop, it will only fail if the platform or library is needed to run successfully the command.

The Rescan gRPC function has been removed completely in favour of Init.

UpdateIndex and UpdateLibrariesIndex gRPC functions now don't implicitly reload the indexes, it has to be done explicitly with the Init function.

Yes. Further information to handle the breaking change can be found in the UPGRADING.md file.

  • Other information:

None.


See how to contribute

@silvanocerza silvanocerza added type: enhancement Proposed improvement status: in progress Work is in progress on this topic: gRPC labels Apr 23, 2021
@silvanocerza silvanocerza self-assigned this Apr 23, 2021
@silvanocerza silvanocerza requested a review from a team April 26, 2021 07:59
@silvanocerza silvanocerza marked this pull request as ready for review April 26, 2021 11:21
arduino/cores/packagemanager/loader.go Outdated Show resolved Hide resolved
commands/core/install.go Outdated Show resolved Hide resolved
@silvanocerza
Copy link
Contributor Author

Rebased after #1278 merge.

@silvanocerza silvanocerza force-pushed the scerza/init-refactoring branch from 9ef3eae to 95b2143 Compare May 11, 2021 08:02
@silvanocerza silvanocerza force-pushed the scerza/init-refactoring branch 2 times, most recently from 9a2178c to 12ee0a8 Compare June 7, 2021 13:38
@silvanocerza silvanocerza force-pushed the scerza/init-refactoring branch from f7fc5f5 to 1b057e4 Compare June 15, 2021 14:29
@silvanocerza silvanocerza force-pushed the scerza/init-refactoring branch from 1b057e4 to d84d4d9 Compare June 16, 2021 14:46
@silvanocerza silvanocerza force-pushed the scerza/init-refactoring branch from d84d4d9 to bee0970 Compare June 16, 2021 14:50
@silvanocerza silvanocerza merged commit a66fea9 into master Jun 16, 2021
@silvanocerza silvanocerza deleted the scerza/init-refactoring branch June 16, 2021 15:30
@per1234 per1234 added topic: code Related to content of the project itself and removed status: in progress Work is in progress on this labels May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants