This is an automated email from the ASF dual-hosted git repository.
gortiz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 51f0f70797 Simple (lazy) check to prevent recompilation of code.
(#13969)
51f0f70797 is described below
commit 51f0f70797089838600c89ddf56d29bc1f1e52d2
Author: Robert Scholte <[email protected]>
AuthorDate: Wed Sep 18 12:50:11 2024 +0200
Simple (lazy) check to prevent recompilation of code. (#13969)
Prevent recompilation of code due to fmpp-maven-plugin inefficiencies
---
pinot-common/pom.xml | 104 ++++++++++++++++++++++++++++-----------------------
1 file changed, 58 insertions(+), 46 deletions(-)
diff --git a/pinot-common/pom.xml b/pinot-common/pom.xml
index 5bd906b4ff..7cae5fd880 100644
--- a/pinot-common/pom.xml
+++ b/pinot-common/pom.xml
@@ -59,6 +59,16 @@
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
+ <configuration>
+ <checkStaleness>true</checkStaleness>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
@@ -73,50 +83,6 @@
</java>
</configuration>
</plugin>
-
- <!-- Following plugins and their configurations are used to generate the
custom Calcite's SQL parser -->
- <!-- Copy the templates present in the codegen directory to
${project.build.directory}/codegen -->
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-fmpp-resources</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
-
<outputDirectory>${project.build.directory}/codegen</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/codegen</directory>
- <filtering>false</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- "Plugs in" the Calcite's Parser.jj with the variables present in
config.fmpp. These contain the custom rules
- as well as the class to which the custom implementation will get
generated -->
- <plugin>
- <groupId>com.googlecode.fmpp-maven-plugin</groupId>
- <artifactId>fmpp-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-fmpp-sources</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <cfgFile>${project.build.directory}/codegen/config.fmpp</cfgFile>
-
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
-
<templateDirectory>${project.build.directory}/codegen/templates</templateDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
<!-- Creates a Java class for the custom parser from Parser.jj -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -129,13 +95,12 @@
<goal>javacc</goal>
</goals>
<configuration>
-
<sourceDirectory>${project.build.directory}/generated-sources/javacc</sourceDirectory>
+
<sourceDirectory>${project.build.directory}/generated-sources/fmpp/javacc</sourceDirectory>
<includes>
<include>Parser.jj</include>
</includes>
<lookAhead>2</lookAhead>
<isStatic>false</isStatic>
-
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
</configuration>
</execution>
</executions>
@@ -372,5 +337,52 @@
<shade.phase.prop>package</shade.phase.prop>
</properties>
</profile>
+ <profile>
+ <!-- The fmpp-maven-plugin doesn't care about unchanged (re)sources and
will always generate.
+ This causes the maven-compiler-plugin to detect changes and always
recompile the Java sources.
+
+ If there are changes in src/main/codegen, either enforcer activation of
this profile by using -Psqlparser or by
+ removing the generated-sources/fmpp directory
+
+ NOTICE: In Maven the profile activation is decided BEFORE plugin
execution.
+ When running clean+verify, the profile will not be activated (because
the file still exists),
+ clean will remove it and compiler-plugin will fail because of a
missing class.
+ Either run 'mvn clean && mvn verify' or 'mvn verify -Psqlparser'
+ -->
+ <id>sqlparser</id>
+ <activation>
+ <file>
+ <missing>target/generated-sources/fmpp/javacc/Parser.jj</missing>
+ </file>
+ </activation>
+ <build>
+ <plugins>
+ <!-- "Plugs in" the Calcite's Parser.jj with the variables present
in config.fmpp. These contain the custom rules
+ as well as the class to which the custom implementation will get
generated -->
+ <plugin>
+ <groupId>com.googlecode.fmpp-maven-plugin</groupId>
+ <artifactId>fmpp-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-fmpp-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <cfgFile>src/main/codegen/config.fmpp</cfgFile>
+
<templateDirectory>src/main/codegen/templates</templateDirectory>
+
<outputDirectory>${project.build.directory}/generated-sources/fmpp</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin> <!-- Enforce javacc-maven-plugin executions after
fmpp-maven-plugin -->
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]