This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch feature/579-automatic-dependency-deduction
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 276afafe0986bab7770d856e83d62a3349288510
Author: PengZheng <[email protected]>
AuthorDate: Tue Jul 11 20:41:44 2023 +0800

    Improve dependency specification of RSA.
    
    Improve dependency specification of RSA.
---
 bundles/remote_services/CMakeLists.txt             |  3 +-
 .../discovery_common/CMakeLists.txt                | 48 +++++++++++-----------
 .../{include => src}/endpoint_descriptor_common.h  |  0
 .../discovery_configured/CMakeLists.txt            | 14 ++-----
 .../remote_services/discovery_etcd/CMakeLists.txt  | 18 ++------
 .../discovery_etcd/src/etcd_watcher.c              |  3 +-
 .../remote_services/discovery_shm/CMakeLists.txt   |  6 +--
 .../tms_tst/disc_mock/CMakeLists.txt               |  4 +-
 cmake/CelixDeps.cmake.in                           |  3 +-
 conanfile.py                                       | 21 +++++++++-
 10 files changed, 59 insertions(+), 61 deletions(-)

diff --git a/bundles/remote_services/CMakeLists.txt 
b/bundles/remote_services/CMakeLists.txt
index 04821b75..18f6c434 100644
--- a/bundles/remote_services/CMakeLists.txt
+++ b/bundles/remote_services/CMakeLists.txt
@@ -15,9 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
-celix_subproject(REMOTE_SERVICE_ADMIN "Option to enable building the Remote 
Service Admin Service bundles" ON DEPS CELIX_DFI)
+celix_subproject(REMOTE_SERVICE_ADMIN "Option to enable building the Remote 
Service Admin Service bundles" ON)
 if (REMOTE_SERVICE_ADMIN)
-
     add_subdirectory(remote_services_api)
     add_subdirectory(rsa_spi)
     add_subdirectory(rsa_common)
diff --git a/bundles/remote_services/discovery_common/CMakeLists.txt 
b/bundles/remote_services/discovery_common/CMakeLists.txt
index eacd835a..8db7c886 100644
--- a/bundles/remote_services/discovery_common/CMakeLists.txt
+++ b/bundles/remote_services/discovery_common/CMakeLists.txt
@@ -15,30 +15,28 @@
 # specific language governing permissions and limitations
 # under the License.
 
+celix_subproject(RSA_DISCOVERY_COMMON "Option to enable building the RSA 
discovery common library" ON)
+if (RSA_DISCOVERY_COMMON)
+    find_package(CURL REQUIRED)
+    find_package(LibXml2 REQUIRED)
+    find_package(civetweb REQUIRED)
 
-find_package(CURL REQUIRED)
-find_package(LibXml2 REQUIRED)
-find_package(civetweb REQUIRED)
+    add_library(rsa_discovery_common OBJECT
+            src/discovery.c
+            src/discovery_activator.c
+            src/endpoint_descriptor_reader.c
+            src/endpoint_descriptor_writer.c
+            src/endpoint_discovery_poller.c
+            src/endpoint_discovery_server.c
+            )
+    target_include_directories(rsa_discovery_common PUBLIC include
+            PRIVATE src ${LIBXML2_INCLUDE_DIR})
+    celix_deprecated_utils_headers(rsa_discovery_common)
+    celix_deprecated_framework_headers(rsa_discovery_common)
+    target_link_libraries(rsa_discovery_common
+            PUBLIC Celix::framework Celix::utils Celix::c_rsa_spi 
Celix::log_helper
+            PRIVATE CURL::libcurl civetweb::civetweb ${LIBXML2_LIBRARIES})
 
-add_library(rsa_discovery_common OBJECT
-               src/discovery.c
-               src/discovery_activator.c
-               src/endpoint_descriptor_reader.c
-               src/endpoint_descriptor_writer.c
-               src/endpoint_discovery_poller.c
-               src/endpoint_discovery_server.c
-)
-target_include_directories(rsa_discovery_common PUBLIC
-               include src
-               
$<TARGET_PROPERTY:Celix::framework,INTERFACE_INCLUDE_DIRECTORIES>
-               $<TARGET_PROPERTY:Celix::utils,INTERFACE_INCLUDE_DIRECTORIES>
-               
$<TARGET_PROPERTY:Celix::log_helper,INTERFACE_INCLUDE_DIRECTORIES>
-               
$<TARGET_PROPERTY:Celix::c_rsa_spi,INTERFACE_INCLUDE_DIRECTORIES>
-               ${CURL_INCLUDE_DIRS}
-               ${LIBXML2_INCLUDE_DIR})
-celix_deprecated_utils_headers(rsa_discovery_common)
-celix_deprecated_framework_headers(rsa_discovery_common)
-target_link_libraries(rsa_discovery_common PUBLIC civetweb::civetweb)
-
-#Setup target aliases to match external usage
-add_library(Celix::rsa_discovery_common ALIAS rsa_discovery_common)
+    #Setup target aliases to match external usage
+    add_library(Celix::rsa_discovery_common ALIAS rsa_discovery_common)
+endif ()
\ No newline at end of file
diff --git 
a/bundles/remote_services/discovery_common/include/endpoint_descriptor_common.h 
b/bundles/remote_services/discovery_common/src/endpoint_descriptor_common.h
similarity index 100%
rename from 
bundles/remote_services/discovery_common/include/endpoint_descriptor_common.h
rename to 
bundles/remote_services/discovery_common/src/endpoint_descriptor_common.h
diff --git a/bundles/remote_services/discovery_configured/CMakeLists.txt 
b/bundles/remote_services/discovery_configured/CMakeLists.txt
index 9ff90a22..176cb680 100644
--- a/bundles/remote_services/discovery_configured/CMakeLists.txt
+++ b/bundles/remote_services/discovery_configured/CMakeLists.txt
@@ -17,23 +17,17 @@
 
 celix_subproject(RSA_DISCOVERY_CONFIGURED "Option to enable building the 
Discovery (Configured) bundle" ON)
 if (RSA_DISCOVERY_CONFIGURED)
-    find_package(CURL REQUIRED)
-    find_package(LibXml2 REQUIRED)
-    find_package(civetweb REQUIRED)
-
     add_celix_bundle(rsa_discovery
             VERSION 0.9.0
             SYMBOLIC_NAME "apache_celix_rsa_discovery"
             NAME "Apache Celix RSA Configured Discovery"
             SOURCES
             src/discovery_impl.c
-            $<TARGET_OBJECTS:Celix::rsa_discovery_common>
-            )
-    target_include_directories(rsa_discovery PRIVATE
-            src
-            $<TARGET_PROPERTY:Celix::rsa_discovery_common,INCLUDE_DIRECTORIES>
             )
-    target_link_libraries(rsa_discovery PRIVATE CURL::libcurl 
${LIBXML2_LIBRARIES} Celix::log_helper Celix::rsa_common civetweb::civetweb)
+    target_include_directories(rsa_discovery PRIVATE src )
+    target_link_libraries(rsa_discovery PRIVATE Celix::rsa_discovery_common 
Celix::log_helper Celix::rsa_common)
+    celix_deprecated_framework_headers(rsa_discovery)
+    celix_deprecated_utils_headers(rsa_discovery)
 
     install_celix_bundle(rsa_discovery EXPORT celix COMPONENT rsa)
     #Setup target aliases to match external usage
diff --git a/bundles/remote_services/discovery_etcd/CMakeLists.txt 
b/bundles/remote_services/discovery_etcd/CMakeLists.txt
index 4a479cf6..532af9e5 100644
--- a/bundles/remote_services/discovery_etcd/CMakeLists.txt
+++ b/bundles/remote_services/discovery_etcd/CMakeLists.txt
@@ -17,11 +17,6 @@
 
 celix_subproject(RSA_DISCOVERY_ETCD "Option to enable building the Discovery 
(ETCD) bundle" ON DEPS CELIX_ETCDLIB)
 if (RSA_DISCOVERY_ETCD)
-       find_package(CURL REQUIRED)
-       find_package(LibXml2 REQUIRED)
-       find_package(jansson REQUIRED)
-       find_package(civetweb REQUIRED)
-
        add_celix_bundle(rsa_discovery_etcd
                        VERSION 0.9.0
                        SYMBOLIC_NAME "apache_celix_rsa_discovery_etcd"
@@ -30,18 +25,11 @@ if (RSA_DISCOVERY_ETCD)
                        SOURCES
                        src/discovery_impl.c
                        src/etcd_watcher.c
-                       $<TARGET_OBJECTS:Celix::rsa_discovery_common>
                        )
-       target_link_libraries(rsa_discovery_etcd PRIVATE Celix::log_helper 
Celix::etcdlib_static Celix::rsa_common civetweb::civetweb)
+       target_link_libraries(rsa_discovery_etcd PRIVATE 
Celix::rsa_discovery_common Celix::log_helper Celix::etcdlib_static 
Celix::rsa_common)
        target_include_directories(rsa_discovery_etcd PRIVATE src)
-       target_include_directories(rsa_discovery_etcd PRIVATE
-                       
$<TARGET_PROPERTY:Celix::rsa_discovery_common,INCLUDE_DIRECTORIES>
-                       )
-       target_include_directories(rsa_discovery_etcd SYSTEM PRIVATE
-                       ${CURL_INCLUDE_DIR}
-                       ${LIBXML2_INCLUDE_DIR}
-                       )
-       target_link_libraries(rsa_discovery_etcd PRIVATE CURL::libcurl 
${LIBXML2_LIBRARIES} jansson::jansson)
+       celix_deprecated_framework_headers(rsa_discovery_etcd)
+       celix_deprecated_utils_headers(rsa_discovery_etcd)
 
        install_celix_bundle(rsa_discovery_etcd EXPORT celix COMPONENT rsa)
        #Setup target aliases to match external usage
diff --git a/bundles/remote_services/discovery_etcd/src/etcd_watcher.c 
b/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
index b3d6c70c..7341698f 100644
--- a/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
+++ b/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
@@ -28,7 +28,6 @@
 #include "discovery.h"
 #include "discovery_impl.h"
 
-#include <curl/curl.h>
 #include "etcd.h"
 #include "etcd_watcher.h"
 
@@ -301,7 +300,7 @@ celix_status_t etcdWatcher_create(discovery_t *discovery, 
celix_bundle_context_t
        const char* etcd_server = celix_bundleContext_getProperty(context, 
CFG_ETCD_SERVER_IP, DEFAULT_ETCD_SERVER_IP);
        long etcd_port = celix_bundleContext_getPropertyAsLong(context, 
CFG_ETCD_SERVER_PORT, DEFAULT_ETCD_SERVER_PORT);
 
-       (*watcher)->etcdlib = etcdlib_create(etcd_server, (int)etcd_port, 
CURL_GLOBAL_DEFAULT);
+       (*watcher)->etcdlib = etcdlib_create(etcd_server, (int)etcd_port, 
ETCDLIB_NO_CURL_INITIALIZATION);
        celix_status_t status = CELIX_SUCCESS;
        if ((*watcher)->etcdlib == NULL) {
                status = CELIX_BUNDLE_EXCEPTION;
diff --git a/bundles/remote_services/discovery_shm/CMakeLists.txt 
b/bundles/remote_services/discovery_shm/CMakeLists.txt
index 1f6bb407..1f860cb7 100644
--- a/bundles/remote_services/discovery_shm/CMakeLists.txt
+++ b/bundles/remote_services/discovery_shm/CMakeLists.txt
@@ -28,17 +28,17 @@ add_celix_bundle(rsa_discovery_shm
                src/discovery_shm.c
                src/discovery_shmWatcher.c
                src/discovery_impl.c
-               $<TARGET_OBJECTS:Celix::rsa_discovery_common>
 )
 target_include_directories(rsa_discovery_shm PRIVATE
                src
                ${LIBXML2_INCLUDE_DIR}
                ${CURL_INCLUDE_DIR}
-               
$<TARGET_PROPERTY:Celix::rsa_discovery_common,INCLUDE_DIRECTORIES>
 )
 target_link_libraries(rsa_discovery_shm PRIVATE
-               Celix::framework CURL::libcurl ${LIBXML2_LIBRARIES} 
Celix::log_helper
+               Celix::rsa_discovery_common Celix::framework CURL::libcurl 
${LIBXML2_LIBRARIES} Celix::log_helper
                rsa_common civetweb::civetweb)
+celix_deprecated_framework_headers(rsa_discovery_shm)
+celix_deprecated_utils_headers(rsa_discovery_shm)
 
 install_celix_bundle(rsa_discovery_shm EXPORT celix COMPONENT rsa)
 
diff --git 
a/bundles/remote_services/topology_manager/tms_tst/disc_mock/CMakeLists.txt 
b/bundles/remote_services/topology_manager/tms_tst/disc_mock/CMakeLists.txt
index e7f9c417..537497ec 100644
--- a/bundles/remote_services/topology_manager/tms_tst/disc_mock/CMakeLists.txt
+++ b/bundles/remote_services/topology_manager/tms_tst/disc_mock/CMakeLists.txt
@@ -23,5 +23,7 @@ add_celix_bundle(topology_manager_disc_mock_bundle
 )
 target_include_directories(topology_manager_disc_mock_bundle PRIVATE
         $<TARGET_PROPERTY:Celix::rsa_discovery_common,INCLUDE_DIRECTORIES>
-)
+        )
 target_link_libraries(topology_manager_disc_mock_bundle PRIVATE 
Celix::framework)
+celix_deprecated_framework_headers(topology_manager_disc_mock_bundle)
+celix_deprecated_utils_headers(topology_manager_disc_mock_bundle)
diff --git a/cmake/CelixDeps.cmake.in b/cmake/CelixDeps.cmake.in
index 66d819d9..7a046d86 100644
--- a/cmake/CelixDeps.cmake.in
+++ b/cmake/CelixDeps.cmake.in
@@ -13,10 +13,11 @@ 
$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::celix_pubsub_admin_websocket>>:find_depe
 $<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::framework>>:find_dependency(CURL)>
 $<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::etcdlib>>:find_dependency(CURL)>
 
$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::RsaConfiguredDiscovery>>:find_dependency(RapidJSON)>
-$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::rsa_discovery_common>>:find_dependency(LibXml2)>
+$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::rsa_discovery>>:find_dependency(LibXml2)>
 
$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::bonjour_shell>>:find_dependency(LibXml2)>
 
$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::celix_pubsub_admin_zmq>>:find_dependency(ZeroMQ)>
 
$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::celix_pubsub_admin_zmq>>:find_dependency(czmq)>
 
$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::pubsub_admin_nanomsg>>:find_dependency(NanoMsg)>
 
$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::http_admin_api>>:find_dependency(civetweb)>
+$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::rsa_discovery>>:find_dependency(civetweb)>
 
$<$<BOOL:$<TARGET_NAME_IF_EXISTS:Celix::rsa_discovery_zeroconf>>:find_dependency(DNSSD)>
diff --git a/conanfile.py b/conanfile.py
index d52a711f..6bec65f3 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -68,6 +68,7 @@ class CelixConan(ConanFile):
         "build_cxx_rsa_integration": [True, False],
         "build_remote_service_admin": [True, False],
         "build_rsa_remote_service_admin_dfi": [True, False],
+        "build_rsa_discovery_common": [True, False],
         "build_rsa_discovery_configured": [True, False],
         "build_rsa_discovery_etcd": [True, False],
         "build_rsa_remote_service_admin_shm_v2": [True, False],
@@ -128,6 +129,7 @@ class CelixConan(ConanFile):
         "build_cxx_rsa_integration": False,
         "build_remote_service_admin": False,
         "build_rsa_remote_service_admin_dfi": False,
+        "build_rsa_discovery_common": False,
         "build_rsa_discovery_configured": False,
         "build_rsa_discovery_etcd": False,
         "build_rsa_remote_service_admin_shm_v2": False,
@@ -282,6 +284,21 @@ class CelixConan(ConanFile):
             self.options.build_log_helper = True
             self.options.celix_cxx17 = True
 
+        if self.options.build_rsa_discovery_etcd:
+            self.options.build_celix_etcdlib = True
+            self.options.build_rsa_discovery_common = True
+
+        if self.options.build_rsa_discovery_configured:
+            self.options.build_rsa_discovery_common = True
+
+        if self.options.build_rsa_discovery_common:
+            self.options.build_remote_service_admin = True
+
+        if self.options.build_remote_service_admin:
+            self.options.build_framework = True
+            self.options.build_log_helper = True
+            self.options.build_celix_dfi = True
+
         if self.options.build_remote_shell:
             self.options.build_shell = True
 
@@ -346,7 +363,7 @@ class CelixConan(ConanFile):
             self.options['gtest'].shared = True
             if self.options.enable_address_sanitizer:
                 self.options["cpputest"].with_leak_detection = False
-        if self.options.build_remote_service_admin or 
self.options.build_shell_bonjour:
+        if self.options.build_rsa_discovery_common or 
self.options.build_shell_bonjour:
             self.requires("libxml2/[>=2.9.9 <3.0.0]")
             self.options['libxml2'].shared = True
         if self.options.build_cxx_remote_service_admin:
@@ -356,7 +373,7 @@ class CelixConan(ConanFile):
             self.options['zeromq'].shared = True
             self.requires("czmq/4.2.0")
             self.options['czmq'].shared = True
-        if self.options.build_http_admin or 
self.options.build_remote_service_admin:
+        if self.options.build_http_admin or 
self.options.build_rsa_discovery_common:
             self.requires("civetweb/1.15")
             self.options['civetweb'].shared = True
         if self.options.build_celix_dfi:

Reply via email to