You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/09/08 20:23:20 UTC
[activemq-artemis-native] branch main updated: ARTEMIS-3966 Making CmakeList to verify if the .h is generated instead of calling mvn generate-sources
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis-native.git
The following commit(s) were added to refs/heads/main by this push:
new 3b4c38c ARTEMIS-3966 Making CmakeList to verify if the .h is generated instead of calling mvn generate-sources
3b4c38c is described below
commit 3b4c38c75b2bf478bfbee53210b6735f3559c537
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu Sep 8 15:41:21 2022 -0400
ARTEMIS-3966 Making CmakeList to verify if the .h is generated instead of calling mvn generate-sources
---
.../{compile-using-podman.sh => 64testPodman.sh} | 30 ++++++++++------------
scripts/compile-native.sh | 2 ++
scripts/compile-using-docker.sh | 4 +--
scripts/compile-using-podman.sh | 7 +++--
src/main/c/CMakeLists.txt | 14 +++++-----
5 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/scripts/compile-using-podman.sh b/scripts/64testPodman.sh
similarity index 58%
copy from scripts/compile-using-podman.sh
copy to scripts/64testPodman.sh
index cdd3ddb..02f46a7 100755
--- a/scripts/compile-using-podman.sh
+++ b/scripts/64testPodman.sh
@@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -16,25 +16,23 @@
# specific language governing permissions and limitations
# under the License.
-if [ -d "./target" ]; then
- if [ -d "./target/lib" ]; then
- rm -rf "./target/lib"
- fi
- mkdir "target/lib"
-else
- mkdir -p "target/lib"
-fi
+# This will generate a 64bit image for testing and start the shell
podman build -f src/main/docker/Dockerfile-centos -t artemis-native-builder .
+
+
+
if [[ $OSTYPE == 'darwin'* ]]; then
# for some reason the :Z is not working on mac
- podman run --rm -v $PWD/target/lib:/work/target/lib -v ~/.m2/repository/:/root/.m2/repository artemis-native-builder "$@"
+ podman run -it --rm -v $PWD/target/lib:/work/target/lib -v $HOME/.m2/repository/:/root/.m2/repository artemis-native-builder mvn test
else
- podman run --rm -v $PWD/target/lib:/work/target/lib:Z -v ~/.m2/repository/:/root/.m2/repository:Z artemis-native-builder "$@"
+ podman run -it --rm -v $PWD/target/lib:/work/target/lib:Z -v $HOME/.m2/repository/:/root/.m2/repository:Z artemis-native-builder mvn test
fi
-# to debug the image
-#podman run -it --rm -v $PWD/target/lib:/work/target/lib:Z artemis-native-builder "$@" bash
-chown -Rv $USER:$GID ./target/lib
-ls -liat ./target/lib
+
+
+# This is mapping your maven repository inside the image to avoid you downloading the internet again
+
+# you could use it this way
+#docker build -f src/main/docker/Dockerfile-centos -t artemis-native-builder . && docker run -it --rm -v $PWD/target/lib:/work/target/lib -v $HOME/.m2/repository/:/root/.m2/repository artemis-native-builder bash
diff --git a/scripts/compile-native.sh b/scripts/compile-native.sh
index d4f1602..bac9ff1 100755
--- a/scripts/compile-native.sh
+++ b/scripts/compile-native.sh
@@ -18,6 +18,8 @@
# This will compile both 32 and 64 bits version
+# Notice compile-native.sh is called by the Dockerfile-centos image, so we cannot call maven on this script
+
cmake -DCMAKE_VERBOSE_MAKEFILE=On -DCMAKE_USER_C_FLAGS="-m32" -DARTEMIS_CROSS_COMPILE=On -DARTEMIS_CROSS_COMPILE_ROOT_PATH=/usr/lib .
make
rm -rf CMakeCache.txt cmake_install.cmake
diff --git a/scripts/compile-using-docker.sh b/scripts/compile-using-docker.sh
index 17b6a5d..d77a38d 100755
--- a/scripts/compile-using-docker.sh
+++ b/scripts/compile-using-docker.sh
@@ -28,8 +28,8 @@ fi
mvn generate-sources
docker build -f src/main/docker/Dockerfile-centos -t artemis-native-builder .
-docker run --rm -v $PWD/target/lib:/work/target/lib -v ~/.m2/repository/:/root/.m2/repository artemis-native-builder "$@"
-#podman run --rm -v $PWD/target/lib:/work/target/lib:Z artemis-native-builder "$@"
+
+docker run --rm -v $PWD/target/lib:/work/target/lib artemis-native-builder "$@"
chown -Rv $USER:$GID ./target/lib
ls -liat ./target/lib
diff --git a/scripts/compile-using-podman.sh b/scripts/compile-using-podman.sh
index cdd3ddb..b575eda 100755
--- a/scripts/compile-using-podman.sh
+++ b/scripts/compile-using-podman.sh
@@ -25,12 +25,15 @@ else
mkdir -p "target/lib"
fi
+mvn generate-sources
+
podman build -f src/main/docker/Dockerfile-centos -t artemis-native-builder .
+
if [[ $OSTYPE == 'darwin'* ]]; then
# for some reason the :Z is not working on mac
- podman run --rm -v $PWD/target/lib:/work/target/lib -v ~/.m2/repository/:/root/.m2/repository artemis-native-builder "$@"
+ podman run --rm -v $PWD/target/lib:/work/target/lib artemis-native-builder "$@"
else
- podman run --rm -v $PWD/target/lib:/work/target/lib:Z -v ~/.m2/repository/:/root/.m2/repository:Z artemis-native-builder "$@"
+ podman run --rm -v $PWD/target/lib:/work/target/lib:Z artemis-native-builder "$@"
fi
# to debug the image
diff --git a/src/main/c/CMakeLists.txt b/src/main/c/CMakeLists.txt
index c512959..8907894 100644
--- a/src/main/c/CMakeLists.txt
+++ b/src/main/c/CMakeLists.txt
@@ -70,14 +70,12 @@ message(STATUS "Using the following libaio library for linking: ${LIBAIO_LIB}")
INCLUDE_DIRECTORIES(. ${JNI_INCLUDE_DIRS} ../../../target/include)
-ADD_CUSTOM_COMMAND(
- OUTPUT org_apache_activemq_artemis_nativo_jlibaio_LibaioContext.h
- COMMAND mvn generate-sources
- DEPENDS ../java/org/apache/activemq/artemis/nativo/jlibaio/LibaioContext.java
- WORKING_DIRECTORY ../../../
-)
-
-ADD_LIBRARY(artemis-native SHARED org_apache_activemq_artemis_nativo_jlibaio_LibaioContext.c org_apache_activemq_artemis_nativo_jlibaio_LibaioContext.h exception_helper.h)
+find_file(HAS_INCLUDE NAMES org_apache_activemq_artemis_nativo_jlibaio_LibaioContext.h PATHS ../../../target/include/)
+if(NOT HAS_INCLUDE)
+ message(FATAL_ERROR "please execute `mvn generate-sources` from the command line")
+endif()
+
+ADD_LIBRARY(artemis-native SHARED org_apache_activemq_artemis_nativo_jlibaio_LibaioContext.c exception_helper.h)
target_link_libraries(artemis-native ${LIBAIO_LIB})