PlatformIO Community

Framework used by Native platform

I finally started to add some unit tests for a library I’m working on and had some trouble figuring out why pio test whould ignore my dependencies when using the Native platform. Turns out my dependency specified framework = "arduino" causing it to be rejected. Either setting lib_compat_mode = off in my project or changing the dependency config to framework = "*" fixed this problem but I am not a big fan of either solution.

This leaves me with the following question: What would be a framework to add for compatibility with the Native platform? I saw examples of setting board in conjunction with platform = native but never framework. Is there no such thing for the Native platform?

Setting lib_compat_mode = off only for the native environment used for unit tests seems to be the least invasive solution I can see but would only work with dependecies not really requiring a specific framework.
At least for the Arduino framework there seems to be a solution using ArduinoFake as recommended in this discussion:

Any thoughts or recommendations are certainly welcome :wink:

What happens when you declare the library’s platforms value to be compatible with native?

If my dependency’s library.json contains frameworks: "arduino", "platforms": "native" the LDF will reject that library unless I set lib_compat_mode = off for the environment used by pio test. Changing eighter the lib_compat_mode or frameworks works.

I think then there should be a special framework value standing for none or baremetal – I think because the projects using platform = native have no framework = .. line, technically the framework string is empty and fails to match a list of frameworks, except * of course. Please open an issue in Issues · platformio/platformio-core · GitHub for improvement.