Skip to content

Commit

Permalink
Reinstate falsely reverted optimisations from spring-projects#3282
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kriegaex committed Dec 28, 2023
1 parent 8eee9c5 commit 7fb695c
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions spring-data-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,39 @@
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<!--
To understand what this plugin execution does, please read
https://www.mojohaus.org/build-helper-maven-plugin/usage.html#set-a-property-according-to-whether-target-files-are-up-to-date
-->
<execution>
<id>set-antlr4-directory</id>
<goals>
<goal>uptodate-property</goal>
</goals>
<!-- Repeat default phase for clarity -->
<phase>validate</phase>
<configuration>
<name>antlr4.dir</name>
<value>antlr4-dummy</value>
<else>antlr4</else>
<fileSet>
<directory>${project.basedir}/src/main/antlr4</directory>
<outputDirectory>${project.build.directory}/generated-sources/antlr4</outputDirectory>
<mapper>
<type>glob</type>
<from>*.g4</from>
<to>*.interp</to>
</mapper>
</fileSet>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
Expand All @@ -330,16 +363,17 @@
<phase>generate-sources</phase>
<configuration>
<visitor>true</visitor>
<sourceDirectory>${project.basedir}/src/main/antlr4</sourceDirectory>
<!-- Set source dir explicitly, either to default or to dummy value, the latter yielding 0 hits -->
<sourceDirectory>${project.basedir}/src/main/${antlr4.dir}</sourceDirectory>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.4.1</version>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>process-sources</phase>
Expand All @@ -349,7 +383,8 @@
<configuration>
<basedir>${project.build.directory}/generated-sources</basedir>
<includes>
<include>antlr4/**/*.java</include>
<!-- Replace tokens in real or dummy directory, the latter yielding 0 hits -->
<include>${antlr4.dir}/**/*.java</include>
</includes>
<variableTokenValueMap>
public class=class,public interface=interface
Expand Down

0 comments on commit 7fb695c

Please sign in to comment.