Skip to content

Commit 7fb695c

Browse files
committed
Reinstate falsely reverted optimisations from spring-projects#3282
See this comment, clarifying the reviewer's misunderstanding : spring-projects#3282 (comment) This optimisation is necessary to avoid rebuilds due to ANTLR and Replacer regenerating and modifying sources which have already been generated and modified before identically.
1 parent 8eee9c5 commit 7fb695c

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

spring-data-jpa/pom.xml

+39-4
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,39 @@
318318
</executions>
319319
</plugin>
320320

321+
<plugin>
322+
<groupId>org.codehaus.mojo</groupId>
323+
<artifactId>build-helper-maven-plugin</artifactId>
324+
<executions>
325+
<!--
326+
To understand what this plugin execution does, please read
327+
https://www.mojohaus.org/build-helper-maven-plugin/usage.html#set-a-property-according-to-whether-target-files-are-up-to-date
328+
-->
329+
<execution>
330+
<id>set-antlr4-directory</id>
331+
<goals>
332+
<goal>uptodate-property</goal>
333+
</goals>
334+
<!-- Repeat default phase for clarity -->
335+
<phase>validate</phase>
336+
<configuration>
337+
<name>antlr4.dir</name>
338+
<value>antlr4-dummy</value>
339+
<else>antlr4</else>
340+
<fileSet>
341+
<directory>${project.basedir}/src/main/antlr4</directory>
342+
<outputDirectory>${project.build.directory}/generated-sources/antlr4</outputDirectory>
343+
<mapper>
344+
<type>glob</type>
345+
<from>*.g4</from>
346+
<to>*.interp</to>
347+
</mapper>
348+
</fileSet>
349+
</configuration>
350+
</execution>
351+
</executions>
352+
</plugin>
353+
321354
<plugin>
322355
<groupId>org.antlr</groupId>
323356
<artifactId>antlr4-maven-plugin</artifactId>
@@ -330,16 +363,17 @@
330363
<phase>generate-sources</phase>
331364
<configuration>
332365
<visitor>true</visitor>
333-
<sourceDirectory>${project.basedir}/src/main/antlr4</sourceDirectory>
366+
<!-- Set source dir explicitly, either to default or to dummy value, the latter yielding 0 hits -->
367+
<sourceDirectory>${project.basedir}/src/main/${antlr4.dir}</sourceDirectory>
334368
</configuration>
335369
</execution>
336370
</executions>
337371
</plugin>
338372

339373
<plugin>
340374
<groupId>com.google.code.maven-replacer-plugin</groupId>
341-
<artifactId>maven-replacer-plugin</artifactId>
342-
<version>1.4.1</version>
375+
<artifactId>replacer</artifactId>
376+
<version>1.5.3</version>
343377
<executions>
344378
<execution>
345379
<phase>process-sources</phase>
@@ -349,7 +383,8 @@
349383
<configuration>
350384
<basedir>${project.build.directory}/generated-sources</basedir>
351385
<includes>
352-
<include>antlr4/**/*.java</include>
386+
<!-- Replace tokens in real or dummy directory, the latter yielding 0 hits -->
387+
<include>${antlr4.dir}/**/*.java</include>
353388
</includes>
354389
<variableTokenValueMap>
355390
public class=class,public interface=interface

0 commit comments

Comments
 (0)