CI changes include handling based on framework

There appears to be a bug with how includes are handled depending on which framework is selected when running CI commands. I am trying to setup my ant-arduino library for CI running mbed/zephyr/espidf etc. I know the code doesn’t build for those platforms but when running CI it can’t seem to find the project headers but when I build with arduino it finds the headers fine.

For example (on my develop branch)

export PLATFORMIO_CI_SRC=examples/Arduino/AntVersion/AntVersion.ino
platformio ci --lib="." --board=teensy31 --project-option='framework=arduino'

But the following fails

export PLATFORMIO_CI_SRC=examples/mbed/AntVersion/AntVersion.cpp
platformio ci --lib="." --board=teensy31 --project-option='framework=mbed'

Fails with

src/AntVersion.cpp:10:10: fatal error: ANT.h: No such file or directory

* Looking for ANT.h dependency? Check our library registry!
* CLI  > platformio lib search "header:ANT.h"
* Web  >

 #include "ANT.h"
compilation terminated.
*** [.pio/build/teensy31/src/AntVersion.o] Error 1

The header paths shouldn’t be affected by changing the framework, this is not limited to mbed

Also the extra args env var appears to be ignored when switching framework
export PLATFORMIO_CI_EXTRA_ARGS="--project-option='framework=mbed'"

Will still run the CI command with arduino

Turns out at some point the ci command started parsing to see if the build framework matched the library.json (for the local project) and would ignore or add the library based on that. So given that my library.json had only arduino in it therefore the build failed.

1 Like

I recommend to use platformio run for more advanced projects and do all configuration in platformio.ini.

Agreed but its a little annoying for doing local building testing with libraries as you need to incorporate code from the examples directory. Therefore in order for run to work you need to temporarily copy files to the src/ folder.

You can have PlatformIO-based projects in example folder and symlink your library to examples/pio-project1/lib/mylibrary.