Sourcing built-in libraries when not bundled w/ classic IDE is undocumented or unintended #1565
Labels
conclusion: resolved
Issue was resolved
priority: high
Resolution is a high priority
topic: code
Related to content of the project itself
topic: documentation
Related to documentation for the project
type: imperfection
Perceived defect in any part of project
During library discovery, Arduino CLI searches several locations, which are documented here. One of those locations can be the
libraries
subfolder of the Arduino IDE folder. The documented behavior:https://arduino.github.io/arduino-cli/dev/sketch-build-process/#location-priority
(Note this is referring to the classic Arduino IDE only. There is no special behavior when Arduino CLI is bundled with Arduino IDE 2.x)
Although that statement in the documentation is correct in regards to
arduino-cli lib list
, it turns outarduino-cli compile
uses a completely different mechanism:arduino-cli/commands/compile/compile.go
Lines 188 to 205 in bf4a784
The value of an internal data property from the classic Arduino IDE preferences file at
{directories.data}/preferences.txt
is used to define an additional libraries folder located at:Unlike the completely different mechanism used by
arduino-cli lib list
, the one used byarduino-cli compile
adds the IDE built-in libraries folder even if Arduino CLI is not located inside a classic Arduino IDE installation.Steps to reproduce
Generate the
preferences.txt
fileDemonstration of the use of the IDE built-in libraries by Arduino CLI
Note that, even though
lib list
doesn't consider the "Ethernet" library to be installed, and Arduino CLI is not bundled with the classic IDE installation, Arduino CLI still uses the classic IDE's built-in "Ethernet" library when compiling.Recommendations
Since Arduino IDE 2.x does not have libraries built-in to its installation, I think it is best to just remove this capability from Arduino CLI.
If it is to be kept, then it is essential for the following two things to be done:
arduino-cli compile
andarduino-cli lib list
. The list of libraries presented bylib list
must exactly match the list used by the dependency resolution system.Additional information
This also occurs when using Arduino IDE 2.x, meaning that compilations in Arduino IDE 2.x use libraries from any installation of the classic Arduino IDE you might happen to have on your system. Although that is very unexpected behavior, it may currently be mitigating the impact of Arduino IDE 2.x not having built-in libraries. However, the built-in library capability will be replaced via a different mechanism in Arduino IDE 2.x. So, if at all, this is only a temporary benefit.
The text was updated successfully, but these errors were encountered: