PlatformIO Community

Inheriting Environments

As environments multiply the platformio.ini file starts to feel a little bloated.

I assume that in the platformio.ini environments you can freely use field values from other environments by using, for example, framework = ${other.framework}. But is it also possible to inherit all the fields - an entire environment from another one, and then just apply changes within the new environment? An inherit = other property might do the trick.

If this isn’t possible now, then I suggest adding the capability. For future PlatformIO also consider making the platformio.ini file hierarchical, either in JSON or YML format, so that environments can simply be nested within other environments. That would be the most economical way to arrange it, and should not be too much harder to parse.

In the meantime, for the sake of making abstract (inherit-only) environments that don’t show up in the Tasks/Build menu, a hidden property would also be useful.

I think it’s on the way… in version 4.0 [env] will have both a global and local scope.

https://docs.platformio.org/en/latest/projectconf/section_env.html

1 Like