You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ro...@apache.org on 2022/07/12 14:46:56 UTC

[activemq-artemis-native] 01/03: adjust steps so that the .h is always [re]generated before cmake runs in regular mvn builds

This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis-native.git

commit 75bd61d966d4617ed34fd61ffe9c6b03564b93ce
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Tue Jul 12 14:02:16 2022 +0100

    adjust steps so that the .h is always [re]generated before cmake runs in regular mvn builds
---
 pom.xml                                            | 39 ++++++++++++++--------
 .../artemis/nativo/jlibaio/LibaioContext.java      |  6 ++--
 2 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/pom.xml b/pom.xml
index 179f082..9a5691c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,7 +134,7 @@
                         <executions>
                             <execution>
                                 <id>build</id>
-                                <phase>generate-sources</phase>
+                                <phase>process-sources</phase>
                                 <goals>
                                     <goal>exec</goal>
                                 </goals>
@@ -158,7 +158,7 @@
                         <executions>
                             <execution>
                                 <id>build</id>
-                                <phase>generate-sources</phase>
+                                <phase>process-sources</phase>
                                 <goals>
                                     <goal>exec</goal>
                                 </goals>
@@ -182,7 +182,7 @@
                         <executions>
                             <execution>
                                 <id>build</id>
-                                <phase>generate-sources</phase>
+                                <phase>process-sources</phase>
                                 <goals>
                                     <goal>exec</goal>
                                 </goals>
@@ -259,16 +259,6 @@
     <build>
         <pluginManagement>
             <plugins>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-compiler-plugin</artifactId>
-                    <configuration>
-                        <compilerArgs>
-                            <arg>-h</arg>
-                            <arg>./src/main/c</arg>
-                        </compilerArgs>
-                    </configuration>
-                </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
@@ -410,6 +400,29 @@
                 <artifactId>maven-help-plugin</artifactId>
                 <version>2.2</version>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>default-compile</id>
+                        <!-- Running compilation at generate-sources stage instead, to also generate the .h file
+                             ahead of running the cmake build at process-sources phase, in the profiles above -->
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <configuration>
+                            <compilerArgs>
+                                <arg>-h</arg>
+                                <arg>./src/main/c</arg>
+                            </compilerArgs>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
diff --git a/src/main/java/org/apache/activemq/artemis/nativo/jlibaio/LibaioContext.java b/src/main/java/org/apache/activemq/artemis/nativo/jlibaio/LibaioContext.java
index 2e6d6fe..d776ea7 100644
--- a/src/main/java/org/apache/activemq/artemis/nativo/jlibaio/LibaioContext.java
+++ b/src/main/java/org/apache/activemq/artemis/nativo/jlibaio/LibaioContext.java
@@ -44,9 +44,11 @@ import org.slf4j.LoggerFactory;
  * <a href="https://ext4.wiki.kernel.org/index.php/Clarifying_Direct_IO's_Semantics">Interesting reading for this.</a>
  */
 public class LibaioContext<Callback extends SubmitInfo> implements Closeable {
-   /* Notice: After making changes to the native interface, you have to use mvn install at least once to generate the include file.
+   /* Notice: After making changes to the native interface, mvn 'generate-sources' must occur at least once to generate the updated include file.
       This is because the maven compiler plugin is the one generating org_apache_activemq_artemis_native_jlibaio_LibaioContext.h
-      So that file needs to be updated before Cmake comes along to compile the module. */
+      So that file needs to be updated before Cmake comes along to compile the module.
+      This normally happens as needed in the regular mvn build, so if you use e.g 'mvn clean install -Ppodman' then no extra step is needed,
+      specific attention is only required if you e.g run the build scripts directly yourself. */
 
    private static final Logger logger = LoggerFactory.getLogger(LibaioContext.class);