-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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: Library dependencies #5795
Comments
It would also be quite useful if a library could have an Arduino core dependency (ideally a list with all compatible Arduino cores), as some libraries might be processor-specific. |
Coming from #7567 (comment) What about using a dependency manager? There's currently: and probably more. They are more or less coupled to a build system. See also |
@Avamander specifying optionally minimum version may not be enough because if API of a library have some breaking changes you will also need to restrict library version with a maximum version to use latest previous major version We could need to specify for example:
But I'm wondering if all registered Arduino libraries uses semantic versioning. Because we need to be able to order version numbering without error / uncertainty. Related arduino/arduino-cli#105 |
They don't. There is a required version format, which includes semver, but also allows non-semver compliant version numbers.
I think this is a programmatic definition of the requirement: |
Hi! 👋 One of the authors of Buckaroo here. I had a look at the However, I could not see any dependency information in the library files that I found. Is the dependency information encoded anywhere? I am looking for something like:
|
Thanks @njlr for coming here to help us. I wonder if this kind of information shouldn't be available (first) in library.properties (or somewhere else). It's currently not the case. I think this file should contain dependencies for compiling a sketch ie you need for example LibraryXYZ latest registered version. But there is differents cases to manage. Is LibraryXYZ a "registered" library or not? If it's a registered library Version number restriction could also be required for installing some libraries (because sometimes, installing latest version of a library doesn't work because API of a library changed) Being able to install an (unregistered) library from a Git repository at a given commit, or a given branch should also be considered. I opened some days ago issues to manage this with arduino-cli
but the main problem here is to first define new data file to define dependencies. Is adding new fields to I don't really know where the Arduino team want to go with this but from my perspective I will use a separate human readable file for this (and I think that YAML file is great for this). We should be aware that some examples of a library could need more dependencies that a library itself so we should have a mechanism to override this config file for a given directory. (this problem is quite comparable to https://github.com/ianfixes/arduino_ci/issues/109 ) |
Hi @scls19fr thanks for the response.
By "registered" I assume you mean registered on https://www.arduinolibraries.info?
Buckaroo already works directly on GitHub (or any Git) repositories, so there are no issues there 👍
Buckaroo has a TOML file (similar benefits to YAML) to define this. Here is what it might look like: [[dependency]]
package = "github.com/bblanchon/ArduinoJson"
version = "6.8.0"
[[dependency]]
package = "github.com/arduino-libraries/ArduinoHttpClient"
version = "revision=b6424e430db57fa0c67f82333e80d58b1521a97b" Buckaroo supports sem-ver ranges, branches, tags and even commits. It will examine each dependency it finds and recursively fetch its dependencies, assuming there is a TOML file. The big question is how to integrate this with the Arduino workflow. Currently, Buckaroo puts dependencies into I saw in the IDE that packages are put into
|
By registered I mean that is available in library_index.json (sorry about my mistake of ArduinoJson https://github.com/bblanchon/ArduinoJson is a quite large open source project |
So For example: https://github.com/bblanchon/ArduinoJson/blob/0685a36f0e51ba71b96c441697e0432ed2a6b176/library.properties I see that the file does not contain any header or source-file lists. Does this mean that there is a convention about the layout of the files? |
This article https://www.arduino.cc/en/guide/libraries describes how libraries are installed and this one deals with creating Arduino lib https://www.arduino.cc/en/hacking/libraries You can also have a look at some wiki articles such as https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ Code is in a When a user wants to build a project he must ensure (manually) that all libraries are installed correctly (and with the correct version). I personally think the current situation can be problematic as the concept of environment doesn't exist arduino/arduino-cli#108 (but that's just my own opinion). |
This was added in #8600. |
yaaaaaaaaaaaay |
Good news but I'm wondering if dependencies version are taken into account. I only see
nothing about a possible version restriction of a library (see arduino/arduino-cli#105 ) |
This is being implemented, the general dependency-resolution (with version restrictions) requires a much more complex backtracking algorithm, for now we decided to deploy the "light" version of lib dependecy (that should cover 99% of the cases anyway). |
Great work, What must I do to describe the library dependencies in my library.properties file? |
Is there a possibility that in the future versions of Arduino IDE library could define it's dependencies thus making sure it will work.
Something like this:
requires=<other library's name>:<optional minimum version>
and/orrequiresIDE=<version>
in it's library.propertiesrequiresIDE
the IDE's version incompatibility is also warned about)This would definetly for example improve how people use libraries like RF24, RF24Network and RF24Mesh (I am sure there are more) making sure both the library and it's dependencies are up-to-date when any of those are downloaded.
The text was updated successfully, but these errors were encountered: