Closed
Description
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:
- Library has a line something similar to
requires=<other library's name>:<optional minimum version>
and/orrequiresIDE=<version>
in it's library.properties - User presses download but it does not have a required library installed, there is one installed but without library.properties or the library is outdated (with
requiresIDE
the IDE's version incompatibility is also warned about) - User is prompted to download or update all the required libraries
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.
Activity
carlosperate commentedon Apr 14, 2017
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.
s-celles commentedon Jan 3, 2019
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
https://www.reddit.com/r/cpp/comments/8t0ufu/what_is_a_good_package_manager_for_c/
http://pfultz2.com/blog/2017/10/27/universal-package-manager/
s-celles commentedon Jan 4, 2019
@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
per1234 commentedon Jan 4, 2019
They don't. There is a required version format, which includes semver, but also allows non-semver compliant version numbers.
From https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format
I think this is a programmatic definition of the requirement:
https://github.com/bugst/relaxed-semver
njlr commentedon Feb 4, 2019
Hi! 👋
One of the authors of Buckaroo here.
I had a look at the
library.json
format and I think it will be feasible to add native support for this in Buckaroo. From the looks of things, these libraries will build very cleanly! 👍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:
s-celles commentedon Feb 4, 2019
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
library_index.json
could (partially) help (to know where to download it)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
library.properties
a good idea? should we have a separate file (a YAML or a JSON file) to manage only dependencies?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 )
njlr commentedon Feb 4, 2019
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:
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
./buckaroo
and wires them together using Buck (Buck is a build system similar to Make, but more powerful). We could add Arduino as an additional back-end option.I saw in the IDE that packages are put into
./libraries
. However, usingino
at the command-line, libraries seem to go inside./lib
.Do you know how most users are building their Arduino projects?
Can you point to any large open-source Arduino projects that I can examine?
11 remaining items