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 2016/01/11 20:21:14 UTC

[1/2] celix git commit: CElIX-335: Revert to static depenency manager ussage

Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-335_deploy_refactoring 9ba259e91 -> 40bf19301


CElIX-335: Revert to static depenency manager ussage


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

Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 9c7892b0bbdf9a1e03915df495ea39af8b2077cf
Parents: 9ba259e
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Mon Jan 11 20:06:34 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Mon Jan 11 20:06:34 2016 +0100

----------------------------------------------------------------------
 .travis.yml                                     |  2 +-
 dependency_manager/CMakeLists.txt               | 22 +++++-----
 .../private/src/dm_activator_base.c             | 45 --------------------
 examples/dm_example/phase1/CMakeLists.txt       | 20 ++++++---
 examples/dm_example/phase2a/CMakeLists.txt      | 12 +++---
 examples/dm_example/phase2b/CMakeLists.txt      | 17 +++++---
 examples/dm_example/phase3/CMakeLists.txt       | 17 +++++---
 .../whiteboard/tracker_depman/CMakeLists.txt    |  4 +-
 8 files changed, 56 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/9c7892b0/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 13f37aa..da5f3f0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,7 +18,7 @@ allow_failures:
 
 before_install:
   - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -qq update && sudo apt-get install -y uuid-dev libxml2-dev lcov libffi-dev; fi
-  - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update && brew install lcov libffi && brew link --force libffi; fi
+  - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update && brew install lcov libffi cmake && brew link --force libffi; fi
 
 before_script:
     - cmake -version

http://git-wip-us.apache.org/repos/asf/celix/blob/9c7892b0/dependency_manager/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/dependency_manager/CMakeLists.txt b/dependency_manager/CMakeLists.txt
index efd3be7..7a2761b 100644
--- a/dependency_manager/CMakeLists.txt
+++ b/dependency_manager/CMakeLists.txt
@@ -49,21 +49,20 @@ if (DEPENDENCY_MANAGER)
     	private/src/dm_dependency_manager_impl
     )
 
-    add_library(dependency_manager SHARED 
-    	private/src/dm_activator_base 
-    	private/src/dm_component_impl 
-    	private/src/dm_service_dependency
-    	private/src/dm_event
-    	private/src/dm_dependency_manager_impl
-    )
-    set_target_properties(dependency_manager PROPERTIES SOVERSION 1)
-    target_compile_definitions(dependency_manager PRIVATE DM_USE_WEAK_DEFAULT_FUNCTIONS)
+    #add_library(dependency_manager SHARED 
+    #	private/src/dm_activator_base 
+    #	private/src/dm_component_impl 
+    #	private/src/dm_service_dependency
+    # 	private/src/dm_event
+    #   private/src/dm_dependency_manager_impl
+    #)
+    #set_target_properties(dependency_manager PROPERTIES SOVERSION 1)
+    #target_link_libraries(dependency_manager celix_framework -undefined dynamic_load)
 
    	include_directories("public/include")
    	include_directories("private/include")
     include_directories("../shell/public/include")
     include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-    target_link_libraries(dependency_manager celix_framework)
     target_link_libraries(dependency_manager_static celix_framework)
     
     install(
@@ -79,5 +78,6 @@ if (DEPENDENCY_MANAGER)
 			dependency_manager
 	)
     install_bundle(dm_shell)
-    install(TARGETS dependency_manager dependency_manager_static DESTINATION lib COMPONENT dependency_manager)
+    #install(TARGETS dependency_manager dependency_manager_static DESTINATION lib COMPONENT dependency_manager)
+    install(TARGETS dependency_manager_static DESTINATION lib COMPONENT dependency_manager)
 endif (DEPENDENCY_MANAGER)

http://git-wip-us.apache.org/repos/asf/celix/blob/9c7892b0/dependency_manager/private/src/dm_activator_base.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_activator_base.c b/dependency_manager/private/src/dm_activator_base.c
index 2f86707..c636364 100644
--- a/dependency_manager/private/src/dm_activator_base.c
+++ b/dependency_manager/private/src/dm_activator_base.c
@@ -34,13 +34,7 @@
 #include "bundle_activator.h"
 #include "dm_info.h"
 
-#ifdef DM_USE_WEAK_DEFAULT_FUNCTIONS
-celix_status_t dm_create(bundle_context_pt context, void ** userData) __attribute__((weak));
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) __attribute__((weak));
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) __attribute__((weak));
-#else
 #include "dm_activator.h"
-#endif
 
 struct dm_dependency_activator_base {
 	dm_dependency_manager_pt manager;
@@ -135,42 +129,3 @@ celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt contex
 
 	return status;
 }
-
-#ifdef DM_USE_WEAK_DEFAULT_FUNCTIONS
-
-static char * dm_getSymbolicNameFromContext(bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_pt bundle = NULL;
-    module_pt module = NULL;
-    char *name =  NULL;
-    if (context != NULL) {
-        status = bundleContext_getBundle(context, &bundle);
-    } 
-    if (status == CELIX_SUCCESS) {
-        status = bundle_getCurrentModule(bundle, &module);
-    }
-    if (status == CELIX_SUCCESS) {
-        status = module_getSymbolicName(module, &name);
-    }
-    return name;
-}
-
-celix_status_t dm_create(bundle_context_pt context, void ** userData) {
-    //NOTE weak version
-    printf("Error: Bundle '%s' should implement the dm_create function\n", dm_getSymbolicNameFromContext(context));
-    *userData = NULL;
-    return CELIX_SUCCESS;
-}
-
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
-    //NOTE weak version
-    printf("Error: Bundle '%s' should implement the dm_init function\n", dm_getSymbolicNameFromContext(context));
-    return CELIX_SUCCESS;
-}
-
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
-    //NOTE weak version
-    printf("Error: Bundle '%s' should implement the dm_destroy function\n", dm_getSymbolicNameFromContext(context));
-    return CELIX_SUCCESS;
-}
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/9c7892b0/examples/dm_example/phase1/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/CMakeLists.txt b/examples/dm_example/phase1/CMakeLists.txt
index b746200..d61fc77 100644
--- a/examples/dm_example/phase1/CMakeLists.txt
+++ b/examples/dm_example/phase1/CMakeLists.txt
@@ -15,18 +15,24 @@
 # specific language governing permissions and limitations
 # under the License.
 
+include_directories(
+        private/include
+        ../services
+)
+
 add_bundle(phase1
-    SYMBOLIC_NAME phase2
+    SYMBOLIC_NAME phase1
     VERSION 0.0.1
     SOURCES
         private/src/phase1_activator
         private/src/phase1_cmp.c
 )
 
-bundle_private_libs(phase1 dependency_manager)
-
-include_directories(
-        private/include
-        ../services
-)
+#Not possbile yet.
+#bundle_private_libs(phase1 dependency_manager)
 
