celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject celix git commit: CELIX-366: Fixes issue with generating eclipse launch files
Date Mon, 11 Jul 2016 11:40:22 GMT
Repository: celix
Updated Branches:
  refs/heads/develop e628ee4e6 -> 501986f73


CELIX-366: Fixes issue with generating eclipse launch files


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

Branch: refs/heads/develop
Commit: 501986f7344945c7b5fd1a15de1ff54a8f3d92e8
Parents: e628ee4
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Mon Jul 11 13:39:29 2016 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Mon Jul 11 13:39:29 2016 +0200

----------------------------------------------------------------------
 cmake/cmake_celix/Packaging.cmake    | 90 +++++++++++++++++++++----------
 cmake/cmake_celix/RunConfig.in       | 22 --------
 cmake/cmake_celix/RunConfig.in.cmake | 24 +++++++++
 3 files changed, 87 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/501986f7/cmake/cmake_celix/Packaging.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Packaging.cmake b/cmake/cmake_celix/Packaging.cmake
index 663ff1a..91127cc 100644
--- a/cmake/cmake_celix/Packaging.cmake
+++ b/cmake/cmake_celix/Packaging.cmake
@@ -477,65 +477,100 @@ function(add_deploy)
 
 
     ###### Setup deploy custom target and config.properties file
-    set(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DEPLOY_TARGET}-timestamp")
+    set(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DEPLOY_TARGET}-deploy-timestamp")
 
     add_custom_target(${DEPLOY_TARGET}
         DEPENDS ${TIMESTAMP_FILE}
     )
     add_dependencies(deploy ${DEPLOY_TARGET})
 
+    #FILE TARGETS FOR DEPLOY
+    set(DEPLOY_EXE "${DEPLOY_LOCATION}/${DEPLOY_NAME}")
+    set(DEPLOY_RUN_SH "${DEPLOY_LOCATION}/run.sh")
+    set(DEPLOY_PROPS "${DEPLOY_LOCATION}/config.properties")
+    set(DEPLOY_ECLIPSE_LAUNCHER "${DEPLOY_LOCATION}/${DEPLOY_NAME}.launch")
+    set(DEPLOY_RELEASE_SH "${DEPLOY_LOCATION}/release.sh")
+
+    find_program(LINK_CMD ln)
+    if (LINK_CMD) 
+        #if ln is available use a softlink to celix exe instead of a run.sh
+        list(APPEND DEPLOY_FILE_TARGETS ${DEPLOY_PROPS} ${DEPLOY_ECLIPSE_LAUNCHER} ${DEPLOY_RELEASE_SH}
${DEPLOY_RUN_SH} ${DEPLOY_EXE})
+    else()
+        list(APPEND DEPLOY_FILE_TARGETS ${DEPLOY_PROPS} ${DEPLOY_ECLIPSE_LAUNCHER} ${DEPLOY_RELEASE_SH}
${DEPLOY_RUN_SH})
+    endif()
+
+    #setup dependencies based on timestamp
     add_custom_command(OUTPUT "${TIMESTAMP_FILE}"
         COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP_FILE}
-        DEPENDS  "$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_TARGET_DEPS>" "${DEPLOY_LOCATION}/config.properties"
"${DEPLOY_LOCATION}/run.sh" 
+        DEPENDS  "$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_TARGET_DEPS>" ${DEPLOY_FILE_TARGETS}

         WORKING_DIRECTORY "${DEPLOY_LOCATION}"
         COMMENT "Deploying ${DEPLOY_PRINT_NAME}" VERBATIM
     )
 
+    #Setting CELIX_LIB_DIRS, CELIX_BIN_DIR and CELIX_LAUNCHER 
+    if (EXISTS ${CELIX_FRAMEWORK_LIBRARY}) 
+        #CELIX_FRAMEWORK_LIBRARY set by FindCelix.cmake -> Celix Based Project
+        get_filename_component(CELIX_LIB_DIR ${CELIX_FRAMEWORK_LIBRARY} DIRECTORY) #Note
assuming all celix libs are in the same dir
+        set(CELIX_LIB_DIRS "${CELIX_LIB_DIR}")
+        #CELIX_LAUNCHER is set by FindCelix.cmake
+        get_filename_component(CELIX_BIN_DIR ${CELIX_LAUNCHER} DIRECTORY)
+    else()
+        #Celix Main Project
+        set(CELIX_LIB_DIRS "$<TARGET_FILE_DIR:celix_framework>:$<TARGET_FILE_DIR:celix_utils>:$<TARGET_FILE_DIR:celix_dfi>")
+        set(CELIX_LAUNCHER "$<TARGET_FILE:celix>")
+        set(CELIX_BIN_DIR  "$<TARGET_FILE_DIR:celix>")
+    endif()
 
