PlatformIO Community

Upgrading My Library from pio v2 to v3 - CI and Structure


#1

I’m trying to upgrade my old library OpcServer from pio v2 to pio v3 and I’m not sure of the “correct” way to do some things.

I use travis-ci to test my builds, previously to test different platforms (atmelsam, espressif8266, and now adding espressif32). I was defining these in a platformio.ini file and then using:

platformio ci --lib="." --project-conf="platformio.ini"

However I’m not sure if I should instead be just using multiple commands and specifying the different configs to platformio ci instead like:

platformio ci --lib="." --board zero
platformio ci --lib="." --board nodemcuv2
… etc

I took a look at a few other libraries out there and I didn’t see anyone else using a platformio.ini file so I feel like I’m doing something wrong. Also keeping it in the project root folder is misleading as pio build will now fail in v3 due to missing setup() and loop() (since its just a library, although I think build used to work in v2?)

The other issue I had previously is the zero board requires some additional libraries (WiFi101 and Adafruit CC3000 Library) and I would have to manually ignore those libraries for the other platforms as just having them installed would cause the build to fail.

Do I include these dependent libraries in my library.json? Honestly I’m considering just removing support for zero from my build because I don’t even know who is using it (I just added it for completeness). Rather than having to deal with those libraries making it complicated.

Any guidance would be appreciated! :smiley: Thanks!


#2

It seems that you can change libLDFMode to chain+. In this case, PIO will correctly handle includes in your library. Please test it.


#3

Thanks @ivankravets, although playing around some more I think maybe I’m still doing something wrong.

I’ve noticed that if I use pio ci it actually builds fine regardless of the LDF mode. Also I didn’t notice ANY difference in the LDF mode when set via library.json. But I did test it by changing it using lib_ldf_mode via command line or in platformio.ini in my library. What does the libLDFMode value in library.json supposed to do?

Most of my issues are when I use pio run. Should I just not worry about pio run not working and only use pio ci to test my build?

Thanks!


#4

Please try this manifest