You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2017/04/13 19:38:06 UTC

celix git commit: CELIX-408: Adds some needed linking setup for OSX. Refactors runtime scripts to use indexed bash array instead of associative bash arrays.

Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-408_runtime 4b723e44d -> ac4babf33


CELIX-408: Adds some needed linking setup for OSX. Refactors runtime scripts to use indexed bash array instead of associative bash arrays.

- Associative bash array are support from bash v4, OSX Sierra still default uses bash v3


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/ac4babf3
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/ac4babf3
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/ac4babf3

Branch: refs/heads/feature/CELIX-408_runtime
Commit: ac4babf337c5f260cd7517a6a9884b0ae18f5b93
Parents: 4b723e4
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Apr 13 21:41:25 2017 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Apr 13 21:41:25 2017 +0200

----------------------------------------------------------------------
 cmake/cmake_celix/Runtimes.cmake       | 16 +++++++++++-----
 cmake/cmake_celix/runtime_common.sh.in | 21 +++++++++++----------
 cmake/cmake_celix/runtime_start.sh.in  |  3 ++-
 cmake/cmake_celix/runtime_stop.sh.in   |  2 +-
 pubsub/CMakeLists.txt                  |  2 +-
 pubsub/test/CMakeLists.txt             |  8 ++++++++
 6 files changed, 34 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/ac4babf3/cmake/cmake_celix/Runtimes.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Runtimes.cmake b/cmake/cmake_celix/Runtimes.cmake
index a4e3ae5..cdb36c1 100644
--- a/cmake/cmake_celix/Runtimes.cmake
+++ b/cmake/cmake_celix/Runtimes.cmake
@@ -49,6 +49,7 @@ function(add_runtime)
     set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_LOCATION" "${RUNTIME_LOCATION}") #The runtime workdir
     set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_USE_TERM" "${RUNTIME_USE_TERM}") #Wether or not the use terminal
     set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_LOG_TO_FILES" "${RUNTIME_LOG_TO_FILES}") #log to files or std out/err
+    set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_NEXT_DEPLOYMENT_ID" "0") #used for indexes int he bash scripts
 
     #wait for deployment, e.g. the one that control the lifecycle of the runtime.
     set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_WAIT_FOR_DEPLOYMENT" "")
@@ -123,8 +124,12 @@ function(runtime_deployments)
 
     get_target_property(DEPLOYMENTS ${RUNTIME_NAME} "RUNTIME_DEPLOYMENTS")
     foreach(DEPLOYMENT IN ITEMS ${ARGN})
-        list(APPEND DEPLOYMENTS "DEPLOYMENTS[$<TARGET_PROPERTY:${DEPLOYMENT},DEPLOY_NAME>]=\"$<TARGET_PROPERTY:${DEPLOYMENT},DEPLOY_LOCATION>\"")
-	    #list(APPEND DEPLOYMENTS "$<TARGET_PROPERTY:${DEPLOYMENT},DEPLOY_LOCATION>")
+        get_target_property(DEP_ID ${RUNTIME_NAME} "RUNTIME_NEXT_DEPLOYMENT_ID")
+        math(EXPR DEP_ID "${DEP_ID}+1")
+        set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_DEPLOYMENT_${DEPLOYMENT}_ID" "${DEP_ID}")
+        list(APPEND DEPLOYMENTS "DEPLOYMENT_NAMES[${DEP_ID}]=\"$<TARGET_PROPERTY:${DEPLOYMENT},DEPLOY_NAME>\"")
+        list(APPEND DEPLOYMENTS "DEPLOYMENT_DIRS[${DEP_ID}]=\"$<TARGET_PROPERTY:${DEPLOYMENT},DEPLOY_LOCATION>\"")
+        set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_NEXT_DEPLOYMENT_ID" "${DEP_ID}")
    endforeach()
 
    set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_DEPLOYMENTS" "${DEPLOYMENTS}")
