Compile a specific file always

How can I define that a specific file will be always compiled, even if there is no build all command executed ?

make a new env:

[env:only_one_file_env]
build_src_filter = "+<the_file_to_compile_for_this_env.cpp>"`

then build it with pio run -e only_one_file_env

1 Like

Thank you for your answer, but it seems that this is not what I am looking for.
Let me explain it in more detail:

I have a project with several files and normally only these files are compiled which are modified.
Now I want one file to compile always, even it is not modified.
The reason behind is as follows:
I want to implement the compilation date and time into my program and use the DATE and TIME . But this will be only updated if the file is compiled again.

What can I do ?

best regards