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

Library manager: dependency resolver (take 2) #8600

Merged
merged 12 commits into from Jul 18, 2019

Conversation

5 participants
@cmaglie
Copy link
Member

commented Mar 4, 2019

Second attempt to solve #5795.
This PR updates #6004 and replace it.

The dependency tree is read from the library_index.json, downloaded from arduino.cc, this json is build from the information contained in the library.properties of each library so, to complete this PR, we should add a field in the library.properties to explicitly specify dependencies.
In this PR the dependent libraries are handled without versions constraints, this will be added in a future development.

The latest commit has been added for testing purposes and it will be removed before merging this PR: it disables the automatic download of library_index.json and reads the index from library_index_test.json, this way we can test this PR by providing a fake library_index_test.json.

This is the index that I used for testing: library_index_test.zip that contains a modified fake entry:

    {
      "name": "ArduinoCloud",
      "version": "1.0.0",
      "author": "Arduino",
      "maintainer": "Arduino \u003cinfo@arduino.cc\u003e",
      "sentence": "Easly connect your Arduino/Genuino board to the Arduino Cloud",
      "paragraph": "Easly connect your Arduino/Genuino board to the Arduino Cloud",
      "website": "https://github.com/arduino-libraries/ArduinoCloud",
      "category": "Communication",
      "architectures": [
        "*"
      ],
      "types": [
        "Arduino"
      ],
      "requires": [
        { "name": "WiFi101" },
        { "name": "ArduinoSound" }
      ],
      "url": "http://downloads.arduino.cc/libraries/github.com/arduino-libraries/ArduinoCloud-1.0.0.zip",
      "archiveFileName": "ArduinoCloud-1.0.0.zip",
      "size": 45097,
      "checksum": "SHA-256:679a73db1aa4825652882ff71d7a3fb4992f4f79b41cb4a0a6c5c912adbfa848"
    },

and this is the dialog that appears when we try to install "ArduinoCloud":

image

(of course ArduinoCloud doesn't need ArduinoSound, this is just for testing multiple dependencies)

This PR requires a change in the library indexer (to report requires field in library_index.json) that is begin done right now.

@sandeepmistry

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

This is looking good!

Screen Shot 2019-04-04 at 10 55 32 AM

However, the modal window appeared on the top left hand side, when testing this on macOS 10.14.4.

@facchinm facchinm added this to the Release 1.8.10 milestone Apr 18, 2019

@CornyjK

This comment has been minimized.

Copy link

commented Apr 21, 2019

@cmaglie
How this works in CLI? If I run arduino --install-library "DHT sensor library", will it install Adafruit Unified Sensor (I mean if config was set properly)?

cmaglie added some commits Jan 25, 2017

Lib installer: factored out method to perform lib installation
The new method will be used in next commits to handle installations
of multiple libraries.
This commit fix also minor bug in progress bar.
LibraryInstaller now autodetects if a library is being replaced
It's no more required to pass this information from outside,
just library that is being installed is now sufficient.
Now libraries are installed with all the dependencies
This is the base for the GUI that will be introduced in the
next commits.
When resolving dependencies consider installed contributions first
Consider a case where the user decides to install a library `A` that
depends on library `B` and `B` is not up-to-date (i.e. is installed a
version that is not the latest), then the user is asked to "install"
both libraries `A` and `B`, effectively upgrading `B`.

With this change the already installed library `B` is left untouched
and not displayed in the missing dependencies.

@cmaglie cmaglie force-pushed the cmaglie:lib-deps-dialog-2 branch from 1f727d3 to 4268ce9 Jul 15, 2019

@arduino arduino deleted a comment from ArduinoBot Jul 15, 2019

@arduino arduino deleted a comment from ArduinoBot Jul 17, 2019

@facchinm facchinm merged commit 1cacd79 into arduino:master Jul 18, 2019

1 check passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details

@facchinm facchinm deleted the cmaglie:lib-deps-dialog-2 branch Jul 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.