@@ -174,9 +179,10 @@ function(runtime_arguments)
     if (${ARG_LENGTH} GREATER 1)
         foreach(I RANGE 1 ${ARG_LENGTH} 2)
             math(EXPR IMINUS "${I}-1")
-            list(GET ARGN ${IMINUS} ARG_NAME)
-            list(GET ARGN ${I} ARG_VAL)
-            list(APPEND ARGUMENTS "ARGUMENTS[$<TARGET_PROPERTY:${ARG_NAME},DEPLOY_NAME>]=\"${ARG_VAL}\"")
+            list(GET ARGN ${IMINUS} DEPLOY_NAME)
+            list(GET ARGN ${I} DEPLOY_ARGS)
+            get_target_property(TEST ${RUNTIME_NAME} "RUNTIME_DEPLOYMENT_${DEPLOY_NAME}_ID")
+            list(APPEND ARGUMENTS "DEPLOYMENT_ARGUMENTS[$<TARGET_PROPERTY:${RUNTIME_NAME},RUNTIME_DEPLOYMENT_${DEPLOY_NAME}_ID>]=\"${DEPLOY_ARGS}\"")
         endforeach()
     endif ()
     set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_ARGUMENTS" "${ARGUMENTS}")

http://git-wip-us.apache.org/repos/asf/celix/blob/ac4babf3/cmake/cmake_celix/runtime_common.sh.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/runtime_common.sh.in b/cmake/cmake_celix/runtime_common.sh.in
index 9dce713..1a0121c 100644
--- a/cmake/cmake_celix/runtime_common.sh.in
+++ b/cmake/cmake_celix/runtime_common.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 #Locations
 BUILD_DIR="${BUILD_DIR:-@PROJECT_BINARY_DIR@}"
@@ -9,14 +9,14 @@ DEPLOY_DIR="${DEPLOY_DIR:-${BUILD_DIR}/deploy}"
 RUNTIME_NAME="${RUNTIME_NAME:-$<TARGET_PROPERTY:@RUNTIME_TARGET_NAME@,RUNTIME_NAME>}"
 RUNTIME_GROUP="${RUNTIME_NAME:-$<TARGET_PROPERTY:@RUNTIME_TARGET_NAME@,RUNTIME_GROUP>}"
 
-#deployments & commands
+#commands
 COMMANDS=${COMMANDS:-"$<JOIN:$<TARGET_PROPERTY:@RUNTIME_TARGET_NAME@,RUNTIME_COMMANDS>, >"}
 
-declare -A DEPLOYMENTS
+#deployments
 $<JOIN:$<TARGET_PROPERTY:@RUNTIME_TARGET_NAME@,RUNTIME_DEPLOYMENTS>,
 >
 
-declare -A ARGUMENTS
+#deployment arguments
 $<JOIN:$<TARGET_PROPERTY:@RUNTIME_TARGET_NAME@,RUNTIME_ARGUMENTS>,
 >
 
@@ -50,9 +50,9 @@ function rt_start_all() {
     echo ""
     echo ""
     echo "********** Starting runtime ${RUNTIME_NAME} **********"
-    for DEPLOYMENT in "${!DEPLOYMENTS[@]}"
+    for DEPLOYMENT_INDEX in "${!DEPLOYMENT_NAMES[@]}"
     do
-        rt_run_deployment ${DEPLOYMENT}
+        rt_run_deployment ${DEPLOYMENT_INDEX}
     done
 
     for CMD in ${COMMANDS}; do
@@ -75,9 +75,10 @@ function rt_stop() {
 }
 
 function rt_run_deployment() {
-    DEPLOYMENT=$1
-    DEPLOYMENT_DIR=${DEPLOYMENTS[${DEPLOYMENT}]}
-    ARGS=${ARGUMENTS[${DEPLOYMENT}]}
+    INDEX=$1
+    DEPLOYMENT=${DEPLOYMENT_NAMES[${INDEX}]}
+    DEPLOYMENT_DIR=${DEPLOYMENT_DIRS[${INDEX}]}
+    ARGS=${DEPLOYMENT_ARGUMENTS[${INDEX}]}
     LOG_FILE="${RUNTIME_DIR}/logs/${DEPLOYMENT}.log"
     echo ""
     echo "Starting deployment ${DEPLOYMENT}"
@@ -204,4 +205,4 @@ elif [ -e "${RUNTIME_DIR}/${RELEASE_SH}" ] ; then #release file in runtime dir
     source ${RUNTIME_DIR}/${RELEASE_SH}
 elif [ -e "${BUILD_DIR}/${RELEASE_SH}" ] ; then #release file in build dir
     source ${BUILD_DIR}/${RELEASE_SH}
-fi
\ No newline at end of file
+fi

http://git-wip-us.apache.org/repos/asf/celix/blob/ac4babf3/cmake/cmake_celix/runtime_start.sh.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/runtime_start.sh.in b/cmake/cmake_celix/runtime_start.sh.in
index a6524de..d3c1774 100644
--- a/cmake/cmake_celix/runtime_start.sh.in
+++ b/cmake/cmake_celix/runtime_start.sh.in
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
 source $<TARGET_PROPERTY:@RUNTIME_TARGET_NAME@,RUNTIME_LOCATION>/common.sh
 
 rt_init

http://git-wip-us.apache.org/repos/asf/celix/blob/ac4babf3/cmake/cmake_celix/runtime_stop.sh.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/runtime_stop.sh.in b/cmake/cmake_celix/runtime_stop.sh.in
index fd7338e..b0db1e6 100644
--- a/cmake/cmake_celix/runtime_stop.sh.in
+++ b/cmake/cmake_celix/runtime_stop.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 source $<TARGET_PROPERTY:@RUNTIME_TARGET_NAME@,RUNTIME_LOCATION>/common.sh
 

http://git-wip-us.apache.org/repos/asf/celix/blob/ac4babf3/pubsub/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/pubsub/CMakeLists.txt b/pubsub/CMakeLists.txt
index e6ab850..1265bbf 100644
--- a/pubsub/CMakeLists.txt
+++ b/pubsub/CMakeLists.txt
@@ -39,7 +39,7 @@ if (PUBSUB)
 
 
 	if (ENABLE_TESTING)
-		option(BUILD_PUBSUB_TESTS "Enable Tests for PUBSUB" ON)
+        option(BUILD_PUBSUB_TESTS "Enable Tests for PUBSUB" OFF)
 	endif()
 	if (ENABLE_TESTING AND BUILD_PUBSUB_TESTS)
 		add_subdirectory(test)

http://git-wip-us.apache.org/repos/asf/celix/blob/ac4babf3/pubsub/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/pubsub/test/CMakeLists.txt b/pubsub/test/CMakeLists.txt
index 93a95f0..f8c0fd2 100644
--- a/pubsub/test/CMakeLists.txt
+++ b/pubsub/test/CMakeLists.txt
@@ -31,6 +31,7 @@ add_bundle(pubsub_sut
         test/sut_activator.c
     VERSION 1.0.0
 )
+target_link_libraries(pubsub_sut celix_framework celix_utils)
 bundle_files(pubsub_sut
     msg_descriptors/msg.descriptor
     msg_descriptors/sync.descriptor
@@ -63,6 +64,13 @@ add_bundle(pubsub_tst
         test/tst_activator.cpp
     VERSION 1.0.0
 )
+if (APPLE)
+    #Note that the launcher celix_test_runner is linked with CppuTest, not the bundle libs. Default libCppUTest.a is not compiled for relocation 
+    target_link_libraries(pubsub_tst celix_framework celix_utils -Wl,-undefined -Wl,dynamic_lookup)
+else ()
+    target_link_libraries(pubsub_tst celix_framework celix_utils)
+endif ()
+
 bundle_files(pubsub_tst
     msg_descriptors/msg.descriptor
     msg_descriptors/sync.descriptor