arduino-cli
arduino-cli copied to clipboard
Feature request - Allow additional location for libraries, for libraries under development.
Right now, libraries under development need to reside in the 'libraries' folder under the 'sketchbook' location.
This works well enough for initial development, but is problematic for continuing development. For example, I have a local fix in the 'Ethernet' library. If a new official version comes out, then merging the new version with the work in progress is difficult, since the IDE may stomp on the working copy I have. Instead, the merge should come through git and propagated to my machine that way. Essentially, having two entities trying to update the same location using entirely different means is a recipe for disaster.
If in-development libs could reside elsewhere, continuing development would be much easier. I envision:
- A new folder that is seached during the build process. Perhaps a message during build that in-development libs are being used.
- the IDE never updates libs in this location.
- It is of lower priority than the one in the sketchbook, ie the library manager version would need to be removed before the in-development version was used.
- As an 'advanced' feature, no need to make IDE UI changes - document it in the library development web pages.
With the arduino-cli
you can specify additional libraries folders or specify a path to a library when running the compile
command.
The --libraries
flag expects a path to a folder containing multiple libraries, much like the <sketchbook>/libraries
folder does.
Assume we have two libraries in these paths:
/home/user/workspace/libraries/WiFi101
/home/user/workspace/libraries/AudioZero
The --libraries
flag must be used like so:
arduino-cli compile -b arduino:avr:uno --libraries /home/user/workspace/libraries /path/to/MySketch
Instead the --library
flag expects a path to the root folder of a single library, so it must be used like so:
arduino-cli compile -b arduino:avr:uno --library /home/user/workspace/libraries/WiFi101 --library /home/user/workspace/libraries/AudioZero /path/to/MySketch
The library set with --library
gets top priority if there is another with an identical name.
There is more information in PR #1258.
There is a similar request at https://github.com/arduino/arduino-cli/issues/1257
However, this request is different in that the other is about supporting organization of libraries into arbitrary folder structures, which would be searched recursively during library discovery but not be an intentional factor in resolution priority. In this case, it would be a folder of a specific name which is given special treatment in terms of lib install
and dependency resolution.
Hi @MHotchin can we consider this solved using this trick?
Hi @MHotchin can we consider this solved using this trick?
It addresses the problem for command line users, but doesn't appear to help IDE users.
I'll leave it to you to decide if the IDE needs to be supported, and if you decide not, then close the issue.
Thanks! I'll close this one then since this is not strictly related to the CLI. Feel free to open a feature request in the Arduino IDE repository