Fighting with library search

I’m trying to use PIO in a certain way with my own library:

  • it’s registered on the site, with a released version
  • I have a newer development version on my disk
  • my project should use the newer version
  • the same project should use the released version when built by others

I’ve tried lib_extra_dirs, a file:///... path, and the PLATFORMIO_LIB_EXTRA_DIRS env var. All of them fail to load my latest local version (the project includes a header which is not in the release, and fails).

There is another complication: I’ve added an example in the library, which includes the library. My approach has been to include a symlink to ../../.. in the examples lib/ folder. It works, but when the LDF now tries to load my local version, it enters infinite recursion, leading to a huge nested lib tree in .piolibdeps/, even when excluding the examples/ folder in library.json in my local copy.

It looks like this is completely the wrong way to do it, but I can’t figure it out - how to I set up the following:

  • a library with examples, not just source files, but also complete ones, i.e. projects with platformio.ini in them, which use this “parent” library
  • it has a released version, available through the PIO registry
  • for development, my local copy is ahead of the release
  • on my system, a project using this library should grab the local version
  • it needs to see file changes, i.e. rebuild when a file in the library has been modified
  • and lastly, it should also on my setup work when off-line, i.e. without internet connection

I’m running on macOS, mostly using the command line, sometimes the Atom IDE. Any tips and pointers would be appreciated - it feels like the above scenarios should not be such a struggle, right?

1 Like