forked from jasder/antlr
isDependencyChanged: consider equal timestamps as out of date
Some systems have low-granularity timestamps, so that file modification dates are rounded to seconds. This causes false negatives when detecting if a grammar needs to be recompiled if it changes a second after producing its tokens. This likely only causes an issue for tests that frequently mutate files; real humans are unlikely to compile within 1s of changing a grammar. Still, this seems a cleaner solution that hacking the failing test to use force a different modification time, as there will almost never be false positives. This fixes the failing test after making the test correct.
This commit is contained in:
parent
b09e30c6ca
commit
a9dfca3666
|
@ -395,7 +395,7 @@ public class Antlr4Mojo extends AbstractMojo {
|
|||
String tokensFileName = grammarFile.getName().split("\\.")[0] + ".tokens";
|
||||
File outputFile = new File(outputDirectory, tokensFileName);
|
||||
if ( (! outputFile.exists()) ||
|
||||
outputFile.lastModified() < grammarFile.lastModified() ||
|
||||
outputFile.lastModified() <= grammarFile.lastModified() ||
|
||||
dependencies.isDependencyChanged(grammarFile)) {
|
||||
grammarFilesToProcess.add(grammarFile);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue