Build_src_filter not accumulative across common and specific envs

I am creating a library, but I like to have test cases in the source that are cancelled out when it is distributed and used as a library.

Common [env] and specific [env:target] promise that the common applies to any target.
But when using build_src_filter it does not accumulate.
The following arrangement shows the problem…

[env]
platform = *
build_src_filter = +<*> -<[0-9][0-9]*.cpp> ;should work as base for all targets?

[env:01memio]
platform = native
build_src_filter = +<01memio.cpp> ;does not work.

[env:02sort]
platform = native
build_src_filter = -<[0-9][0-9]*.cpp> +<02sort.cpp> ;does not work.

[env:03speed]
platform = native
build_src_filter = +<*> -<[0-9][0-9]*.cpp> +<03speed.cpp> ;works!

But inside [env] build_src_filter is being assigned to…

[env]
platform = *
build_src_filter = +<*> -<[0-9][0-9]*.cpp> +<03speed.cpp> ;works with env:03speed as target!

[env:03speed]
platform = native

It seems that build_src_filter does not accumulate across common and specific environments.
If it is a how it works, it is relevant to mention in the manual.
Or is this a bug?

Exactly. This is documented behavior.

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

You need to interpolate the values, e.g., as seen here.

1 Like

That explains it. Solved!
Thank you!