+    #generate config.properties
+    set(STAGE1_PROPERTIES "${CMAKE_CURRENT_BINARY_DIR}/${DEPLOY_TARGET}-deploy-config-stage1.properties")
     file(GENERATE 
-        OUTPUT "${DEPLOY_LOCATION}/config.properties.step1"
+        OUTPUT "${STAGE1_PROPERTIES}"
         CONTENT "cosgi.auto.start.1=$<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_BUNDLES>,
>
 $<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_PROPERTIES>,
 >
 "
     )
-
     file(GENERATE
-        OUTPUT "${DEPLOY_LOCATION}/config.properties"
-        INPUT "${DEPLOY_LOCATION}/config.properties.step1"
+        OUTPUT "${DEPLOY_PROPS}"
+        INPUT "${STAGE1_PROPERTIES}"
     )
 
-    set(CONTAINER_NAME ${DEPLOY_NAME})
-    set(PROGRAM_NAME "${CMAKE_BIN_DIRECTORY}/launcher/celix")
-    set(PROJECT_ATTR "build")
-    set(WORKING_DIRECTORY ${DEPLOY_LOCATION})
-    set(PATHS "${CMAKE_BIN_DIRECTORY}/framework:${CMAKE_BIN_DIRECTORY}/utils:${CMAKE_BIN_DIRECTORY}/dfi")
-    configure_file("${CELIX_CMAKE_DIRECTORY}/cmake_celix/RunConfig.in"  "${DEPLOY_LOCATION}/${DEPLOY_NAME}")
+    #softlink celix exe file
+    add_custom_command(OUTPUT "${DEPLOY_EXE}"
+        COMMAND ${LINK_CMD} -s "${CELIX_LAUNCHER}" "${DEPLOY_EXE}"
+        WORKING_DIRECTORY ${DEPLOY_LOCATION}
+        DEPENDS "${CELIX_LAUNCHER}" 
+        COMMENT "Symbolic link celix exe to ${DEPLOY_EXE}" VERBATIM
+    ) 
 
+
+    #generate release.sh and optional run.sh
     if(APPLE)
         set(LIB_PATH_NAME "DYLD_LIBRARY_PATH")
     else()
         set(LIB_PATH_NAME "LD_LIBRARY_PATH")
     endif()
-
-    if (EXISTS ${CELIX_FRAMEWORK_LIBRARY}) 
-        #Celix Based Project
-        get_filename_component(CELIX_LIB_DIR ${CELIX_FRAMEWORK_LIBRARY} DIRECTORY) #Note
assuming all celix libs are in the same dir
-        set(RUN_CONTENT "export ${LIB_PATH_NAME}=${CELIX_LIB_DIR}:\${${LIB_PATH_NAME}}
-${CELIX_LAUNCHER} $@")
-    else()
-        #Celix Main Project
-        set(RUN_CONTENT "export ${LIB_PATH_NAME}=$<TARGET_FILE_DIR:celix_framework>:$<TARGET_FILE_DIR:celix_utils>:$<TARGET_FILE_DIR:celix_dfi>:\${${LIB_PATH_NAME}}
-$<TARGET_FILE:celix> $@")
-    endif()
-
+    set(RELEASE_CONTENT "#!/bin/sh\nexport ${LIB_PATH_NAME}=${CELIX_LIB_DIRS}:\${${LIB_PATH_NAME}}\nexport
PATH=${CELIX_BIN_DIR}:\${PATH}")
+    file(GENERATE
+        OUTPUT ${DEPLOY_RELEASE_SH}
+        CONTENT ${RELEASE_CONTENT}
+    )
+    set(RUN_CONTENT "${RELEASE_CONTENT}\ncelix \$@")
     file(GENERATE
-        OUTPUT ${DEPLOY_LOCATION}/run.sh
+        OUTPUT ${DEPLOY_RUN_SH}
         CONTENT ${RUN_CONTENT}
     )
 
-    #TODO eclipse launcher file
-    #####
+    #generate eclipse project launch file
+    set(PROGRAM_NAME "${CELIX_LAUNCHER}")
+    set(CONTAINER_NAME ${DEPLOY_NAME})
+    set(PROJECT_ATTR "build")
+    set(WORKING_DIRECTORY ${DEPLOY_LOCATION})
+    include("${CELIX_CMAKE_DIRECTORY}/cmake_celix/RunConfig.in.cmake") #set VAR RUN_CONFIG_IN
+    file(GENERATE
+        OUTPUT "${DEPLOY_ECLIPSE_LAUNCHER}"
+        CONTENT "${RUN_CONFIG_IN}"    
+    )
 
     ##### Deploy Target Properties #####
     #internal use
@@ -552,6 +587,7 @@ $<TARGET_FILE:celix> $@")
     deploy_properties(${DEPLOY_TARGET} ${DEPLOY_PROPERTIES})
 endfunction()
 
+
 #NOTE can be used for drivers/proxies/endpoints bundle dirs
 function(deploy_bundles_dir)
     list(GET ARGN 0 DEPLOY_NAME)

http://git-wip-us.apache.org/repos/asf/celix/blob/501986f7/cmake/cmake_celix/RunConfig.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/RunConfig.in b/cmake/cmake_celix/RunConfig.in
deleted file mode 100644
index 888b992..0000000
--- a/cmake/cmake_celix/RunConfig.in
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
-    <stringAttribute key="bad_container_name" value="${CONTAINER_NAME}"/>
-    <intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
-    <stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
-    <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="${PROGRAM_NAME}"/>
-    <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="${PROJECT_ATTR}"/>
-    <booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
-    <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="org.eclipse.cdt.core.default.config.1"/>
-    <stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="${WORKING_DIRECTORY}"/>
-    <booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
-    <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-        <listEntry value="/${PROJECT_ATTR}"/>
-    </listAttribute>
-    <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-        <listEntry value="4"/>
-    </listAttribute>
-    <mapAttribute key="org.eclipse.debug.core.environmentVariables">
-        <mapEntry key="LD_LIBRARY_PATH" value="${PATHS}"/>
-        <mapEntry key="DYLD_LIBRARY_PATH" value="${PATHS}"/>
-    </mapAttribute>
-</launchConfiguration>

http://git-wip-us.apache.org/repos/asf/celix/blob/501986f7/cmake/cmake_celix/RunConfig.in.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/RunConfig.in.cmake b/cmake/cmake_celix/RunConfig.in.cmake
new file mode 100644
index 0000000..5825f2a
--- /dev/null
+++ b/cmake/cmake_celix/RunConfig.in.cmake
@@ -0,0 +1,24 @@
+set(RUN_CONFIG_IN "\
+<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> \n\
+<launchConfiguration type=\"org.eclipse.cdt.launch.applicationLaunchType\"> \n\
+    <stringAttribute key=\"bad_container_name\" value=\"${CONTAINER_NAME}\"/> \n\
+    <intAttribute key=\"org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR\" value=\"0\"/>
\n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.COREFILE_PATH\" value=\"\"/> \n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.PROGRAM_NAME\" value=\"${PROGRAM_NAME}\"/>
\n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.PROJECT_ATTR\" value=\"${PROJECT_ATTR}\"/>
\n\
+    <booleanAttribute key=\"org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR\" value=\"true\"/>
\n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR\" value=\"org.eclipse.cdt.core.default.config.1\"/>
\n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.WORKING_DIRECTORY\" value=\"${WORKING_DIRECTORY}\"/>
\n\
+    <booleanAttribute key=\"org.eclipse.cdt.launch.use_terminal\" value=\"true\"/>
\n\
+    <listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_PATHS\"> \n\
+        <listEntry value=\"/${PROJECT_ATTR}\"/> \n\
+    </listAttribute> \n\
+    <listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_TYPES\"> \n\
+        <listEntry value=\"4\"/> \n\
+    </listAttribute> \n\
+    <mapAttribute key=\"org.eclipse.debug.core.environmentVariables\"> \n\
+    <mapEntry key=\"LD_LIBRARY_PATH\" value=\"${CELIX_LIB_DIRS}\"/> \n\
+    <mapEntry key=\"DYLD_LIBRARY_PATH\" value=\"${CELIX_LIB_DIRS}\"/> \n\
+    </mapAttribute> \n\
+</launchConfiguration> \n\
+")


Mime
View raw message