Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detects file additions/deletions for skipping
When you remove a file from the source tree, the modification checker doesn't take into account the removed file as an update. Because the file no longer exists, it doesn't have a modification date, and it will not count in determining whether the last generation was older than the modification in the sources. This commit detects source file modifications of the nature of additions and deletions by using a tracking file in the output folder (`.maven-processor-source-files.txt`). This file contains a list of all the files in the source folders, which is checked against the current list of source files. When the file doesn't exist or if the sets of files don't match, it is treated as a change. When they match exactly, the modification time check is still run. A sample run without additions/removals in the source files: ``` [DEBUG] (f) skipSourcesUnchanged = true [DEBUG] (f) sourceDirectory = /Users/dashorst/IdeaProjects/iridium/common/entities/src/main/java [DEBUG] -- end configuration -- [DEBUG] Source directory: /Users/dashorst/IdeaProjects/iridium/common/entities/target/generated-sources/apt added [DEBUG] processing source directory [/Users/dashorst/IdeaProjects/iridium/common/entities/src/main/java] [DEBUG] removed source files: [] [DEBUG] new source files: [] [DEBUG] max source file date: 1601210991895, max output date: 1601211873845 [INFO] no source file(s) change(s) detected! Processor task will be skipped ``` When a file was removed: ``` [DEBUG] (f) skipSourcesUnchanged = true [DEBUG] (f) sourceDirectory = /Users/dashorst/IdeaProjects/iridium/common/entities/src/main/java [DEBUG] -- end configuration -- [DEBUG] Source directory: /Users/dashorst/IdeaProjects/iridium/common/entities/target/generated-sources/apt added [DEBUG] processing source directory [/Users/dashorst/IdeaProjects/iridium/common/entities/src/main/java] [DEBUG] removed source files: [/Users/dashorst/IdeaProjects/iridium/common/entities/src/main/java/nl/topicus/platinum/entities/Afdeling.java] [DEBUG] new source files: [] [WARNING] No processors specified. Using default discovery mechanism. [DEBUG] javac option: -cp ``` When the file is re-added: ``` [DEBUG] (f) skipSourcesUnchanged = true [DEBUG] (f) sourceDirectory = /Users/dashorst/IdeaProjects/iridium/common/entities/src/main/java [DEBUG] -- end configuration -- [DEBUG] Source directory: /Users/dashorst/IdeaProjects/iridium/common/entities/target/generated-sources/apt added [DEBUG] processing source directory [/Users/dashorst/IdeaProjects/iridium/common/entities/src/main/java] [DEBUG] removed source files: [] [DEBUG] new source files: [/Users/dashorst/IdeaProjects/iridium/common/entities/src/main/java/nl/topicus/platinum/entities/Afdeling.java] [WARNING] No processors specified. Using default discovery mechanism. [DEBUG] javac option: -cp ``` Fixes #86
- Loading branch information