celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject [1/2] celix git commit: CELIX-229: Made APR optional
Date Fri, 27 Mar 2015 11:26:06 GMT
Repository: celix
Updated Branches:
  refs/heads/develop [created] b3271bcad


CELIX-229: Made APR optional

* Added build option to enable APR
* Added generated header file with WITH_APR define for usage in code
* Added ifdef/endif to use with WITH_APR in code
* Added errors to sub projects that require APR for when it is not enabled
* Added missing includes after APR header removal


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

Branch: refs/heads/develop
Commit: 6ac240b2731d57b901b0c5e5bf3cfca31c7ff6c6
Parents: 5984c1a
Author: Alexander Broekhuis <a.broekhuis@gmail.com>
Authored: Fri Mar 27 12:17:44 2015 +0100
Committer: Alexander Broekhuis <a.broekhuis@gmail.com>
Committed: Fri Mar 27 12:17:44 2015 +0100

----------------------------------------------------------------------
 CMakeLists.txt                                  |  10 ++
 cmake/CMakeCelix.cmake                          |   5 +-
 config.h.in                                     |  31 ++++++
 .../private/src/dm_service_dependency.c         |   1 +
 event_admin/CMakeLists.txt                      |   3 +
 examples/embedding/CMakeLists.txt               |   5 +
 .../chapter04-paint-example/CMakeLists.txt      |   3 +
 framework/CMakeLists.txt                        |   7 +-
 .../private/include/bundle_context_private.h    |   2 +
 framework/private/include/framework_private.h   |   2 +
 framework/private/src/bundle_context.c          |   8 ++
 framework/private/src/framework.c               |  14 +++
 framework/public/include/bundle_context.h       |   6 +
 framework/public/include/framework.h            |   8 +-
 launcher/private/src/launcher.c                 | 110 ++++++++++---------
 log_service/private/src/log_entry.c             |   1 +
 log_service/private/src/log_service_activator.c |   1 +
 scr/CMakeLists.txt                              |   5 +-
 shell/private/src/log_command.c                 |   1 +
 shell_bonjour/CMakeLists.txt                    |  10 +-
 20 files changed, 170 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c56a83..137c81b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,16 @@ include(UseDoxygen)
 # Default bundle version
 set(DEFAULT_VERSION 1.0.0)
 
+option("WITH_APR" "Build Celix with APR support" "OFF")
+if(${WITH_APR})
+	find_package(APR REQUIRED)
+
+	include_directories(${APR_INCLUDE_DIR})
+	include_directories(${APRUTIL_INCLUDE_DIR})
+endif()
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+               ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
 ## New sub project must use a buildoption to be able to enable/disable the project using
the CMake Editor
 ## Sub projects depending on another sub project automatically enable these dependencies
 ## For this to work, the order off "add_subdirectory" has to be correct (ie backwards)

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/cmake/CMakeCelix.cmake
----------------------------------------------------------------------
diff --git a/cmake/CMakeCelix.cmake b/cmake/CMakeCelix.cmake
index d98c728..40221b8 100644
--- a/cmake/CMakeCelix.cmake
+++ b/cmake/CMakeCelix.cmake
@@ -18,11 +18,8 @@
 
 set(CELIX_CMAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
 
-find_package(APR REQUIRED)
-
-include_directories(${APR_INCLUDE_DIR})
-include_directories(${APRUTIL_INCLUDE_DIR})
 include_directories("framework/public/include")
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 include(cmake_celix/Dependencies)
 include(cmake_celix/Packaging)

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/config.h.in
----------------------------------------------------------------------
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..117699e
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,31 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *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
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * framework.h
+ *
+ *  \date       Mar 27, 2015
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#ifndef CELIX_CONFIG_H
+#define CELIX_CONFIG_H
+
+#cmakedefine WITH_APR
+
+#endif //CELIX_CONFIG_H

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/dependency_manager_2/private/src/dm_service_dependency.c
----------------------------------------------------------------------
diff --git a/dependency_manager_2/private/src/dm_service_dependency.c b/dependency_manager_2/private/src/dm_service_dependency.c
index 93445fc..dbe5d70 100644
--- a/dependency_manager_2/private/src/dm_service_dependency.c
+++ b/dependency_manager_2/private/src/dm_service_dependency.c
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "constants.h"
 

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/event_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/event_admin/CMakeLists.txt b/event_admin/CMakeLists.txt
index e79e174..277e5f9 100644
--- a/event_admin/CMakeLists.txt
+++ b/event_admin/CMakeLists.txt
@@ -17,6 +17,9 @@
 
 celix_subproject(EVENT_ADMIN "Option to enable building the Event Admin Service bundles"
OFF DEPS LAUNCHER LOG_SERVICE SHELL shell_tui)
 if(EVENT_ADMIN)
+	if(NOT ${WITH_APR})
+		message(FATAL_ERROR "EVENT_ADMIN requires APR, enable WITH_APR option.")
+	endif()
 	#add_subdirectory(utils)
 	add_subdirectory(event_admin)
 	add_subdirectory(event_handler)

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/examples/embedding/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/embedding/CMakeLists.txt b/examples/embedding/CMakeLists.txt
index 9b53be2..44f2f19 100644
--- a/examples/embedding/CMakeLists.txt
+++ b/examples/embedding/CMakeLists.txt
@@ -19,6 +19,11 @@
 #SET_HEADERS("Bundle-Name: Apache Celix Shell TUI") 
 	
 #bundle(hello_world SOURCES private/src/activator)
+
+if(NOT ${WITH_APR})
+    message(FATAL_ERROR "Embedding example requires APR, enable WITH_APR option.")
+endif()
+
 add_executable(embedding private/src/main)
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(embedding celix_framework)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
index aaca6da..4eeac73 100644
--- a/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
+++ b/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
@@ -15,6 +15,9 @@
 # specific language governing permissions and limitations
 # under the License.
 
+if(NOT ${WITH_APR})
+	message(FATAL_ERROR "Paint example requires APR, enable WITH_APR option.")
+endif()
 find_package(PkgConfig)
 if(PKG_CONFIG_EXECUTABLE)
 	add_subdirectory(circle)

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/framework/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index 1b6457a..337c82d 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -70,8 +70,11 @@ if (FRAMEWORK)
 	if(NOT APPLE)
       set(UUID ${UUID_LIBRARY})
     endif()
-    target_link_libraries(celix_framework celix_utils ${UUID} ${ZLIB_LIBRARY} ${APR_LIBRARY})
-    
+    if (WITH_APR)
+        set(APR ${APR_LIBRARY})
+    endif()
+    target_link_libraries(celix_framework celix_utils ${UUID} ${ZLIB_LIBRARY} ${APR})
+
     install(TARGETS celix_framework DESTINATION lib COMPONENT framework)
     FILE(GLOB files "public/include/*.h")
     INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/framework/private/include/bundle_context_private.h
----------------------------------------------------------------------
diff --git a/framework/private/include/bundle_context_private.h b/framework/private/include/bundle_context_private.h
index f2b5e83..b4ed842 100644
--- a/framework/private/include/bundle_context_private.h
+++ b/framework/private/include/bundle_context_private.h
@@ -32,7 +32,9 @@
 #include "celix_log.h"
 
 struct bundleContext {
+#ifdef WITH_APR
     apr_pool_t *pool;
+#endif
 	struct framework * framework;
 	struct bundle * bundle;
 	framework_logger_pt logger;

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/framework/private/include/framework_private.h
----------------------------------------------------------------------
diff --git a/framework/private/include/framework_private.h b/framework/private/include/framework_private.h
index 40a07d7..723c216 100644
--- a/framework/private/include/framework_private.h
+++ b/framework/private/include/framework_private.h
@@ -48,7 +48,9 @@
 #include "celix_threads.h"
 
 struct framework {
+#ifdef WITH_APR
     apr_pool_t *pool;
+#endif
     struct bundle * bundle;
     hash_map_pt installedBundleMap;
     hash_map_pt installRequestMap;

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/framework/private/src/bundle_context.c
----------------------------------------------------------------------
diff --git a/framework/private/src/bundle_context.c b/framework/private/src/bundle_context.c
index f0f8012..be6333d 100644
--- a/framework/private/src/bundle_context.c
+++ b/framework/private/src/bundle_context.c
@@ -32,7 +32,11 @@
 #include "bundle.h"
 #include "celix_log.h"
 
+#ifdef WITH_APR
 celix_status_t bundleContext_create(apr_pool_t *pool, framework_pt framework, framework_logger_pt
logger, bundle_pt bundle, bundle_context_pt *bundle_context) {
+#else
+celix_status_t bundleContext_create(framework_pt framework, framework_logger_pt logger, bundle_pt
bundle, bundle_context_pt *bundle_context) {
+#endif
 	celix_status_t status = CELIX_SUCCESS;
 	bundle_context_pt context = NULL;
 
@@ -43,7 +47,9 @@ celix_status_t bundleContext_create(apr_pool_t *pool, framework_pt framework,
fr
         if (!context) {
             status = CELIX_ENOMEM;
         } else {
+#ifdef WITH_APR
             context->pool = pool;
+#endif
             context->framework = framework;
             context->bundle = bundle;
             context->logger = logger;
@@ -100,6 +106,7 @@ celix_status_t bundleContext_getFramework(bundle_context_pt context, framework_p
 	return status;
 }
 
+#ifdef WITH_APR
 celix_status_t bundleContext_getMemoryPool(bundle_context_pt context, apr_pool_t **memory_pool)
{
 	celix_status_t status = CELIX_SUCCESS;
 
@@ -113,6 +120,7 @@ celix_status_t bundleContext_getMemoryPool(bundle_context_pt context,
apr_pool_t
 
 	return status;
 }
+#endif
 
 celix_status_t bundleContext_installBundle(bundle_context_pt context, char * location, bundle_pt
*bundle) {
 	return bundleContext_installBundle2(context, location, NULL, bundle);

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/framework/private/src/framework.c
----------------------------------------------------------------------
diff --git a/framework/private/src/framework.c b/framework/private/src/framework.c
index ba3cbaf..a75bed3 100644
--- a/framework/private/src/framework.c
+++ b/framework/private/src/framework.c
@@ -184,7 +184,11 @@ framework_logger_pt logger;
     #define fw_getLastError() dlerror()
 #endif
 
+#ifdef WITH_APR
 celix_status_t framework_create(framework_pt *framework, apr_pool_t *pool, properties_pt
config) {
+#else
+celix_status_t framework_create(framework_pt *framework, properties_pt config) {
+#endif
     celix_status_t status = CELIX_SUCCESS;
 
     logger = hashMap_get(config, "logger");
@@ -202,7 +206,9 @@ celix_status_t framework_create(framework_pt *framework, apr_pool_t *pool,
prope
         status = CELIX_DO_IF(status, celixThreadMutex_create(&(*framework)->dispatcherLock,
NULL));
         status = CELIX_DO_IF(status, celixThreadCondition_init(&(*framework)->dispatcher,
NULL));
         if (status == CELIX_SUCCESS) {
+#ifdef WITH_APR
             (*framework)->pool = pool;
+#endif
             (*framework)->bundle = NULL;
             (*framework)->installedBundleMap = NULL;
             (*framework)->registry = NULL;
@@ -430,9 +436,13 @@ celix_status_t fw_init(framework_pt framework) {
     }
 
     bundle_context_pt context = NULL;
+#ifdef WITH_APR
     apr_pool_t *bundlePool = NULL;
     apr_pool_create(&bundlePool, framework->pool);
     status = CELIX_DO_IF(status, bundleContext_create(bundlePool, framework, framework->logger,
framework->bundle, &context));
+#else
+    status = CELIX_DO_IF(status, bundleContext_create(framework, framework->logger, framework->bundle,
&context));
+#endif
     status = CELIX_DO_IF(status, bundle_setContext(framework->bundle, context));
     if (status == CELIX_SUCCESS) {
         activator_pt activator = NULL;
@@ -683,9 +693,13 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle,
int opti
                 name = NULL;
                 bundle_getCurrentModule(bundle, &module);
                 module_getSymbolicName(module, &name);
+#ifdef WITH_APR
                 apr_pool_t *bundlePool = NULL;
                 apr_pool_create(&bundlePool, framework->pool);
                 status = CELIX_DO_IF(status, bundleContext_create(bundlePool, framework,
framework->logger, bundle, &context));
+#else
+                status = CELIX_DO_IF(status, bundleContext_create(framework, framework->logger,
bundle, &context));
+#endif
                 status = CELIX_DO_IF(status, bundle_setContext(bundle, context));
 
                 if (status == CELIX_SUCCESS) {

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/framework/public/include/bundle_context.h
----------------------------------------------------------------------
diff --git a/framework/public/include/bundle_context.h b/framework/public/include/bundle_context.h
index 4adac50..7ee860c 100644
--- a/framework/public/include/bundle_context.h
+++ b/framework/public/include/bundle_context.h
@@ -41,12 +41,18 @@ typedef struct bundleContext *bundle_context_pt;
 #include "properties.h"
 #include "array_list.h"
 
+#ifdef WITH_APR
 celix_status_t bundleContext_create(apr_pool_t *pool, framework_pt framework, framework_logger_pt,
bundle_pt bundle, bundle_context_pt *bundle_context);
+#else
+celix_status_t bundleContext_create(framework_pt framework, framework_logger_pt, bundle_pt
bundle, bundle_context_pt *bundle_context);
+#endif
 celix_status_t bundleContext_destroy(bundle_context_pt context);
 
 FRAMEWORK_EXPORT celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt
*bundle);
 FRAMEWORK_EXPORT celix_status_t bundleContext_getFramework(bundle_context_pt context, framework_pt
*framework);
+#ifdef WITH_APR
 FRAMEWORK_EXPORT celix_status_t bundleContext_getMemoryPool(bundle_context_pt context, apr_pool_t
**memory_pool);
+#endif
 
 FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle(bundle_context_pt context, char
* location, bundle_pt *bundle);
 FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle2(bundle_context_pt context, char
* location, char *inputFile, bundle_pt *bundle);

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/framework/public/include/framework.h
----------------------------------------------------------------------
diff --git a/framework/public/include/framework.h b/framework/public/include/framework.h
index f7a75c7..0cd8c4d 100644
--- a/framework/public/include/framework.h
+++ b/framework/public/include/framework.h
@@ -30,7 +30,10 @@
 typedef struct activator * activator_pt;
 typedef struct framework * framework_pt;
 
+#include "config.h"
+#ifdef WITH_APR
 #include <apr_general.h>
+#endif
 
 #include "celix_errno.h"
 #include "framework_exports.h"
@@ -38,8 +41,11 @@ typedef struct framework * framework_pt;
 #include "properties.h"
 
 // #TODO: Move to FrameworkFactory according the OSGi Spec
+#ifdef WITH_APR
 FRAMEWORK_EXPORT celix_status_t framework_create(framework_pt *framework, apr_pool_t *memoryPool,
properties_pt config);
-// #TODO: Replace with a pool hook when this is possible
+#else
+FRAMEWORK_EXPORT celix_status_t framework_create(framework_pt *framework, properties_pt config);
+#endif
 FRAMEWORK_EXPORT celix_status_t framework_destroy(framework_pt framework);
 
 FRAMEWORK_EXPORT celix_status_t fw_init(framework_pt framework);

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/launcher/private/src/launcher.c
----------------------------------------------------------------------
diff --git a/launcher/private/src/launcher.c b/launcher/private/src/launcher.c
index ae96248..139d355 100644
--- a/launcher/private/src/launcher.c
+++ b/launcher/private/src/launcher.c
@@ -27,8 +27,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <libgen.h>
-#include <apr_general.h>
-#include <apr_strings.h>
+
 #include <curl/curl.h>
 
 #include "framework.h"
@@ -41,17 +40,20 @@ void launcher_shutdown(int signal);
 int running = 0;
 
 struct framework * framework;
+#ifdef WITH_APR
 apr_pool_t *memoryPool;
+#endif
 
 void show_usage(char* prog_name);
 
 int main(int argc, char *argv[]) {
 	// Set signal handler
-	apr_status_t rv = APR_SUCCESS;
-	apr_status_t s = APR_SUCCESS;
-	properties_pt config = NULL;
-	char *autoStart = NULL;
-    apr_pool_t *pool = NULL;
+#ifdef WITH_APR
+    apr_status_t rv;
+    apr_status_t s;
+#endif
+    properties_pt config = NULL;
+    char *autoStart = NULL;
     bundle_pt fwBundle = NULL;
 
 	(void) signal(SIGINT, launcher_shutdown);
@@ -59,6 +61,7 @@ int main(int argc, char *argv[]) {
 	// Before doing anything else, let's setup Curl
 	curl_global_init(CURL_GLOBAL_NOTHING);
 
+#ifdef WITH_APR
 	rv = apr_initialize();
     if (rv != APR_SUCCESS) {
         return CELIX_START_ERROR;
@@ -68,6 +71,7 @@ int main(int argc, char *argv[]) {
     if (s != APR_SUCCESS) {
         return CELIX_START_ERROR;
     }
+#endif
 
 	// Perform some minimal command-line option parsing...
 	char* opt = NULL;
@@ -100,8 +104,12 @@ int main(int argc, char *argv[]) {
 
     autoStart = properties_get(config, "cosgi.auto.start.1");
     framework = NULL;
-    celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status;
+#ifdef WITH_APR
     status = framework_create(&framework, memoryPool, config);
+#else
+    status = framework_create(&framework, config);
+#endif
     if (status == CELIX_SUCCESS) {
 		status = fw_init(framework);
 		if (status == CELIX_SUCCESS) {
@@ -109,53 +117,51 @@ int main(int argc, char *argv[]) {
             framework_getFrameworkBundle(framework, &fwBundle);
             bundle_start(fwBundle);
 
-            if (apr_pool_create(&pool, memoryPool) == APR_SUCCESS) {
-                char delims[] = " ";
-                char *result = NULL;
-                char *save_ptr = NULL;
-                linked_list_pt bundles;
-                array_list_pt installed = NULL;
-                bundle_pt bundle = NULL;
-                bundle_context_pt context = NULL;
-                linked_list_iterator_pt iter = NULL;
-                unsigned int i;
-
-                linkedList_create(&bundles);
-                result = strtok_r(autoStart, delims, &save_ptr);
-                while (result != NULL) {
-                    char * location = apr_pstrdup(memoryPool, result);
-                    linkedList_addElement(bundles, location);
-                    result = strtok_r(NULL, delims, &save_ptr);
-                }
-                // First install all bundles
-                // Afterwards start them
-                arrayList_create(&installed);
-                framework_getFrameworkBundle(framework, &bundle);
-                bundle_getContext(bundle, &context);
-                iter = linkedListIterator_create(bundles, 0);
-                while (linkedListIterator_hasNext(iter)) {
-                    bundle_pt current = NULL;
-                    char * location = (char *) linkedListIterator_next(iter);
-                    if (bundleContext_installBundle(context, location, &current) == CELIX_SUCCESS)
{
-                        // Only add bundle if it is installed correctly
-                        arrayList_add(installed, current);
-                    } else {
-                        printf("Could not install bundle from %s\n", location);
-                    }
-                    linkedListIterator_remove(iter);
-                }
-                linkedListIterator_destroy(iter);
-                linkedList_destroy(bundles);
-
-                for (i = 0; i < arrayList_size(installed); i++) {
-                    bundle_pt bundle = (bundle_pt) arrayList_get(installed, i);
-                    bundle_startWithOptions(bundle, 0);
+            char delims[] = " ";
+            char *result = NULL;
+            char *save_ptr = NULL;
+            linked_list_pt bundles;
+            array_list_pt installed = NULL;
+            bundle_pt bundle = NULL;
+            bundle_context_pt context = NULL;
+            linked_list_iterator_pt iter = NULL;
+            unsigned int i;
+
+            linkedList_create(&bundles);
+            result = strtok_r(autoStart, delims, &save_ptr);
+            while (result != NULL) {
+                char * location = strdup(result);
+                linkedList_addElement(bundles, location);
+                result = strtok_r(NULL, delims, &save_ptr);
+            }
+            // First install all bundles
+            // Afterwards start them
+            arrayList_create(&installed);
+            framework_getFrameworkBundle(framework, &bundle);
+            bundle_getContext(bundle, &context);
+            iter = linkedListIterator_create(bundles, 0);
+            while (linkedListIterator_hasNext(iter)) {
+                bundle_pt current = NULL;
+                char * location = (char *) linkedListIterator_next(iter);
+                if (bundleContext_installBundle(context, location, &current) == CELIX_SUCCESS)
{
+                    // Only add bundle if it is installed correctly
+                    arrayList_add(installed, current);
+                } else {
+                    printf("Could not install bundle from %s\n", location);
                 }
+                linkedListIterator_remove(iter);
+                free(location);
+            }
+            linkedListIterator_destroy(iter);
+            linkedList_destroy(bundles);
 
-                arrayList_destroy(installed);
-                apr_pool_destroy(pool);
+            for (i = 0; i < arrayList_size(installed); i++) {
+                bundle_pt installedBundle = (bundle_pt) arrayList_get(installed, i);
+                bundle_startWithOptions(installedBundle, 0);
             }
 
+            arrayList_destroy(installed);
+
             framework_waitForStop(framework);
             framework_destroy(framework);
             properties_destroy(config);
@@ -166,8 +172,10 @@ int main(int argc, char *argv[]) {
         printf("Problem creating framework\n");
     }
 
+#ifdef WITH_APR
 	apr_pool_destroy(memoryPool);
 	apr_terminate();
+#endif
 
 	// Cleanup Curl
 	curl_global_cleanup();

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/log_service/private/src/log_entry.c
----------------------------------------------------------------------
diff --git a/log_service/private/src/log_entry.c b/log_service/private/src/log_entry.c
index 79a7a22..fe68bd7 100644
--- a/log_service/private/src/log_entry.c
+++ b/log_service/private/src/log_entry.c
@@ -26,6 +26,7 @@
 
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "celix_errno.h"
 #include "log_service.h"

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/log_service/private/src/log_service_activator.c
----------------------------------------------------------------------
diff --git a/log_service/private/src/log_service_activator.c b/log_service/private/src/log_service_activator.c
index fa2c5de..ce3cbb7 100644
--- a/log_service/private/src/log_service_activator.c
+++ b/log_service/private/src/log_service_activator.c
@@ -25,6 +25,7 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 
 #include "bundle_activator.h"
 #include "log_service_impl.h"

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/scr/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/scr/CMakeLists.txt b/scr/CMakeLists.txt
index e42b7e3..b7e8b3c 100644
--- a/scr/CMakeLists.txt
+++ b/scr/CMakeLists.txt
@@ -15,7 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 celix_subproject(SCR "Option to build the SCR static library" OFF DEPS LAUNCHER FRAMEWORK
SHELL SHELL_TUI)
-if (SCR) 
+if (SCR)
+    if(NOT ${WITH_APR})
+		message(FATAL_ERROR "SCR requires APR, enable WITH_APR option.")
+	endif()
     add_subdirectory(scr)
     add_subdirectory(test)
     

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/shell/private/src/log_command.c
----------------------------------------------------------------------
diff --git a/shell/private/src/log_command.c b/shell/private/src/log_command.c
index 9d38bd0..403ed65 100644
--- a/shell/private/src/log_command.c
+++ b/shell/private/src/log_command.c
@@ -25,6 +25,7 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 
 #include "command_impl.h"
 #include "log_command.h"

http://git-wip-us.apache.org/repos/asf/celix/blob/6ac240b2/shell_bonjour/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/shell_bonjour/CMakeLists.txt b/shell_bonjour/CMakeLists.txt
index 12443f2..5c44dbe 100644
--- a/shell_bonjour/CMakeLists.txt
+++ b/shell_bonjour/CMakeLists.txt
@@ -17,7 +17,9 @@
 
 celix_subproject(SHELL_BONJOUR "Option to enable building the Bonjour Shell (shell access
by chat clients)" OFF DEPS LAUNCHER shell)
 if (SHELL_BONJOUR)
-
+	if(NOT ${WITH_APR})
+		message(FATAL_ERROR "SHELL_BONJOUR requires APR, enable WITH_APR option.")
+	endif()
 	find_package(LibXml2 REQUIRED)
 	
 	#TODO create/add FindDNS_SD.cmake and use it (with required)
@@ -26,9 +28,9 @@ if (SHELL_BONJOUR)
 	set(BUNDLE_SYMBOLICNAME "bonjour_shell")
 	set(BUNDLE_VERSION "0.1.0")
 	set(BUNDLE_NAME "bonjour_shell")
-	
-    	include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-    	include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
+
+	include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+	include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
 	include_directories("${LIBXML2_INCLUDE_DIR}")
 	include_directories("private/include")
 	


Mime
View raw message