+IF(APPLE)
+target_link_libraries(phase1 celix_framework -Wl,-all_load dependency_manager_static)
+else()
+target_link_libraries(phase1 -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ENDIF()

http://git-wip-us.apache.org/repos/asf/celix/blob/9c7892b0/examples/dm_example/phase2a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/CMakeLists.txt b/examples/dm_example/phase2a/CMakeLists.txt
index d540dc5..0884250 100644
--- a/examples/dm_example/phase2a/CMakeLists.txt
+++ b/examples/dm_example/phase2a/CMakeLists.txt
@@ -15,6 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 
+include_directories(
+        private/include
+        ../services
+)
+
 add_bundle(phase2a
         SYMBOLIC_NAME phase2a
         VERSION 0.0.1
@@ -23,13 +28,6 @@ add_bundle(phase2a
                 private/src/phase2a_cmp
 )
 
-include_directories(
-        private/include
-        ../services
-)
-
-# Note as example the phase2a uses the dependency manager as static library. 
-# Some additional linking argument magic is needed to make this work
 IF(APPLE)
 target_link_libraries(phase2a celix_framework -Wl,-all_load dependency_manager_static)
 else()

http://git-wip-us.apache.org/repos/asf/celix/blob/9c7892b0/examples/dm_example/phase2b/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/CMakeLists.txt b/examples/dm_example/phase2b/CMakeLists.txt
index d2d6a2f..5bd2a6e 100644
--- a/examples/dm_example/phase2b/CMakeLists.txt
+++ b/examples/dm_example/phase2b/CMakeLists.txt
@@ -15,6 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 
+include_directories(
+        private/include
+        ../services
+)
+
 add_bundle(phase2b
         SYMBOLIC_NAME phase2b
         VERSION 0.0.1
@@ -22,9 +27,11 @@ add_bundle(phase2b
                 private/src/phase2b_activator
                 private/src/phase2b_cmp
 )
-bundle_private_libs(phase2b dependency_manager)
 
-include_directories(
-        private/include
-        ../services
-)
+#bundle_private_libs(phase2b dependency_manager)
+
+IF(APPLE)
+target_link_libraries(phase2b celix_framework -Wl,-all_load dependency_manager_static)
+else()
+target_link_libraries(phase2b -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ENDIF()

http://git-wip-us.apache.org/repos/asf/celix/blob/9c7892b0/examples/dm_example/phase3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/CMakeLists.txt b/examples/dm_example/phase3/CMakeLists.txt
index 496a67f..ba195cd 100644
--- a/examples/dm_example/phase3/CMakeLists.txt
+++ b/examples/dm_example/phase3/CMakeLists.txt
@@ -15,6 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 
+include_directories(
+        private/include
+        ../services
+)
+
 add_bundle(phase3
         SYMBOLIC_NAME phase3
         VERSION 0.0.1
@@ -22,9 +27,11 @@ add_bundle(phase3
                 private/src/phase3_activator
                 private/src/phase3_cmp
 )
-bundle_private_libs(phase3 dependency_manager)
 
-include_directories(
-        private/include
-        ../services
-)
+#bundle_private_libs(phase3 dependency_manager)
+
+IF(APPLE)
+target_link_libraries(phase3 celix_framework -Wl,-all_load dependency_manager_static)
+else()
+target_link_libraries(phase3 -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ENDIF()

http://git-wip-us.apache.org/repos/asf/celix/blob/9c7892b0/examples/whiteboard/tracker_depman/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/CMakeLists.txt b/examples/whiteboard/tracker_depman/CMakeLists.txt
index 895da6c..a2d6287 100644
--- a/examples/whiteboard/tracker_depman/CMakeLists.txt
+++ b/examples/whiteboard/tracker_depman/CMakeLists.txt
@@ -30,7 +30,7 @@ include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
 
 # Use some magic to include all symbols of the static library
 IF(APPLE)
-target_link_libraries(tracker_depman celix_framework -Wl,-all_load dependency_manager)
+target_link_libraries(tracker_depman celix_framework -Wl,-all_load dependency_manager_static)
 else()
-target_link_libraries(tracker_depman -Wl,--whole-archive dependency_manager -Wl,--no-whole-archive celix_framework)
+target_link_libraries(tracker_depman -Wl,--whole-archive dependency_manager -Wl,--no-whole-archive celix_framework_static)
 ENDIF()


[2/2] celix git commit: CELIX-335: Fix for wrong dependency setup for deploy targets

Posted by pn...@apache.org.
CELIX-335: Fix for wrong dependency setup for deploy targets


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

Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 40bf19301a62d032c047d7c2a70046a5e8fd2d50
Parents: 9c7892b
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Mon Jan 11 20:21:15 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Mon Jan 11 20:21:15 2016 +0100

----------------------------------------------------------------------
 cmake/cmake_celix/Packaging.cmake | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/40bf1930/cmake/cmake_celix/Packaging.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Packaging.cmake b/cmake/cmake_celix/Packaging.cmake
index 48b8eec..022f5a2 100644
--- a/cmake/cmake_celix/Packaging.cmake
+++ b/cmake/cmake_celix/Packaging.cmake
@@ -538,19 +538,25 @@ function(deploy_bundles_dir)
     get_target_property(DEPS ${DEPLOY_NAME} "DEPLOY_TARGET_DEPS")
 
     foreach(BUNDLE IN ITEMS ${BD_BUNDLES})
-        set(OUT "${DEPLOY_LOC}/${BD_DIR_NAME}/${BUNDLE}.zip")
-        list(APPEND DEPS "${OUT}")
-
         if (IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
+            get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME) 
+            set(OUT "${DEPLOY_LOC}/${BD_DIR_NAME}/${BUNDLE_FILENAME}.zip")
             add_custom_command(OUTPUT ${OUT}
                 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BUNDLE} ${OUT}
+                COMMENT "Copying bundle '${BUNDLE}' to '${DEPLOY_LOC}/${BD_DIR_NAME}'"
+                DEPENDS ${BUNDLE}
             )
         else()
+            set(OUT "${DEPLOY_LOC}/${BD_DIR_NAME}/${BUNDLE}.zip")
             add_custom_command(OUTPUT ${OUT}
                 COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" ${OUT}
-                DEPENDS ${BUNDLE}_bundle
+                COMMENT "Copying bundle '${BUNDLE}' to '${DEPLOY_LOC}/${BD_DIR_NAME}'"
+                DEPENDS ${BUNDLE} #Note cannot directly depends on ${BUNDLE}_bundle, depending in ${BUNDLE} triggering build instead. 
             )
+            add_dependencies(${DEPLOY_NAME} ${BUNDLE}_bundle) #ensure the the deploy depends on the _bundle target, custom_command depends on add_library
         endif()
+        list(APPEND DEPS "${OUT}")
+
     endforeach()
 
     set_target_properties(${DEPLOY_NAME} PROPERTIES "DEPLOY_TARGET_DEPS" "${DEPS}")