licenseheaders
licenseheaders copied to clipboard
Running this script as a pre build event causes recompilation of whole codebase
Brief Even if a file already contains right copyright header, the 'licenseheaders.py' script overrides file with the same content making build system treat this file as "changed" and recompile it again.
Details Suppose we have a C++ codebase where all files already have right copyright headers. After we apply a 'licenseheaders.py' script, the C++ build system will treat all C++ files as "changed" even if there were no changes introduced, which will lead to recompilation of whole code base. Because of that it is not practical to use the 'licenseheaders.py' script as a prebuild event.
Possible solution The algorithm to ensure that the script touches files only when it is needed:
- Write output to the temporary file
- If temporary file is different from the original (it means that the copyright header has been updated) replace the original file with the temporary one
Good point, thanks for reporting! (Never thought of this getting used as a prebuild-task :D ) It should be possible to do this without writing to a temporary file and comparing, as long as we assume that all files processed will fit into memory.