Is pio lib install based on platformio.ini or library.json?

I’m just learning to use PlatformIO, but i’m getting quite confused about the purpose of the files platformio.ini and 'library.json`

I have a large Arduino project which, up until now, I have been developing with Sloeber plugin on Eclipse, but as he stoppped development on that, im looking for an alternative solution.

The project consists of a significant number of private libraries, most of them forked from public ones, with my own additions. There are several dependencies with other private libraries, some toally new. There are 4 endproduct projects wihich make use of all those libraries.

Now what I don’t understand is the difference between declaring a dependency in platformio.ini using lib_deps, and declaring dependencies in library.json. What is used when i run pio lib install?
For the endproduct, which has no library.json it must be the platformio.ini … but what does the command use for the dependencies of the in lib_deps declared libraries?

It also occurs frequently that a library is included twice in the lib_deps folder, while all specifications of dependencies are equal in name and refernce to the git repository to get it from. even a standard librarie like StandardCplusplus is installed twice.

Can anybody shed some light on this?

Can you provide a sample/config where libraries are installed twice? Is it possible that it’s installed twice because of version dependency, not just library name dependency?

I would have thought that it was based on both. if the dependencies of a library were specified in the library.json provided with the library, you would only need to specify the library you’re interested in in your platformio.ini, as opposed to needing to specify the library AND it’s dependencies. And if they overlap, well, only one copy should be installed unless there is more than just a name dependency?

i.e. As a quick test, using a slighly modified version of the ESP Async Webserver example code, for which the library.json manifest specifies a dependency of the ESPAsyncTCP library on the ESP8266 platform… specifying the dependency manually in platformio.ini resulted in only one copy of the library dependency being installed (although it did install both dependencies, which was a bit stupid, since only one matched the platform).

I’ve found the cause of the duplicates, the same dependency was in some libraries specified as a url ending in .git and in some libraries specified with a url without git

1 Like

It seems you mean this issue