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 28e0fdfab2407c910605141778a88d5ed9134a76
Author: PengZheng <[email protected]>
AuthorDate: Fri Jul 14 21:58:20 2023 +0800

    Add missing test_package.
---
 conanfile.py                                       |  3 +-
 examples/conan_test_package/CMakeLists.txt         | 66 ++++++++++++++++++++++
 examples/conan_test_package/conanfile.py           | 52 ++++++++++++++++-
 examples/conan_test_package/test_celix_dfi.c       | 25 ++++++++
 examples/conan_test_package/test_log_helper.c      | 43 ++++++++++++++
 examples/conan_test_package/test_log_service_api.c | 25 ++++++++
 examples/conan_test_package/test_rsa_spi.cc        | 25 ++++++++
 examples/conan_test_package/test_shell.c           |  1 +
 examples/conan_test_package/test_shell_api.c       | 26 +++++++++
 examples/conan_test_package/test_utils.c           | 28 +++++++++
 10 files changed, 290 insertions(+), 4 deletions(-)

diff --git a/conanfile.py b/conanfile.py
index c40a87e1..342c9654 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -449,4 +449,5 @@ class CelixConan(ConanFile):
         # check 
https://docs.conan.io/en/latest/reference/conanfile/methods.html#imports
         self.cpp_info.bindirs = ["bin", os.path.join("share", self.name, 
"bundles")]
         self.cpp_info.build_modules["cmake"].append(os.path.join("lib", 
"cmake", "Celix", "CelixConfig.cmake"))
-        
self.cpp_info.build_modules["cmake_find_package"].append(os.path.join("lib", 
"cmake", "Celix", "CelixConfig.cmake"))
+        
self.cpp_info.build_modules["cmake_find_package"].append(os.path.join("lib", 
"cmake",
+                                                                              
"Celix", "CelixConfig.cmake"))
diff --git a/examples/conan_test_package/CMakeLists.txt 
b/examples/conan_test_package/CMakeLists.txt
index 09323552..2de423d4 100644
--- a/examples/conan_test_package/CMakeLists.txt
+++ b/examples/conan_test_package/CMakeLists.txt
@@ -297,3 +297,69 @@ if (TEST_PUSHSTREAMS)
     target_link_libraries(use_pushstreams PRIVATE Celix::PushStreams)
 endif ()
 
+option(TEST_DEPLOYMENT_ADMIN "Test deployment admin" OFF)
+if (TEST_DEPLOYMENT_ADMIN)
+    add_celix_container("use_deployment_admin" BUNDLES Celix::deployment_admin 
hello)
+endif ()
+
+option(TEST_LOG_HELPER "Test log helper" OFF)
+if (TEST_LOG_HELPER)
+    add_executable(use_log_helper test_log_helper.c)
+    target_link_libraries(use_log_helper PRIVATE Celix::log_helper)
+endif ()
+
+option(TEST_LOG_SERVICE_API "Test log service api" OFF)
+if (TEST_LOG_SERVICE_API)
+    add_executable(use_log_service_api test_log_service_api.c)
+    target_link_libraries(use_log_service_api PRIVATE Celix::log_service_api)
+endif ()
+
+option(TEST_PUBSUB_WIRE_PROTOCOL_V1 "Test pubsub wire protocol v1" OFF)
+if (TEST_PUBSUB_WIRE_PROTOCOL_V1)
+    add_celix_container("use_pubsub_wire_protocol_v1" BUNDLES 
Celix::celix_pubsub_protocol_wire_v1 hello)
+endif ()
+
+option(TEST_PUBSUB_WIRE_PROTOCOL_V2 "Test pubsub wire protocol v2" OFF)
+if (TEST_PUBSUB_WIRE_PROTOCOL_V2)
+    add_celix_container("use_pubsub_wire_protocol_v2" BUNDLES 
Celix::celix_pubsub_protocol_wire_v2 hello)
+endif ()
+
+option(TEST_PUBSUB_JSON_SERIALIZER "Test pubsub json serializer" OFF)
+if (TEST_PUBSUB_JSON_SERIALIZER)
+    add_celix_container("use_pubsub_json_serializer" BUNDLES 
Celix::celix_pubsub_serializer_json hello)
+endif ()
+
+option(TEST_PUBSUB_AVROBIN_SERIALIZER "Test pubsub avrobin serializer" OFF)
+if (TEST_PUBSUB_AVROBIN_SERIALIZER)
+    add_celix_container("use_pubsub_avrobin_serializer" BUNDLES 
Celix::celix_pubsub_serializer_avrobin hello)
+endif ()
+
+option(TEST_CXX_REMOTE_SERVICE_ADMIN "Test C++ remote service admin" OFF)
+if (TEST_CXX_REMOTE_SERVICE_ADMIN)
+    add_celix_container("use_cxx_remote_service_admin" BUNDLES 
Celix::RemoteServiceAdmin hello)
+    add_executable(use_rsa_spi test_rsa_spi.cc)
+    target_link_libraries(use_rsa_spi PRIVATE Celix::rsa_spi)
+endif ()
+
+option(TEST_SHELL_API "Test shell api" OFF)
+if (TEST_SHELL_API)
+    add_executable(use_shell_api test_shell_api.c)
+    target_link_libraries(use_shell_api PRIVATE Celix::shell_api)
+endif ()
+
+option(TEST_SHELL_BONJOUR "Test shell bonjour" OFF)
+if (TEST_SHELL_BONJOUR)
+    add_celix_container("use_shell_bonjour" INSTALL_BUNDLES 
Celix::bonjour_shell BUNDLES hello)
+endif ()
+
+option(TEST_CELIX_DFI "Test Celix DFI" OFF)
+if (TEST_CELIX_DFI)
+    add_executable(use_celix_dfi test_celix_dfi.c)
+    target_link_libraries(use_celix_dfi PRIVATE Celix::dfi)
+endif ()
+
+option(TEST_UTILS "Test utils" OFF)
+if (TEST_UTILS)
+    add_executable(use_utils test_utils.c)
+    target_link_libraries(use_utils PRIVATE Celix::utils)
+endif ()
\ No newline at end of file
diff --git a/examples/conan_test_package/conanfile.py 
b/examples/conan_test_package/conanfile.py
index 79d73626..3c2e0d02 100644
--- a/examples/conan_test_package/conanfile.py
+++ b/examples/conan_test_package/conanfile.py
@@ -22,7 +22,7 @@ import os
 class TestPackageConan(ConanFile):
     settings = "os", "arch", "compiler", "build_type"
     generators = "cmake_paths", "cmake_find_package"
-    # requires = "celix/2.3.0@docker/test"
+    requires = "celix/2.3.0@docker/test"
 
     def build(self):
         cmake = CMake(self)
@@ -53,6 +53,18 @@ class TestPackageConan(ConanFile):
         cmake.definitions["TEST_LAUNCHER"] = 
self.options["celix"].build_launcher
         cmake.definitions["TEST_PROMISES"] = 
self.options["celix"].build_promises
         cmake.definitions["TEST_PUSHSTREAMS"] = 
self.options["celix"].build_pushstreams
+        cmake.definitions["TEST_DEPLOYMENT_ADMIN"] = 
self.options["celix"].build_deployment_admin
+        cmake.definitions["TEST_LOG_HELPER"] = 
self.options["celix"].build_log_helper
+        cmake.definitions["TEST_LOG_SERVICE_API"] = 
self.options["celix"].build_log_service_api
+        cmake.definitions["TEST_PUBSUB_WIRE_PROTOCOL_V1"] = 
self.options["celix"].build_pubsub_wire_protocol_v1
+        cmake.definitions["TEST_PUBSUB_WIRE_PROTOCOL_V2"] = 
self.options["celix"].build_pubsub_wire_protocol_v2
+        cmake.definitions["TEST_PUBSUB_JSON_SERIALIZER"] = 
self.options["celix"].build_pubsub_json_serializer
+        cmake.definitions["TEST_PUBSUB_AVROBIN_SERIALIZER"] = 
self.options["celix"].build_pubsub_avrobin_serializer
+        cmake.definitions["TEST_CXX_REMOTE_SERVICE_ADMIN"] = 
self.options["celix"].build_cxx_remote_service_admin
+        cmake.definitions["TEST_SHELL_API"] = 
self.options["celix"].build_shell_api
+        cmake.definitions["TEST_SHELL_BONJOUR"] = 
self.options["celix"].build_shell_bonjour
+        cmake.definitions["TEST_CELIX_DFI"] = 
self.options["celix"].build_celix_dfi
+        cmake.definitions["TEST_UTILS"] = self.options["celix"].build_utils
         cmake.definitions["CMAKE_PROJECT_test_package_INCLUDE"] = 
os.path.join(self.build_folder, "conan_paths.cmake")
         # the following is workaround 
https://github.com/conan-io/conan/issues/7192
         if self.settings.os == "Linux":
@@ -83,7 +95,8 @@ class TestPackageConan(ConanFile):
             if self.options["celix"].build_pubsub_psa_ws:
                 self.run("./use_psa_ws", cwd=os.path.join("deploy", 
"use_psa_ws"), run_environment=True)
             if self.options["celix"].build_pubsub_discovery_etcd:
-                self.run("./use_psa_discovery_etcd", 
cwd=os.path.join("deploy", "use_psa_discovery_etcd"), run_environment=True)
+                self.run("./use_psa_discovery_etcd",
+                         cwd=os.path.join("deploy", "use_psa_discovery_etcd"), 
run_environment=True)
             if self.options["celix"].build_remote_service_admin:
                 self.run("./use_my_rsa", cwd=os.path.join("deploy", 
"use_my_rsa"), run_environment=True)
                 self.run("./use_c_rsa_spi", run_environment=True)
@@ -98,7 +111,8 @@ class TestPackageConan(ConanFile):
             if self.options["celix"].build_rsa_discovery_etcd:
                 self.run("./use_rsa_etcd", cwd=os.path.join("deploy", 
"use_rsa_etcd"), run_environment=True)
             if self.options["celix"].build_rsa_discovery_zeroconf:
-                self.run("./use_rsa_discovery_zeroconf", 
cwd=os.path.join("deploy", "use_rsa_discovery_zeroconf"), run_environment=True)
+                self.run("./use_rsa_discovery_zeroconf",
+                         cwd=os.path.join("deploy", 
"use_rsa_discovery_zeroconf"), run_environment=True)
             if self.options["celix"].build_shell:
                 self.run("./use_shell", run_environment=True)
                 if self.options["celix"].celix_cxx17 or 
self.options["celix"].celix_cxx14:
@@ -117,3 +131,35 @@ class TestPackageConan(ConanFile):
                 self.run("./use_promises", run_environment=True)
             if self.options["celix"].build_pushstreams:
                 self.run("./use_pushstreams", run_environment=True)
+            if self.options["celix"].build_deployment_admin:
+                self.run("./use_deployment_admin",
+                         cwd=os.path.join("deploy", "use_deployment_admin"), 
run_environment=True)
+            if self.options["celix"].build_log_helper:
+                self.run("./use_log_helper", run_environment=True)
+            if self.options["celix"].build_log_service_api:
+                self.run("./use_log_service_api", run_environment=True)
+            if self.options["celix"].build_pubsub_wire_protocol_v1:
+                self.run("./use_pubsub_wire_protocol_v1",
+                         cwd=os.path.join("deploy", 
"use_pubsub_wire_protocol_v1"), run_environment=True)
+            if self.options["celix"].build_pubsub_wire_protocol_v2:
+                self.run("./use_pubsub_wire_protocol_v2",
+                         cwd=os.path.join("deploy", 
"use_pubsub_wire_protocol_v2"), run_environment=True)
+            if self.options["celix"].build_pubsub_json_serializer:
+                self.run("./use_pubsub_json_serializer",
+                         cwd=os.path.join("deploy", 
"use_pubsub_json_serializer"), run_environment=True)
+            if self.options["celix"].build_pubsub_avrobin_serializer:
+                self.run("./use_pubsub_avrobin_serializer",
+                         cwd=os.path.join("deploy", 
"use_pubsub_avrobin_serializer"), run_environment=True)
+            if self.options["celix"].build_cxx_remote_service_admin:
+                self.run("./use_cxx_remote_service_admin",
+                         cwd=os.path.join("deploy", 
"use_cxx_remote_service_admin"), run_environment=True)
+                self.run("./use_rsa_spi", run_environment=True)
+            if self.options["celix"].build_shell_api:
+                self.run("./use_shell_api", run_environment=True)
+            if self.options["celix"].build_shell_bonjour:
+                self.run("./use_shell_bonjour",
+                         cwd=os.path.join("deploy", "use_shell_bonjour"), 
run_environment=True)
+            if self.options["celix"].build_celix_dfi:
+                self.run("./use_celix_dfi", run_environment=True)
+            if self.options["celix"].build_utils:
+                self.run("./use_utils", run_environment=True)
diff --git a/examples/conan_test_package/test_celix_dfi.c 
b/examples/conan_test_package/test_celix_dfi.c
new file mode 100644
index 00000000..a592acbe
--- /dev/null
+++ b/examples/conan_test_package/test_celix_dfi.c
@@ -0,0 +1,25 @@
+//  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.
+//
+
+#include <dyn_interface.h>
+#include <stdio.h>
+
+int main() {
+    printf("sizeof(struct method_entry) = %zu\n", sizeof(struct method_entry));
+    return 0;
+}
\ No newline at end of file
diff --git a/examples/conan_test_package/test_log_helper.c 
b/examples/conan_test_package/test_log_helper.c
new file mode 100644
index 00000000..49a9371c
--- /dev/null
+++ b/examples/conan_test_package/test_log_helper.c
@@ -0,0 +1,43 @@
+//  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.
+//
+
+#include <celix_framework.h>
+#include <celix_framework_factory.h>
+#include <celix_log_helper.h>
+
+int main() {
+    celix_properties_t *properties = NULL;
+    properties = celix_properties_create();
+    celix_properties_setBool(properties, "LOGHELPER_ENABLE_STDOUT_FALLBACK", 
true);
+    celix_properties_setBool(properties, "org.osgi.framework.storage.clean", 
true);
+    celix_properties_set(properties, "org.osgi.framework.storage", 
".cacheBundleContextTestFramework");
+    celix_framework_t *fw = celix_frameworkFactory_createFramework(properties);
+    celix_bundle_context_t *ctx = celix_framework_getFrameworkContext(fw);
+    celix_log_helper_t *logHelper = celix_logHelper_create(ctx, 
"example_log_helper");
+
+    celix_logHelper_trace(logHelper, "Hello from log helper");
+    celix_logHelper_debug(logHelper, "Hello from log helper");
+    celix_logHelper_info(logHelper, "Hello from log helper");
+    celix_logHelper_warning(logHelper, "Hello from log helper");
+    celix_logHelper_error(logHelper, "Hello from log helper");
+    celix_logHelper_fatal(logHelper, "Hello from log helper");
+
+    celix_logHelper_destroy(logHelper);
+    celix_frameworkFactory_destroyFramework(fw);
+    return 0;
+}
\ No newline at end of file
diff --git a/examples/conan_test_package/test_log_service_api.c 
b/examples/conan_test_package/test_log_service_api.c
new file mode 100644
index 00000000..d0bc75fb
--- /dev/null
+++ b/examples/conan_test_package/test_log_service_api.c
@@ -0,0 +1,25 @@
+//  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.
+//
+
+#include <celix_log_service.h>
+#include <stdio.h>
+
+int main() {
+    printf("sizeof(celix_log_service_t) = %zu\n", sizeof(celix_log_service_t));
+    return 0;
+}
diff --git a/examples/conan_test_package/test_rsa_spi.cc 
b/examples/conan_test_package/test_rsa_spi.cc
new file mode 100644
index 00000000..5ed78fe1
--- /dev/null
+++ b/examples/conan_test_package/test_rsa_spi.cc
@@ -0,0 +1,25 @@
+//  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.
+//
+
+#include <celix/rsa/EndpointDescription.h>
+#include <stdio.h>
+
+int main() {
+    printf("sizeof(celix::rsa::EndpointDescription) = %zu\n", 
sizeof(celix::rsa::EndpointDescription));
+    return 0;
+}
\ No newline at end of file
diff --git a/examples/conan_test_package/test_shell.c 
b/examples/conan_test_package/test_shell.c
index 67f44a00..db693732 100644
--- a/examples/conan_test_package/test_shell.c
+++ b/examples/conan_test_package/test_shell.c
@@ -23,6 +23,7 @@
 #include <celix_properties.h>
 #include <celix_shell_command.h>
 #include <celix_shell.h>
+#include <stdio.h>
 
 static void use(void *handle, void *svc) {
     celix_shell_t *shell = svc;
diff --git a/examples/conan_test_package/test_shell_api.c 
b/examples/conan_test_package/test_shell_api.c
new file mode 100644
index 00000000..b4d34206
--- /dev/null
+++ b/examples/conan_test_package/test_shell_api.c
@@ -0,0 +1,26 @@
+//  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.
+//
+
+#include <celix_shell.h>
+#include <stdio.h>
+
+int main() {
+    printf("sizeof(celix_shell_t) = %zu\n", sizeof(celix_shell_t));
+    return 0;
+}
+
diff --git a/examples/conan_test_package/test_utils.c 
b/examples/conan_test_package/test_utils.c
new file mode 100644
index 00000000..645a1259
--- /dev/null
+++ b/examples/conan_test_package/test_utils.c
@@ -0,0 +1,28 @@
+//  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.
+//
+
+#include <celix_utils.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main() {
+    char *dup = celix_utils_strdup("Hello World");
+    printf("dup = %s\n", dup);
+    free(dup);
+    return 0;
+}
\ No newline at end of file

Reply via email to