Author: abroekhuis
Date: Tue Nov 27 13:16:56 2012
New Revision: 1414173

URL: http://svn.apache.org/viewvc?rev=1414173&view=rev
Log:
CELIX-42: Several changes to the build system to support Visual Studio. Renamed 
Service_event enum types for for Visual Studio support.

Modified:
    incubator/celix/trunk/cmake/Packaging.cmake
    incubator/celix/trunk/examples/CMakeLists.txt
    
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
    
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/service_registry.c
    incubator/celix/trunk/framework/private/src/service_tracker.c
    incubator/celix/trunk/framework/public/include/service_event.h
    incubator/celix/trunk/shell/private/src/shell.c
    incubator/celix/trunk/shell_tui/private/src/shell_tui.c

Modified: incubator/celix/trunk/cmake/Packaging.cmake
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/Packaging.cmake?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/Packaging.cmake (original)
+++ incubator/celix/trunk/cmake/Packaging.cmake Tue Nov 27 13:16:56 2012
@@ -22,6 +22,13 @@ IF(NOT CPACK_COMMAND)
        MESSAGE(FATAL_ERROR "Need CPack!")
 ENDIF(NOT CPACK_COMMAND)
 
+find_program(JAR_COMMAND jar)
+if(JAR_COMMAND)
+       message("Using JAR to repack bundles, bundles can be used by Apache 
ACE")
+else(JAR_COMMAND)
+    message("No JAR support, generated bundles are not usable for Apache ACE")
+endif(JAR_COMMAND)
+
 SET(CPACK_GENERATOR "ZIP")
 
 file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/bundles 
${PROJECT_BINARY_DIR}/packages)
@@ -67,16 +74,25 @@ MACRO(bundle)
        SET(__bundleConfig 
${CMAKE_CURRENT_BINARY_DIR}/CPackConfig-${INT_BUNDLE_NAME}-bundle.cmake)
        SET(BUNDLE_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
        CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/CPackConfig.in 
${__bundleConfig} @ONLY)
-       ADD_CUSTOM_COMMAND(TARGET ${INT_BUNDLE_NAME}
-       POST_BUILD
-               COMMAND ${CPACK_COMMAND} ARGS -C Debug --config 
${__bundleConfig}
-       #       COMMAND mkdir -p ${PROJECT_BINARY_DIR}/ziptojar \;
-       #               cd ${PROJECT_BINARY_DIR}/ziptojar \;
-       #               jar -xf 
${PROJECT_BINARY_DIR}/bundles/${INT_BUNDLE_NAME}.zip \;
-       #               jar -cfm 
${PROJECT_BINARY_DIR}/bundles/${INT_BUNDLE_NAME}.zip META-INF/MANIFEST.MF . \;
-       #               rm -rf ${PROJECT_BINARY_DIR}/ziptojar/*
-               WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bundles
-       )
+
+       if(JAR_COMMAND)
+               ADD_CUSTOM_COMMAND(TARGET ${INT_BUNDLE_NAME}
+               POST_BUILD
+                       COMMAND ${CPACK_COMMAND} ARGS -C Debug --config 
${__bundleConfig}
+                       COMMAND ${CMAKE_COMMAND} -E make_directory 
${PROJECT_BINARY_DIR}/ziptojar
+                       COMMAND ${CMAKE_COMMAND} -E chdir 
${PROJECT_BINARY_DIR}/ziptojar ${JAR_COMMAND} -xf 
${PROJECT_BINARY_DIR}/bundles/${INT_BUNDLE_NAME}.zip
+                       COMMAND ${CMAKE_COMMAND} -E chdir 
${PROJECT_BINARY_DIR}/ziptojar ${JAR_COMMAND} -cfm 
${PROJECT_BINARY_DIR}/bundles/${INT_BUNDLE_NAME}.zip META-INF/MANIFEST.MF .
+                       COMMAND ${CMAKE_COMMAND} -E remove_directory 
${PROJECT_BINARY_DIR}/ziptojar
+                       WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bundles
+               )
+       else(JAR_COMMAND)
+               ADD_CUSTOM_COMMAND(TARGET ${INT_BUNDLE_NAME}
+               POST_BUILD
+                       COMMAND ${CPACK_COMMAND} ARGS -C Debug --config 
${__bundleConfig}
+                       WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bundles
+               )
+       endif(JAR_COMMAND)
+       
        SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES 
${PROJECT_BINARY_DIR}/bundles/${INT_BUNDLE_NAME}.zip)
 ENDMACRO(bundle)
        

Modified: incubator/celix/trunk/examples/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/CMakeLists.txt?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- incubator/celix/trunk/examples/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/CMakeLists.txt Tue Nov 27 13:16:56 2012
@@ -17,22 +17,21 @@
 celix_subproject(EXAMPLES "Option to enable building the Examples" "OFF" DEPS 
FRAMEWORK LAUNCHER SHELL_TUI LOG_WRITER DEPENDENCY_MANAGER)
 if (EXAMPLES)
     add_subdirectory(hello_world)
-    #add_subdirectory(mongoose)
+    add_subdirectory(mongoose)
     
-    #add_subdirectory(whiteboard)
-    #add_subdirectory(echo_service)
+    add_subdirectory(whiteboard)
+    add_subdirectory(echo_service)
     
-    #add_subdirectory(osgi-in-action/chapter04-correct-lookup)
-    #add_subdirectory(osgi-in-action/chapter04-correct-listener)
-    #add_subdirectory(osgi-in-action/chapter01-greeting-example)
-    #add_subdirectory(osgi-in-action/chapter04-paint-example)
+    add_subdirectory(osgi-in-action/chapter04-correct-lookup)
+    add_subdirectory(osgi-in-action/chapter04-correct-listener)
+    add_subdirectory(osgi-in-action/chapter01-greeting-example)
+    add_subdirectory(osgi-in-action/chapter04-paint-example)
     
-    #deploy(chapter01-greeting-example BUNDLES shell shell_tui log_service 
chapter01-greeting-example-client chapter01-greeting-example)
-    #deploy(chapter04-correct-listener BUNDLES shell shell_tui log_service 
chapter04-correct-listener)
-    #deploy("chapter04-paint-example" BUNDLES chapter04-paint-example circle 
square triangle shell shell_tui log_service log_writer)
+    deploy(chapter01-greeting-example BUNDLES shell shell_tui log_service 
chapter01-greeting-example-client chapter01-greeting-example)
+    deploy(chapter04-correct-listener BUNDLES shell shell_tui log_service 
chapter04-correct-listener)
     
     deploy("hello_world" BUNDLES shell shell_tui hello_world log_service)
-    #deploy("wb" BUNDLES tracker publisherA publisherB shell shell_tui 
log_service log_writer)
-    #deploy("wb_dp" BUNDLES tracker_depman publisherA publisherB shell 
shell_tui log_service log_writer)
-    #deploy("echo" BUNDLES echo_server echo_client shell shell_tui log_service 
log_writer)
+    deploy("wb" BUNDLES tracker publisherA publisherB shell shell_tui 
log_service log_writer)
+    deploy("wb_dp" BUNDLES tracker_depman publisherA publisherB shell 
shell_tui log_service log_writer)
+    deploy("echo" BUNDLES echo_server echo_client shell shell_tui log_service 
log_writer)
 endif(EXAMPLES)

Modified: 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
 (original)
+++ 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
 Tue Nov 27 13:16:56 2012
@@ -106,7 +106,7 @@ celix_status_t bundleActivator_start(voi
                                SERVICE_REFERENCE logService = 
(SERVICE_REFERENCE) arrayList_get(logServices, i);
                                SERVICE_EVENT event = 
apr_palloc(activator->pool, sizeof(*event));
                                event->reference = logService;
-                               event->type = REGISTERED;
+                               event->type = SERVICE_EVENT_REGISTERED;
 
                                listenerExample_serviceChanged(listener, event);
                        }
@@ -144,13 +144,13 @@ void listenerExample_serviceChanged(SERV
        apr_thread_mutex_lock(activator->logServiceReferencesLock);
 
        switch (event->type) {
-       case REGISTERED:
+       case SERVICE_EVENT_REGISTERED:
                arrayList_add(activator->logServiceReferences, 
event->reference);
                break;
 //     case MODIFIED:
 //             // only the service metadata has changed, so no need to do 
anything here
 //             break;
-       case UNREGISTERING:
+       case SERVICE_EVENT_UNREGISTERING:
                arrayList_remove(activator->logServiceReferences,
                                
arrayList_indexOf(activator->logServiceReferences, event->reference));
                break;

Modified: 
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
 (original)
+++ 
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
 Tue Nov 27 13:16:56 2012
@@ -15,8 +15,14 @@
 # specific language governing permissions and limitations
 # under the License.
 
-add_subdirectory(circle)
-add_subdirectory(paint)
-add_subdirectory(square)
-add_subdirectory(triangle)
-
+find_package(PkgConfig)
+if(PKG_CONFIG_EXECUTABLE)
+       add_subdirectory(circle)
+       add_subdirectory(paint)
+       add_subdirectory(square)
+       add_subdirectory(triangle)
+       
+       deploy("chapter04-paint-example" BUNDLES chapter04-paint-example circle 
square triangle shell shell_tui log_service log_writer)
+else(PKG_CONFIG_EXECUTABLE)
+       MESSAGE("No GTK found, not building the Paint Example") 
+endif(PKG_CONFIG_EXECUTABLE)
\ No newline at end of file

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Tue Nov 27 13:16:56 
2012
@@ -1476,7 +1476,7 @@ void fw_serviceChanged(FRAMEWORK framewo
                                event->reference = reference;
 
                                
element->listener->serviceChanged(element->listener, event);
-                       } else if (eventType == MODIFIED) {
+                       } else if (eventType == SERVICE_EVENT_MODIFIED) {
                                bool matchResult = false;
                                int matched = 0;
                                if (element->filter != NULL) {
@@ -1490,7 +1490,7 @@ void fw_serviceChanged(FRAMEWORK framewo
                                        
serviceRegistry_createServiceReference(framework->registry, 
element->listener->pool, registration, &reference);
 
                                        endmatch->reference = reference;
-                                       endmatch->type = MODIFIED_ENDMATCH;
+                                       endmatch->type = 
SERVICE_EVENT_MODIFIED_ENDMATCH;
                                        
element->listener->serviceChanged(element->listener, endmatch);
                                }
                        }

Modified: incubator/celix/trunk/framework/private/src/service_registry.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registry.c?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registry.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registry.c Tue Nov 27 
13:16:56 2012
@@ -208,7 +208,7 @@ celix_status_t serviceRegistry_registerS
 //             SERVICE_EVENT event = (SERVICE_EVENT) malloc(sizeof(*event));
 //             event->type = REGISTERED;
 //             event->reference = (*registration)->reference;
-               registry->serviceChanged(registry->framework, REGISTEREDA, 
*registration, NULL);
+               registry->serviceChanged(registry->framework, 
SERVICE_EVENT_REGISTERED, *registration, NULL);
 //             free(event);
 //             event = NULL;
        }
@@ -235,7 +235,7 @@ void serviceRegistry_unregisterService(S
        apr_thread_mutex_unlock(registry->mutex);
 
        if (registry->serviceChanged != NULL) {
-               registry->serviceChanged(registry->framework, UNREGISTERING, 
registration, NULL);
+               registry->serviceChanged(registry->framework, 
SERVICE_EVENT_UNREGISTERING, registration, NULL);
        }
 
        apr_thread_mutex_lock(registry->mutex);
@@ -554,7 +554,7 @@ celix_status_t serviceRegistry_getListen
 
 celix_status_t serviceRegistry_servicePropertiesModified(SERVICE_REGISTRY 
registry, SERVICE_REGISTRATION registration, PROPERTIES oldprops) {
        if (registry->serviceChanged != NULL) {
-               registry->serviceChanged(registry->framework, MODIFIED, 
registration, oldprops);
+               registry->serviceChanged(registry->framework, 
SERVICE_EVENT_MODIFIED, registration, oldprops);
        }
 
        return CELIX_SUCCESS;

Modified: incubator/celix/trunk/framework/private/src/service_tracker.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_tracker.c?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker.c Tue Nov 27 
13:16:56 2012
@@ -225,14 +225,14 @@ void *serviceTracker_getServiceByReferen
 void serviceTracker_serviceChanged(SERVICE_LISTENER listener, SERVICE_EVENT 
event) {
        service_tracker_t tracker = listener->handle;
        switch (event->type) {
-               case REGISTEREDA:
-               case MODIFIED:
+               case SERVICE_EVENT_REGISTERED:
+               case SERVICE_EVENT_MODIFIED:
                        serviceTracker_track(tracker, event->reference, event);
                        break;
-               case UNREGISTERING:
+               case SERVICE_EVENT_UNREGISTERING:
                        serviceTracker_untrack(tracker, event->reference, 
event);
                        break;
-               case MODIFIED_ENDMATCH:
+               case SERVICE_EVENT_MODIFIED_ENDMATCH:
                        break;
        }
 }

Modified: incubator/celix/trunk/framework/public/include/service_event.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/service_event.h?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/service_event.h (original)
+++ incubator/celix/trunk/framework/public/include/service_event.h Tue Nov 27 
13:16:56 2012
@@ -36,10 +36,10 @@ typedef struct serviceEvent * SERVICE_EV
 
 enum serviceEventType
 {
-       REGISTEREDA = 0x00000001,
-       MODIFIED = 0x00000002,
-       UNREGISTERING = 0x00000004,
-       MODIFIED_ENDMATCH = 0x00000008,
+       SERVICE_EVENT_REGISTERED = 0x00000001,
+       SERVICE_EVENT_MODIFIED = 0x00000002,
+       SERVICE_EVENT_UNREGISTERING = 0x00000004,
+       SERVICE_EVENT_MODIFIED_ENDMATCH = 0x00000008,
 };
 
 struct serviceEvent {

Modified: incubator/celix/trunk/shell/private/src/shell.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/shell.c?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/shell.c (original)
+++ incubator/celix/trunk/shell/private/src/shell.c Tue Nov 27 13:16:56 2012
@@ -158,7 +158,7 @@ void shell_removeCommand(SHELL shell, SE
 
 void shell_serviceChanged(SERVICE_LISTENER listener, SERVICE_EVENT event) {
        SHELL shell = (SHELL) listener->handle;
-       if (event->type == REGISTEREDA) {
+       if (event->type == SERVICE_EVENT_REGISTERED) {
                shell_addCommand(shell, event->reference);
        }
 }

Modified: incubator/celix/trunk/shell_tui/private/src/shell_tui.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/shell_tui/private/src/shell_tui.c?rev=1414173&r1=1414172&r2=1414173&view=diff
==============================================================================
--- incubator/celix/trunk/shell_tui/private/src/shell_tui.c (original)
+++ incubator/celix/trunk/shell_tui/private/src/shell_tui.c Tue Nov 27 13:16:56 
2012
@@ -91,9 +91,9 @@ void shellTui_serviceChanged(SERVICE_LIS
        bool result = NULL;
     SHELL_TUI_ACTIVATOR act = (SHELL_TUI_ACTIVATOR) listener->handle;
 
-       if ((event->type == REGISTEREDA) && (act->reference == NULL)) {
+       if ((event->type == SERVICE_EVENT_REGISTERED) && (act->reference == 
NULL)) {
                shellTui_initializeService(act);
-       } else if ((event->type == UNREGISTERING) && (act->reference == 
event->reference)) {
+       } else if ((event->type == SERVICE_EVENT_UNREGISTERING) && 
(act->reference == event->reference)) {
                bundleContext_ungetService(act->context, act->reference, 
&result);
                act->reference = NULL;
                act->shell = NULL;


Reply via email to