arduino-cli icon indicating copy to clipboard operation
arduino-cli copied to clipboard

Allow library dependencies to install from git and zip

Open framinlab opened this issue 2 years ago • 1 comments

Describe the request

arduino-cli supports installing libraries from the central repo, git URLs, and zip files. When creating a library, the library.properties file has a depends= field that only supports central repo libraries.

Easiest way would be to check each entry in a depends entry and see if it is a local or remote URL and whether it ends with a .zip or a .git ending, then use the same mechanism as arduino-cli to install them.

For example, in library.properties, it could look like:

...
depends=ArduinoHttpClient, https://github.com/myproj/myproj.git,./localpath/mylib.zip,ArduinoJson

Additionally, in the IDE Library Manager, allow support for both adding a .ZIP file (like the Include Library > Add .zip library menu, as well as entering remote github URL.

This will make the IDE feature-compatible with the CLI.

Describe the current behavior

Installing a library from github is not supported in the IDE even though it is in arduino-cli. The feature should also be supported in the depends field of library.properties.

Arduino IDE version

2.0.0-rc7

Operating system

macOS

Operating system version

Monterey 12.4

Additional context

Arduino CLI supports:

arduino-cli lib install {library-name} arduino-cli lib install --git-url https://github.com/mylibrary/mylibrary.git arduino-cli lib install --zip-path ./mylibrary/library.zip

Also, libraries.properties supports a depends= field that currently only accepts registered libraries, but not git-url or zip-path entries.

Issue checklist

  • [X] I searched for previous requests in the issue tracker
  • [X] I verified the feature was still missing when using the latest nightly build
  • [X] My request contains all necessary details

framinlab avatar Jun 16 '22 18:06 framinlab

Thanks for your request @framinlab.

I see you have mixed together two separate requests in this issue:

  • Support ZIP archive and Git repository URLs in the depends field of library.properties
  • Support installation of libraries from Git repository URLs in Arduino IDE 2.x

Since the primary focus of the issue was the first of the two, we will consider that to be the subject of this issue. As that work would need to be done in Arduino CLI, I have transferred the issue to the correct repository.

per1234 avatar Jun 16 '22 19:06 per1234

:wave: Thank you for the request. Unfortunately, after some digging, we decided to not implement the URLs inside the depends property. Mainly for the following reasons: Having a URL inside the depends makes it impossible to discover other dependencies of a second or a deeper level.

Example: Library1 depends on L2, which depends on L3, which depends on L4. It's impossible to know, upfront, all that chain. We have to figure it out step by step leading to a very slow resolution process. This can worsen in case we use remote URLs, having to make sequential HTTP requests. This essentially would kill the usefulness of our library_index.json.

We can definitely implement the IDE side of the second part of your feature request. Which if I'm not wrong is:

Support installation of libraries from Git repository URLs in Arduino IDE 2.x I'm opening an issue soon

alessio-perugini avatar Aug 30 '23 12:08 alessio-perugini