From 085b4ffc27807b01aaf989a771cf3779fbf98cad Mon Sep 17 00:00:00 2001 From: Pepijn Noltes Date: Sun, 15 Oct 2023 14:05:07 +0200 Subject: [PATCH 01/11] #509: Remove deprecated wire.c, requirement.c and capability.c --- libs/framework/CMakeLists.txt | 1 - libs/framework/include_deprecated/bundle.h | 1 - .../framework/include_deprecated/capability.h | 55 -------- libs/framework/include_deprecated/module.h | 2 - .../include_deprecated/requirement.h | 48 ------- libs/framework/include_deprecated/wire.h | 121 ------------------ libs/framework/src/capability.c | 54 -------- libs/framework/src/capability_private.h | 40 ------ libs/framework/src/framework_private.h | 1 - libs/framework/src/manifest_parser.c | 5 - libs/framework/src/module.c | 4 - libs/framework/src/requirement.c | 56 -------- libs/framework/src/requirement_private.h | 39 ------ libs/framework/src/wire.c | 67 ---------- 14 files changed, 494 deletions(-) delete mode 100644 libs/framework/include_deprecated/capability.h delete mode 100644 libs/framework/include_deprecated/requirement.h delete mode 100644 libs/framework/include_deprecated/wire.h delete mode 100644 libs/framework/src/capability.c delete mode 100644 libs/framework/src/capability_private.h delete mode 100644 libs/framework/src/requirement.c delete mode 100644 libs/framework/src/requirement_private.h delete mode 100644 libs/framework/src/wire.c diff --git a/libs/framework/CMakeLists.txt b/libs/framework/CMakeLists.txt index 7faa89c64..a1c749050 100644 --- a/libs/framework/CMakeLists.txt +++ b/libs/framework/CMakeLists.txt @@ -27,7 +27,6 @@ if (FRAMEWORK) src/bundle_context.c src/bundle_revision.c src/framework.c src/manifest.c src/manifest_parser.c src/module.c - src/requirement.c src/capability.c src/wire.c src/service_reference.c src/service_registration.c src/service_registry.c src/service_tracker.c src/service_tracker_customizer.c src/celix_log.c src/celix_launcher.c diff --git a/libs/framework/include_deprecated/bundle.h b/libs/framework/include_deprecated/bundle.h index cdc463dd4..c1d8cc445 100644 --- a/libs/framework/include_deprecated/bundle.h +++ b/libs/framework/include_deprecated/bundle.h @@ -26,7 +26,6 @@ #include "celix_bundle_state.h" #include "bundle_archive.h" #include "framework.h" -#include "wire.h" #include "module.h" #include "service_reference.h" #include "celix_log.h" diff --git a/libs/framework/include_deprecated/capability.h b/libs/framework/include_deprecated/capability.h deleted file mode 100644 index ada46bc36..000000000 --- a/libs/framework/include_deprecated/capability.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -/** - * capability.h - * - * \date Jul 12, 2010 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#ifndef CAPABILITY_H_ -#define CAPABILITY_H_ - -typedef struct capability *capability_pt; - -#include "hash_map.h" -#include "module.h" -#include "celix_framework_export.h" - -#ifdef __cplusplus -extern "C" { -#endif - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t -capability_create(module_pt module, hash_map_pt directives, hash_map_pt attributes, capability_pt *capability); - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t capability_destroy(capability_pt capability); - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t capability_getServiceName(capability_pt capability, const char **serviceName); - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t capability_getVersion(capability_pt capability, version_pt *version); - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t capability_getModule(capability_pt capability, module_pt *module); - -#ifdef __cplusplus -} -#endif - -#endif /* CAPABILITY_H_ */ diff --git a/libs/framework/include_deprecated/module.h b/libs/framework/include_deprecated/module.h index 6bd94f8c6..3c09f666e 100644 --- a/libs/framework/include_deprecated/module.h +++ b/libs/framework/include_deprecated/module.h @@ -53,8 +53,6 @@ CELIX_FRAMEWORK_DEPRECATED_EXPORT unsigned int module_hash(void *module); CELIX_FRAMEWORK_DEPRECATED_EXPORT int module_equals(void *module, void *compare); -CELIX_FRAMEWORK_DEPRECATED_EXPORT wire_pt module_getWire(module_pt module, const char *serviceName); - CELIX_FRAMEWORK_DEPRECATED_EXPORT version_pt module_getVersion(module_pt module); CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t module_getSymbolicName(module_pt module, const char **symbolicName); diff --git a/libs/framework/include_deprecated/requirement.h b/libs/framework/include_deprecated/requirement.h deleted file mode 100644 index 186797888..000000000 --- a/libs/framework/include_deprecated/requirement.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ - -#ifndef REQUIREMENT_H_ -#define REQUIREMENT_H_ - -typedef struct requirement *requirement_pt; - -#include "capability.h" -#include "hash_map.h" -#include "celix_version_range.h" -#include "celix_framework_export.h" - -#ifdef __cplusplus -extern "C" { -#endif - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t requirement_create(hash_map_pt directives, hash_map_pt attributes, requirement_pt *requirement); - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t requirement_destroy(requirement_pt requirement); - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t requirement_getVersionRange(requirement_pt requirement, celix_version_range_t **range); - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t requirement_getTargetName(requirement_pt requirement, const char **targetName); - -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t requirement_isSatisfied(requirement_pt requirement, capability_pt capability, bool *inRange); - -#ifdef __cplusplus -} -#endif - -#endif /* REQUIREMENT_H_ */ diff --git a/libs/framework/include_deprecated/wire.h b/libs/framework/include_deprecated/wire.h deleted file mode 100644 index 29c41d9ef..000000000 --- a/libs/framework/include_deprecated/wire.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ -/** - * wire.h - * - * \date Jul 12, 2010 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#ifndef WIRE_H_ -#define WIRE_H_ - -typedef struct wire *wire_pt; - -#include "requirement.h" -#include "capability.h" -#include "module.h" -#include "linked_list.h" -#include "module.h" -#include "celix_framework_export.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup Version Version - * @ingroup framework - * @{ - */ - -/** - * Create a wire between two modules using a requirement and capability. - * - * @param importer The importer module of the wire. - * @param requirement The requirement of the importer. - * @param exporter The exporter module of the wire. - * @param capability The capability of the wire. - * @param wire The created wire. - * @return Status code indication failure or success: - * - CELIX_SUCCESS when no errors are encountered. - * - CELIX_ENOMEM If allocating memory for wire failed. - */ -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t wire_create(module_pt importer, requirement_pt requirement, - module_pt exporter, capability_pt capability, wire_pt *wire); - -/** - * Getter for the capability of the exporting module. - * - * @param wire The wire to get the capability from. - * @param capability The capability - * @return Status code indication failure or success: - * - CELIX_SUCCESS when no errors are encountered. - */ -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t wire_destroy(wire_pt wire); - -/** - * Getter for the capability of the exporting module. - * - * @param wire The wire to get the capability from. - * @param capability The capability - * @return Status code indication failure or success: - * - CELIX_SUCCESS when no errors are encountered. - */ -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t wire_getCapability(wire_pt wire, capability_pt *capability); - -/** - * Getter for the requirement of the importing module. - * - * @param wire The wire to get the requirement from. - * @param requirement The requirement - * @return Status code indication failure or success: - * - CELIX_SUCCESS when no errors are encountered. - */ -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t wire_getRequirement(wire_pt wire, requirement_pt *requirement); - -/** - * Getter for the importer of the wire. - * - * @param wire The wire to get the importer from. - * @param importer The importing module. - * @return Status code indication failure or success: - * - CELIX_SUCCESS when no errors are encountered. - */ -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t wire_getImporter(wire_pt wire, module_pt *importer); - -/** - * Getter for the exporter of the wire. - * - * @param wire The wire to get the exporter from. - * @param exporter The exporting module. - * @return Status code indication failure or success: - * - CELIX_SUCCESS when no errors are encountered. - */ -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t wire_getExporter(wire_pt wire, module_pt *exporter); - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* WIRE_H_ */ diff --git a/libs/framework/src/capability.c b/libs/framework/src/capability.c deleted file mode 100644 index 333a141b5..000000000 --- a/libs/framework/src/capability.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -/** - * capability.c - * - * \date Jul 12, 2010 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#include - -#include "capability_private.h" -#include "celix_log.h" - -//LCOV_EXCL_START -celix_status_t capability_create(module_pt module, hash_map_pt directives, hash_map_pt attributes, capability_pt *capability) { - celix_status_t status = CELIX_FRAMEWORK_EXCEPTION; - framework_logIfError(celix_frameworkLogger_globalLogger(), status, NULL, "Failed to create capability"); - return status; -} - -celix_status_t capability_destroy(capability_pt capability) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t capability_getServiceName(capability_pt capability, const char **serviceName) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t capability_getVersion(capability_pt capability, version_pt *version) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t capability_getModule(capability_pt capability, module_pt *module) { - return CELIX_FRAMEWORK_EXCEPTION; -} -//LCOV_EXCL_STOP diff --git a/libs/framework/src/capability_private.h b/libs/framework/src/capability_private.h deleted file mode 100644 index d226bb36d..000000000 --- a/libs/framework/src/capability_private.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - */ -/** - * capability_private.h - * - * \date Feb 11, 2013 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#ifndef CAPABILITY_PRIVATE_H_ -#define CAPABILITY_PRIVATE_H_ - -#include "capability.h" - -struct capability { - char * serviceName; - module_pt module; - version_pt version; - hash_map_pt attributes; - hash_map_pt directives; -}; - -#endif /* CAPABILITY_PRIVATE_H_ */ diff --git a/libs/framework/src/framework_private.h b/libs/framework/src/framework_private.h index 0b1a9a78b..6e6cd7a2f 100644 --- a/libs/framework/src/framework_private.h +++ b/libs/framework/src/framework_private.h @@ -25,7 +25,6 @@ #include "celix_framework.h" #include "framework.h" #include "manifest.h" -#include "wire.h" #include "hash_map.h" #include "array_list.h" #include "celix_errno.h" diff --git a/libs/framework/src/manifest_parser.c b/libs/framework/src/manifest_parser.c index af3113741..479f094c8 100644 --- a/libs/framework/src/manifest_parser.c +++ b/libs/framework/src/manifest_parser.c @@ -27,15 +27,10 @@ #include #include -#include "utils.h" #include "celix_utils.h" #include "celix_constants.h" #include "manifest_parser.h" -#include "capability.h" -#include "requirement.h" -#include "hash_map.h" #include "celix_errno.h" -#include "linked_list_iterator.h" #include "celix_log.h" struct manifestParser { diff --git a/libs/framework/src/module.c b/libs/framework/src/module.c index 78d2641b7..0ff490574 100644 --- a/libs/framework/src/module.c +++ b/libs/framework/src/module.c @@ -139,10 +139,6 @@ void module_destroy(module_pt module) { free(module); } -wire_pt module_getWire(module_pt module, const char * serviceName) { - return NULL; -} - version_pt module_getVersion(module_pt module) { return module->version; } diff --git a/libs/framework/src/requirement.c b/libs/framework/src/requirement.c deleted file mode 100644 index 537fe3c7b..000000000 --- a/libs/framework/src/requirement.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -/** - * requirement.c - * - * \date Jul 12, 2010 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#include "celix_errno.h" -#include "celix_log.h" -#include "requirement_private.h" -#include "hash_map.h" - -//LCOV_EXCL_START -celix_status_t requirement_create(hash_map_pt directives, hash_map_pt attributes, requirement_pt *requirement) { - celix_status_t status = CELIX_FRAMEWORK_EXCEPTION; - framework_logIfError(celix_frameworkLogger_globalLogger(), status, NULL, "Cannot create requirement"); - return status; -} - -celix_status_t requirement_destroy(requirement_pt requirement) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t requirement_getVersionRange(requirement_pt requirement, celix_version_range_t **range) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t requirement_getTargetName(requirement_pt requirement, const char **targetName) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t requirement_isSatisfied(requirement_pt requirement, capability_pt capability, bool *inRange) { - celix_status_t status = CELIX_FRAMEWORK_EXCEPTION; - framework_logIfError(celix_frameworkLogger_globalLogger(), status, NULL, "Cannot check if requirement is satisfied"); - return status; -} -//LCOV_EXCL_STOP diff --git a/libs/framework/src/requirement_private.h b/libs/framework/src/requirement_private.h deleted file mode 100644 index 3ac8d5114..000000000 --- a/libs/framework/src/requirement_private.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/** - * requirement_private.h - * - * \date Feb 11, 2013 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#ifndef REQUIREMENT_PRIVATE_H_ -#define REQUIREMENT_PRIVATE_H_ - -#include "requirement.h" - -struct requirement { - char * targetName; - celix_version_range_t* versionRange; - hash_map_pt attributes; - hash_map_pt directives; -}; - -#endif /* REQUIREMENT_PRIVATE_H_ */ diff --git a/libs/framework/src/wire.c b/libs/framework/src/wire.c deleted file mode 100644 index ae13dd8f6..000000000 --- a/libs/framework/src/wire.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -/** - * wire.c - * - * \date Jul 19, 2010 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#include - -#include "wire.h" - -struct wire { - module_pt importer; - requirement_pt requirement; - module_pt exporter; - capability_pt capability; -}; - -//LCOV_EXCL_START -celix_status_t wire_create( - module_pt importer, requirement_pt requirement, module_pt exporter, capability_pt capability, wire_pt* wire) { - celix_status_t status = CELIX_FRAMEWORK_EXCEPTION; - - framework_logIfError(celix_frameworkLogger_globalLogger(), status, NULL, "Cannot create wire"); - - return status; -} - -celix_status_t wire_destroy(wire_pt wire) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t wire_getCapability(wire_pt wire, capability_pt *capability) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t wire_getRequirement(wire_pt wire, requirement_pt *requirement) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t wire_getImporter(wire_pt wire, module_pt *importer) { - return CELIX_FRAMEWORK_EXCEPTION; -} - -celix_status_t wire_getExporter(wire_pt wire, module_pt *exporter) { - return CELIX_FRAMEWORK_EXCEPTION; -} -//LCOV_EXCL_STOP From 82bb83424d8cc8357e419f101b786316fce491e8 Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Thu, 19 Oct 2023 10:09:03 +0800 Subject: [PATCH 02/11] Resolve address sanitizer error for `celix_filter_create` --- libs/utils/gtest/src/FilterTestSuite.cc | 8 ++++++++ libs/utils/src/filter.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/utils/gtest/src/FilterTestSuite.cc b/libs/utils/gtest/src/FilterTestSuite.cc index 3a1b41c02..55fb5e2c3 100644 --- a/libs/utils/gtest/src/FilterTestSuite.cc +++ b/libs/utils/gtest/src/FilterTestSuite.cc @@ -418,6 +418,14 @@ TEST_F(FilterTestSuite, AutoCleanupTest) { celix_autoptr(celix_filter_t) filter = celix_filter_create("(test_attr1=attr1)"); } +TEST_F(FilterTestSuite, create_fail_missing_filter_operand) { + celix_filter_t * filter= celix_filter_create("(&(test))"); + ASSERT_TRUE(filter == NULL); + + filter= celix_filter_create("(!(test))"); + ASSERT_TRUE(filter == NULL); +} + #include "filter.h" TEST_F(FilterTestSuite, deprecatedApi) { auto* f1 = filter_create("(test_attr1=attr1)"); diff --git a/libs/utils/src/filter.c b/libs/utils/src/filter.c index 535ab4c04..e59312906 100644 --- a/libs/utils/src/filter.c +++ b/libs/utils/src/filter.c @@ -145,7 +145,7 @@ static celix_filter_t * filter_parseAndOrOr(char * filterString, celix_filter_op filter_destroy(f); } celix_arrayList_destroy(children); - children = NULL; + return NULL; } celix_filter_t * filter = (celix_filter_t *) calloc(1, sizeof(*filter)); @@ -165,7 +165,9 @@ static celix_filter_t * filter_parseNot(char * filterString, int * pos) { } child = filter_parseFilter(filterString, pos); - + if(child == NULL){ + return NULL; + } celix_array_list_t* children = celix_arrayList_create(); celix_arrayList_add(children, child); From f9a34b7189d0b9639b6aacaa3eb9f1182a4d1db0 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Fri, 27 Oct 2023 12:15:39 +0800 Subject: [PATCH 03/11] Add missing header include. --- libs/pushstreams/api/celix/PushStream.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/pushstreams/api/celix/PushStream.h b/libs/pushstreams/api/celix/PushStream.h index c674a2d33..cce54af16 100644 --- a/libs/pushstreams/api/celix/PushStream.h +++ b/libs/pushstreams/api/celix/PushStream.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "celix/IAutoCloseable.h" From acfe74d3ac095dd0732505c45d30ba6da69b2181 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Fri, 27 Oct 2023 12:20:45 +0800 Subject: [PATCH 04/11] Add missing header include. --- libs/framework/gtest/src/DependencyManagerTestSuite.cc | 1 + libs/framework/include/celix/Bundle.h | 1 + libs/framework/include/celix/ServiceRegistration.h | 1 + libs/framework/include/celix/Trackers.h | 1 + libs/framework/include/celix/dm/Component.h | 1 + libs/pushstreams/api/celix/PushEvent.h | 1 + 6 files changed, 6 insertions(+) diff --git a/libs/framework/gtest/src/DependencyManagerTestSuite.cc b/libs/framework/gtest/src/DependencyManagerTestSuite.cc index 2138515d4..1d03134b6 100644 --- a/libs/framework/gtest/src/DependencyManagerTestSuite.cc +++ b/libs/framework/gtest/src/DependencyManagerTestSuite.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include "celix/dm/DependencyManager.h" #include "celix_framework_factory.h" diff --git a/libs/framework/include/celix/Bundle.h b/libs/framework/include/celix/Bundle.h index d977d3233..67c60394b 100644 --- a/libs/framework/include/celix/Bundle.h +++ b/libs/framework/include/celix/Bundle.h @@ -20,6 +20,7 @@ #pragma once #include +#include #include #include "celix_bundle.h" diff --git a/libs/framework/include/celix/ServiceRegistration.h b/libs/framework/include/celix/ServiceRegistration.h index b5d2898a2..659527b57 100644 --- a/libs/framework/include/celix/ServiceRegistration.h +++ b/libs/framework/include/celix/ServiceRegistration.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include #include diff --git a/libs/framework/include/celix/Trackers.h b/libs/framework/include/celix/Trackers.h index 442f74b73..28edb482c 100644 --- a/libs/framework/include/celix/Trackers.h +++ b/libs/framework/include/celix/Trackers.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include #include diff --git a/libs/framework/include/celix/dm/Component.h b/libs/framework/include/celix/dm/Component.h index 19e792e4f..3085ff3a8 100644 --- a/libs/framework/include/celix/dm/Component.h +++ b/libs/framework/include/celix/dm/Component.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/libs/pushstreams/api/celix/PushEvent.h b/libs/pushstreams/api/celix/PushEvent.h index 8be0a7a9c..810b74af1 100644 --- a/libs/pushstreams/api/celix/PushEvent.h +++ b/libs/pushstreams/api/celix/PushEvent.h @@ -19,6 +19,7 @@ #pragma once +#include #include "celix/IllegalStateException.h" namespace celix { From c933a6a812346ebe3a7dabd66541b962e5e68867 Mon Sep 17 00:00:00 2001 From: xuzhenbao <43104033+xuzhenbao@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:52:27 +0800 Subject: [PATCH 05/11] Update libs/utils/src/filter.c Co-authored-by: Pepijn Noltes --- libs/utils/src/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/utils/src/filter.c b/libs/utils/src/filter.c index e59312906..d03db03f3 100644 --- a/libs/utils/src/filter.c +++ b/libs/utils/src/filter.c @@ -165,7 +165,7 @@ static celix_filter_t * filter_parseNot(char * filterString, int * pos) { } child = filter_parseFilter(filterString, pos); - if(child == NULL){ + if (child == NULL) { return NULL; } celix_array_list_t* children = celix_arrayList_create(); From 3aeb9235464ba033cf3d904ce250cb2fcdc7ce9f Mon Sep 17 00:00:00 2001 From: Pepijn Noltes Date: Sat, 28 Oct 2023 16:03:58 +0200 Subject: [PATCH 06/11] Remove deprecated Apache Celix CMake functions This includes bundle functions without a celix_ prefix, runtime functions and docker functions. --- cmake/celix_project/ApacheRat.cmake | 2 +- cmake/cmake_celix/BundlePackaging.cmake | 60 -- cmake/cmake_celix/DockerPackaging.cmake | 597 ------------------ cmake/cmake_celix/Runtimes.cmake | 253 -------- cmake/cmake_celix/UseCelix.cmake | 3 - cmake/cmake_celix/create_target_filesystem.sh | 215 ------- cmake/cmake_celix/runtime_common.sh.in | 230 ------- cmake/cmake_celix/runtime_start.sh.in | 31 - cmake/cmake_celix/runtime_stop.sh.in | 34 - 9 files changed, 1 insertion(+), 1424 deletions(-) delete mode 100644 cmake/cmake_celix/DockerPackaging.cmake delete mode 100644 cmake/cmake_celix/Runtimes.cmake delete mode 100644 cmake/cmake_celix/create_target_filesystem.sh delete mode 100644 cmake/cmake_celix/runtime_common.sh.in delete mode 100644 cmake/cmake_celix/runtime_start.sh.in delete mode 100644 cmake/cmake_celix/runtime_stop.sh.in diff --git a/cmake/celix_project/ApacheRat.cmake b/cmake/celix_project/ApacheRat.cmake index c18f0dd32..c2b748b1c 100644 --- a/cmake/celix_project/ApacheRat.cmake +++ b/cmake/celix_project/ApacheRat.cmake @@ -41,4 +41,4 @@ if (ENABLE_APACHE_RAT) else(Java_Runtime_FOUND) MESSAGE(STATUS "Java not found, cannot execute Apache RAT checks") endif(Java_Runtime_FOUND) -endif () \ No newline at end of file +endif () diff --git a/cmake/cmake_celix/BundlePackaging.cmake b/cmake/cmake_celix/BundlePackaging.cmake index f006c1c66..112d942f4 100644 --- a/cmake/cmake_celix/BundlePackaging.cmake +++ b/cmake/cmake_celix/BundlePackaging.cmake @@ -101,12 +101,6 @@ function(check_bundle BUNDLE) endif () endfunction() - -function(add_bundle) - message(DEPRECATION "add_bundle is deprecated, use add_celix_bundle instead.") - add_celix_bundle(${ARGN}) -endfunction() - #[[ Add a Celix bundle to the project. @@ -391,11 +385,6 @@ function(add_celix_bundle) celix_bundle_headers(${BUNDLE_TARGET_NAME} ${BUNDLE_HEADERS}) endfunction() -function(bundle_export_libs) - message(DEPRECATION "bundle_export_libs is deprecated, use celix_bundle_export_libs instead.") - celix_bundle_export_libs(${ARGN}) -endfunction() - #[[ Adds a export lib to the Celix bundle. @@ -407,11 +396,6 @@ function(celix_bundle_export_libs) celix_bundle_libs(${BUNDLE} "EXPORT" TRUE ${ARGN}) endfunction() -function(bundle_private_libs) - message(DEPRECATION "bundle_private_libs is deprecated, use celix_bundle_private_libs instead.") - celix_bundle_private_libs(${ARGN}) -endfunction() - #[[ Add libraries to a bundle. @@ -452,10 +436,6 @@ function(celix_bundle_private_libs) celix_bundle_libs(${BUNDLE} "PRIVATE" FALSE ${ARGN}) endfunction() -function(bundle_libs) - message(DEPRECATION "bundle_libs is deprecated, use celix_bundle_libs instead.") - celix_bundle_libs(${ARGN}) -endfunction() function(celix_bundle_libs) #0 is bundle TARGET #1 is TYPE, e.g PRIVATE,EXPORT or IMPORT @@ -544,11 +524,6 @@ function(celix_bundle_libs) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_LIB_TARGETS" "${LIB_TARGETS}") endfunction() -function(bundle_import_libs) - message(DEPRECATION "bundle_import_libs is deprecated, use celix_bundle_import_libs instead.") - celix_bundle_import_libs(${ARGN}) -endfunction() - #[[ Adds a import lib to the Celix bundle. @@ -580,11 +555,6 @@ function(celix_bundle_import_libs) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_IMPORT_LIBS" "${LIBS}") endfunction() -function(bundle_files) - message(DEPRECATION "bundle_files is deprecated, use celix_bundle_files instead.") - celix_bundle_files(${ARGN}) -endfunction() - #[[ Add files to the target bundle. @@ -767,11 +737,6 @@ function(celix_bundle_add_files) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_DEPEND_TARGETS" "${DEPS}") endfunction() -function(bundle_headers) - message(DEPRECATION "bundle_headers is deprecated, use celix_bundle_headers instead.") - celix_bundle_headers(${ARGN}) -endfunction() - #[[ Append the provided headers to the target bundle manifest. @@ -798,11 +763,6 @@ function(celix_bundle_headers) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_HEADERS" "${HEADERS}") endfunction() -function(bundle_symbolic_name) - message(DEPRECATION "bundle_symbolic_name is deprecated, use celix_bundle_symbolic_name instead.") - celix_bundle_symbolic_name(${ARGN}) -endfunction() - #[[ Set bundle symbolic name @@ -845,11 +805,6 @@ function(celix_get_bundle_symbolic_name) endif () endfunction() -function(bundle_name) - message(DEPRECATION "bundle_name is deprecated, use celix_bundle_name instead.") - celix_bundle_name(${ARGN}) -endfunction() - #[[ Set bundle name @@ -861,11 +816,6 @@ function(celix_bundle_name BUNDLE NAME) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_NAME" ${NAME}) endfunction() -function(bundle_version) - message(DEPRECATION "bundle_version is deprecated, use celix_bundle_version instead.") - celix_bundle_version(${ARGN}) -endfunction() - #[[ Set bundle version @@ -877,11 +827,6 @@ function(celix_bundle_version BUNDLE VERSION) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_VERSION" ${VERSION}) endfunction() -function(bundle_description) - message(DEPRECATION "bundle_description is deprecated, use celix_bundle_description instead.") - celix_bundle_description(${ARGN}) -endfunction() - #[[ Set bundle description @@ -967,11 +912,6 @@ function(celix_get_bundle_file) endif () endfunction() -function(install_bundle) - message(DEPRECATION "install_bundle is deprecated, use install_celix_bundle instead.") - install_celix_bundle(${ARGN}) -endfunction() - #[[ Install bundle when 'make install' is executed. diff --git a/cmake/cmake_celix/DockerPackaging.cmake b/cmake/cmake_celix/DockerPackaging.cmake deleted file mode 100644 index 9e8095a7e..000000000 --- a/cmake/cmake_celix/DockerPackaging.cmake +++ /dev/null @@ -1,597 +0,0 @@ -# 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. - -set(CELIX_DEFAULT_CONTAINER_CXX_OPTION ON CACHE BOOL "Whether the default docker options is CXX. If OFF this will be C") - - -##### setup docker target -option(CELIX_BUILD_DOCKER_USE_DOCKER "Use docker to build docker images" ON) -option(CELIX_BUILD_DOCKER_USE_DOCKER_DIR_TAR "Use docker directory tar packages packing" OFF) -if (NOT TARGET celix-build-docker-dirs) - if (APPLE) #create filesystem script is not working on mac os, exclude target from ALL - add_custom_target(celix-build-docker-dirs - DEPENDS $ - ) - else () - add_custom_target(celix-build-docker-dirs ALL - DEPENDS $ - ) - endif () - set_target_properties(celix-build-docker-dirs PROPERTIES "DOCKER_DEPS" "") #initial empty deps list -endif () - -if (CELIX_BUILD_DOCKER_USE_DOCKER) - if (NOT TARGET celix-build-docker-images) - add_custom_target(celix-build-docker-images) - set(DOCKER_USE_SUDO ON CACHE BOOL "Wether the use of sudo is needed to run docker") - set(DOCKER_CMD "docker" CACHE STRING "Docker command to use.") - - get_directory_property(CLEANFILES ADDITIONAL_MAKE_CLEAN_FILES) - list(APPEND CLEANFILES "${CMAKE_BINARY_DIR}/docker") - set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}") - endif () -endif() - -##### - -#[[ -Adds a docker target dir, containing a all the required executables, -libraries, filesystem files and selected bundles needed to run a Apache Celix framework in a docker container. - -The 'add_celix_docker' target is a executable target and can be used to link libraries which are needed in the docker image. - -The docker dir can be found in `/docker[/]/`. - -The docker directories are build with the target `celix-build-docker-dirs`, this does not create the -docker images and can also be executed on systems without docker. The `celix-build-docker-dirs` is trigger -with `make all`. - -The docker images are build with the target `celix-build-docker-images`. For this to work docker needs te installed -and the user executing the `celix-build-docker-images` should have right to create docker images. -The `celix-build-docker-images` is not triggered with `make all` - -There are three variants of 'add_celix_docker': -- If no launcher is specified a custom Celix launcher will be generated. This launcher also contains the configured properties. -- If a LAUNCHER_SRC is provided a Celix launcher will be build using the provided sources. Additional sources can be added with the - CMake 'target_sources' command. -- If a LAUNCHER (absolute path to a executable of CMake `add_executable` target) is provided that will be used as Celix launcher. - -Optional arguments: -- CXX: With this option the generated Celix launcher (if used) will be a C++ source. - This ensures that the Celix launcher is linked against stdlibc++. -- C: With this option the generated Celix launcher (if used) will be a C source. -- GROUP: If configured the build location will be prefixed the GROUP. Default is empty. -- NAME: The name of the executable. Default is . Only useful for generated/LAUNCHER_SRC Celix launchers. -- FROM: Configured the docker image base. Default is scratch. - If configured a minimal filesystem will not be created! -- BUNDLES_DIR: Configures the directory where are all the bundles are copied. Default is /bundles. -- WORKDIR: Configures the workdir of the docker image. Default is /root. -- IMAGE_NAME: Configure the image name. Default is NAME. -- BUNDLES: Configures the used bundles. These bundles are configured for run level 3. see 'celix_docker_bundles' for more info. -- PROPERTIES: Configure configuration properties. -- INSTRUCTIONS: Additional dockker instruction to add the the generated Dockerfile. - -```CMake -add_celix_docker( - [CXX] - [C] - [GROUP group_name] - [NAME deploy_name] - [FROM docker_from_image] - [BUNDLES_DIR bundle_dir_in_docker_image] - [WORKDIR workdir_in_docker_image] - [IMAGE_NAME docker_image_name] - [BUNDLES ...] - [PROPERTIES "prop1=val1" "prop2=val2" ...] - [INSTRUCTIONS "instr1" "instr2" ...] -) -``` - -```CMake -add_celix_docker( - LAUNCHER_SRC launcher_src - [CXX] - [C] - [GROUP group_name] - [NAME deploy_name] - [FROM docker_from_image] - [BUNDLES_DIR bundle_dir_in_docker_image] - [WORKDIR workdir_in_docker_image] - [IMAGE_NAME docker_image_name] - [BUNDLES ...] - [PROPERTIES "prop1=val1" "prop2=val2" ...] - [INSTRUCTIONS "instr1" "instr2" ...] -) -``` - -```CMake -add_celix_docker( - LAUNCHER launcher - [CXX] - [C] - [GROUP group_name] - [NAME deploy_name] - [FROM docker_from_image] - [BUNDLES_DIR bundle_dir_in_docker_image] - [WORKDIR workdir_in_docker_image] - [IMAGE_NAME docker_image_name] - [BUNDLES ...] - [PROPERTIES "prop1=val1" "prop2=val2" ...] - [INSTRUCTIONS "instr1" "instr2" ...] -) -``` -]] -function(add_celix_docker) - message(DEPRECATION "Support for docker creation with Celix CMake commands is deprecated and will be removed in future Celix releases.") - list(GET ARGN 0 DOCKER_TARGET) - list(REMOVE_AT ARGN 0) - - set(OPTIONS C CXX) - set(ONE_VAL_ARGS GROUP NAME FROM BUNDLES_DIR FILES_DIR WORKDIR IMAGE_NAME LAUNCHER LAUNCHER_SRC TAR_LOCATION) - set(MULTI_VAL_ARGS BUNDLES PROPERTIES INSTRUCTIONS FILES) - cmake_parse_arguments(DOCKER "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) - - #set defaults - if (NOT DEFINED DOCKER_FROM) - set(DOCKER_FROM "scratch") - set(DOCKER_CREATE_FS true) - else () - set(DOCKER_CREATE_FS false) - endif () - if (NOT DEFINED DOCKER_NAME) - set(DOCKER_NAME "${DOCKER_TARGET}") - endif () - if (NOT DEFINED DOCKER_IMAGE_NAME) - set(DOCKER_IMAGE_NAME "${DOCKER_NAME}") - endif () - if (NOT DEFINED DOCKER_WORKDIR) - set(DOCKER_WORKDIR "/root") - endif () - if (NOT DEFINED DOCKER_GROUP) - set(DOCKER_LOC "${CMAKE_BINARY_DIR}/docker/${DOCKER_NAME}") - else () - set(DOCKER_LOC "${CMAKE_BINARY_DIR}/docker/${DOCKER_GROUP}/${DOCKER_NAME}") - endif () - if (NOT DEFINED DOCKER_BUNDLES_DIR) - set(DOCKER_BUNDLES_DIR "/bundles") - endif () - - #ensure the docker dir will be deleted during clean - get_directory_property(CLEANFILES ADDITIONAL_MAKE_CLEAN_FILES) - list(APPEND CLEANFILES "$") - set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}") - - if (DOCKER_LAUNCHER) - add_custom_target(${DOCKER_TARGET}) - if (IS_ABSOLUTE "${DOCKER_LAUNCHER}") - set(LAUNCHER "${DOCKER_LAUNCHER}") - get_filename_component(EXE_FILENAME ${DOCKER_LAUNCHER} NAME) - set(DOCKER_ENTRYPOINT "ENTRYPOINT [\"/bin/${EXE_FILENAME}\"]") - else () - #assuming target - set(LAUNCHER "$") - set(DOCKER_ENTRYPOINT "ENTRYPOINT [\"/bin/$\"]") - endif () - elseif (DOCKER_LAUNCHER_SRC) - add_executable(${DOCKER_TARGET} EXCLUDE_FROM_ALL ${DOCKER_LAUNCHER_SRC}) - target_link_libraries(${DOCKER_TARGET} PRIVATE Celix::framework) - set(LAUNCHER "$") - set(DOCKER_ENTRYPOINT "ENTRYPOINT [\"/bin/$\"]") - else () - if (DOCKER_CXX) - set(LAUNCHER_SRC "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-main.cc") - elseif (DOCKER_C) - set(LAUNCHER_SRC "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-main.c") - else() - if (CELIX_DEFAULT_CONTAINER_CXX_OPTION) - set(LAUNCHER_SRC "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-main.cc") - else() - set(LAUNCHER_SRC "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-main.c") - endif() - endif () - - file(GENERATE - OUTPUT ${LAUNCHER_SRC} - CONTENT "#include - -int main(int argc, char *argv[]) { - const char * config = \"\\ -$,\\n\\ ->\"; - - celix_properties_t *packedConfig = celix_properties_loadFromString(config); - return celixLauncher_launchAndWaitForShutdown(argc, argv, packedConfig); -} -" - ) - - add_executable(${DOCKER_TARGET} EXCLUDE_FROM_ALL ${LAUNCHER_SRC}) - target_link_libraries(${DOCKER_TARGET} PRIVATE Celix::framework) - if(NOT APPLE) - #Add --no-as-needed options, to ensure that libraries are always linked. - #This is needed because most libraries are not used by the executable, but by the bundle libraries instead. - set_target_properties(${DOCKER_TARGET} PROPERTIES LINK_FLAGS -Wl,--no-as-needed) - endif() - set(LAUNCHER "$") - set(DOCKER_ENTRYPOINT "ENTRYPOINT [\"/bin/$\"]") - endif () - - - ###### Setup docker custom target timestamp - add_custom_target(${DOCKER_TARGET}-deps - DEPENDS ${FS_TIMESTAMP_FILE} $ - ) - add_dependencies(${DOCKER_TARGET} ${DOCKER_TARGET}-deps) - - #setup dependencies based on timestamp - if (DOCKER_CREATE_FS) - add_custom_command(TARGET ${DOCKER_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory $ - COMMAND cd $ && /bin/bash ${CELIX_CMAKE_DIRECTORY}/create_target_filesystem.sh -e ${LAUNCHER} > /dev/null - WORKING_DIRECTORY "${DOCKER_LOC}" - COMMENT "Creating docker dir for ${DOCKER_TARGET}" VERBATIM - ) - else () - add_custom_command(TARGET ${DOCKER_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory $/bin - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAUNCHER} $/bin/ - WORKING_DIRECTORY "${DOCKER_LOC}" - COMMENT "Creating docker dir for ${DOCKER_TARGET}" VERBATIM - ) - endif () - - ##### Deploy Target Properties for Dockerfile ##### - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_LOC" "${DOCKER_LOC}") - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_FROM" "${DOCKER_FROM}") #name of docker base, default celix-base - set_target_properties(${DOCKER_TARGET} PROPERTIES "CONTAINER_NAME" "${DOCKER_NAME}") #name of docker celix container - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_IMAGE_NAME" "${DOCKER_IMAGE_NAME}") #name of docker images, default deploy target name - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_BUNDLES_DIR" "${DOCKER_BUNDLES_DIR}") #bundles directory in docker image - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_BUNDLES_LEVEL_0" "") #bundles for runtime level 0 - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_BUNDLES_LEVEL_1" "") #bundles for runtime level 1 - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_BUNDLES_LEVEL_2" "") #bundles for runtime level 2 - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_BUNDLES_LEVEL_3" "") #bundles for runtime level 3 - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_BUNDLES_LEVEL_4" "") #bundles for runtime level 4 - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_BUNDLES_LEVEL_5" "") #bundles for runtime level 5 - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_WORKDIR" "${DOCKER_WORKDIR}") #workdir in docker image, should also contain the config.properties - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_ENTRYPOINT" "${DOCKER_ENTRYPOINT}") - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_CREATE_FS" "${DOCKER_CREATE_FS}") #wether to create a fs with the minimal needed libraries / etc files - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_INSTRUCTIONS" "") #list of additional instructions - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_PROPERTIES" "") - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_EMBEDDED_PROPERTIES" "") - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_DEPS" "") - - set(DOCKERFILE_STAGE1 ${CMAKE_BINARY_DIR}/celix/gen/docker/${DOCKER_TARGET}/Dockerfile.in) - set(DOCKERFILE "$/Dockerfile") - - file(GENERATE - OUTPUT "${DOCKERFILE_STAGE1}" - CONTENT "# Dockerfile for celix based image -FROM $ -ENV IMAGE_NAME $ -COPY . / -WORKDIR $ -$ -$, -> -") - file(GENERATE - OUTPUT ${DOCKERFILE} - INPUT ${DOCKERFILE_STAGE1} - ) - - #generate config.properties - set(DOCKER_PROPERTIES_FILE "${DOCKER_LOC}/${DOCKER_WORKDIR}/config.properties") - set(STAGE1_PROPERTIES_FILE "${CMAKE_BINARY_DIR}/celix/gen/docker/${DOCKER_TARGET}/docker-config-stage1.properties") - file(GENERATE - OUTPUT "${STAGE1_PROPERTIES_FILE}" - CONTENT "CELIX_AUTO_START_0=$, > -CELIX_AUTO_START_1=$, > -CELIX_AUTO_START_2=$, > -CELIX_AUTO_START_3=$, > -CELIX_AUTO_START_4=$, > -CELIX_AUTO_START_5=$, > -CELIX_CONTAINER_NAME=$ -org.osgi.framework.storage=.cache -$, -> -" - ) - file(GENERATE - OUTPUT "${DOCKER_PROPERTIES_FILE}" - INPUT "${STAGE1_PROPERTIES_FILE}" - ) - - if (DOCKER_BUNDLES) - celix_docker_bundles(${DOCKER_TARGET} LEVEL 3 ${DOCKER_BUNDLES}) - endif () - if (DOCKER_PROPERTIES) - celix_docker_properties(${DOCKER_TARGET} ${DOCKER_PROPERTIES}) - endif () - if (DOCKER_INSTRUCTIONS) - celix_docker_instructions(${DOCKER_TARGET} ${DOCKER_INSTRUCTIONS}) - endif () - if (DOCKER_FILES) - cmake_docker_add_files(${DOCKER_TARGET} FILES ${DOCKER_FILES} DESTINATION ${DOCKER_FILES_DIR}) - endif () - - get_target_property(DEPS celix-build-docker-dirs "DOCKER_DEPS") - list(APPEND DEPS ${DOCKER_TARGET}) - set_target_properties(celix-build-docker-dirs PROPERTIES "DOCKER_DEPS" "${DEPS}") - - if (CELIX_BUILD_DOCKER_USE_DOCKER) - add_custom_target(celix-build-${DOCKER_TARGET}-docker-image - COMMAND cd $ && ${DOCKER_CMD} build -t "$" . - DEPENDS ${DOCKERFILE} ${DOCKER_TARGET} - COMMENT "Creating docker image for target '${DOCKER_TARGET}'" VERBATIM - ) - add_dependencies(celix-build-docker-images celix-build-${DOCKER_TARGET}-docker-image) - endif() -endfunction() - -#[[ -Add the selected bundles to the Celix docker image. These bundles are copied to the docker build dir and -are added to the configuration properties so that they are installed and started when the Celix docker container is created and started. - -The Celix framework support 7 (0 - 6) run levels. Run levels can be used to control the start and stop order of bundles. -Bundles in run level 0 are started first and bundles in run level 6 are started last. -When stopping bundles in run level 6 are stopped first and bundles in run level 0 are stopped last. -Within a run level the order of configured decides the start order; bundles added earlier are started first. - - -Optional Arguments: -- LEVEL: The run level for the added bundles. Default is 3. - -```CMake -celix_docker_bundles( - [LEVEL (0..5)] - bundle1 - bundle2 - ... -) -``` -]] -function(celix_docker_bundles) - #0 is docker TARGET - #1..n is bundles - list(GET ARGN 0 DOCKER_TARGET) - list(REMOVE_AT ARGN 0) - - set(OPTIONS) - set(ONE_VAL_ARGS LEVEL) - set(MULTI_VAL_ARGS) - cmake_parse_arguments(BUNDLES "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) - set(BUNDLES_LIST ${BUNDLES_UNPARSED_ARGUMENTS}) - - if (NOT DEFINED BUNDLES_LEVEL) - set(BUNDLES_LEVEL 3) - endif () - - get_target_property(BUNDLES ${DOCKER_TARGET} "DOCKER_BUNDLES_LEVEL_${BUNDLES_LEVEL}") - get_target_property(BUNDLES_DIR ${DOCKER_TARGET} "DOCKER_BUNDLES_DIR") - get_target_property(LOC ${DOCKER_TARGET} "DOCKER_LOC") - get_target_property(DEPS ${DOCKER_TARGET} "DOCKER_DEPS") - - foreach (BUNDLE IN ITEMS ${BUNDLES_LIST}) - set(HANDLED FALSE) - if (IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE}) - get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME) - set(OUT "${LOC}/${BUNDLES_DIR}/${BUNDLE_FILENAME}") - add_custom_command(OUTPUT ${OUT} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BUNDLE} ${OUT} - COMMENT "Copying (file) bundle '${BUNDLE}' to '${LOC}/${BUNDLES_DIR}'" - DEPENDS ${BUNDLE} - ) - list(APPEND BUNDLES "${BUNDLES_DIR}/${BUNDLE_FILENAME}") - set(HANDLED TRUE) - elseif (TARGET ${BUNDLE}) - get_target_property(TARGET_TYPE ${BUNDLE} TYPE) - if (TARGET_TYPE STREQUAL "INTERFACE_LIBRARY") - #ignore - set(HANDLED TRUE) - else () - get_target_property(IMP ${BUNDLE} BUNDLE_IMPORTED) - if (IMP) #An imported bundle target -> handle target without DEPENDS - string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special chars (e.g. for target like Celix::shell) - _celix_extract_imported_bundle_info(${BUNDLE}) #extracts BUNDLE_FILE and BUNDLE_FILENAME - set(OUT "${CMAKE_BINARY_DIR}/celix/gen/docker/${DOCKER_TARGET}/copy-bundle-for-target-${BUNDLE_ID}.timestamp") - set(DEST "${LOC}/${BUNDLES_DIR}/${BUNDLE_FILENAME}") - add_custom_command(OUTPUT ${OUT} - COMMAND ${CMAKE_COMMAND} -E touch ${OUT} - COMMAND ${CMAKE_COMMAND} -E make_directory ${LOC}/${BUNDLES_DIR} - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${BUNDLE_FILE}" ${DEST} - COMMENT "Copying (imported) bundle '${BUNDLE}' to '${LOC}/${BUNDLES_DIR}'" - ) - list(APPEND BUNDLES "${BUNDLES_DIR}/${BUNDLE_FILENAME}") - set(HANDLED TRUE) - endif () - endif () - endif () - - if (NOT HANDLED) #assuming (future) bundle target) - string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special chars (e.g. for target like Celix::shell) - set(OUT "${CMAKE_BINARY_DIR}/celix/gen/docker/${DOCKER_TARGET}/copy-bundle-for-target-${BUNDLE_ID}.timestamp") - set(DEST "${LOC}/${BUNDLES_DIR}/$") - add_custom_command(OUTPUT ${OUT} - COMMAND ${CMAKE_COMMAND} -E touch ${OUT} - COMMAND ${CMAKE_COMMAND} -E make_directory ${LOC}/${BUNDLES_DIR} - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" ${DEST} - COMMENT "Copying (target) bundle '${BUNDLE}' to '${LOC}/${BUNDLES_DIR}'" - DEPENDS ${BUNDLE} $ - ) - list(APPEND BUNDLES "${BUNDLES_DIR}/$") - endif () - list(APPEND DEPS "${OUT}") - endforeach () - - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_BUNDLES_LEVEL_${BUNDLES_LEVEL}" "${BUNDLES}") - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_DEPS" "${DEPS}") -endfunction() - -#[[ -Same as `celix_container_properties`, but then for the celix container -in the docker image. - -```CMake -celix_docker_properties( - "prop1=val1" - "prop2=val2" - ... -) -``` -]] -function(celix_docker_properties) - #0 is docker TARGET - #1..n is properties - list(GET ARGN 0 DOCKER_TARGET) - list(REMOVE_AT ARGN 0) - - get_target_property(PROPS ${DOCKER_TARGET} "DOCKER_PROPERTIES") - - foreach (PROP IN ITEMS ${ARGN}) - list(APPEND PROPS ${PROP}) - endforeach () - - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_PROPERTIES" "${PROPS}") -endfunction() - -#[[ -Same as `celix_container_embedded_properties`, but then for the celix container -in the docker image. - -```CMake -celix_docker_embedded_properties( - "prop1=val1" - "prop2=val2" - ... -) -``` -]] -function(celix_docker_embedded_properties) - #0 is docker TARGET - #1..n is properties - list(GET ARGN 0 DOCKER_TARGET) - list(REMOVE_AT ARGN 0) - - get_target_property(PROPS ${DOCKER_TARGET} "DOCKER_EMBEDDED_PROPERTIES") - - foreach (PROP IN ITEMS ${ARGN}) - list(APPEND PROPS ${PROP}) - endforeach () - - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_EMBEDDED_PROPERTIES" "${PROPS}") -endfunction() - -#[[ -Add the provided docker instruction to the end of the generated -Dockerfile. - -```CMake -celix_docker_instructions( - "instruction1" - "instruction2" - ... -) -``` -]] -function(celix_docker_instructions) - #0 is docker TARGET - #1..n is instructions - list(GET ARGN 0 DOCKER_TARGET) - list(REMOVE_AT ARGN 0) - - get_target_property(INSTRUCTIONS ${DOCKER_TARGET} "DOCKER_INSTRUCTIONS") - - foreach (INSTR IN ITEMS ${ARGN}) - list(APPEND INSTRUCTIONS ${INSTR}) - endforeach () - - set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_INSTRUCTIONS" "${INSTRUCTIONS}") -endfunction() - -function(cmake_docker_add_files) - list(GET ARGN 0 DOCKER_TARGET) - list(REMOVE_AT ARGN 0) - set(OPTIONS) - set(ONE_VAL_ARGS DESTINATION) - set(MULTI_VAL_ARGS FILES) - cmake_parse_arguments(DOCKER "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) - if (NOT DEFINED DOCKER_DESTINATION) - set(DOCKER_DESTINATION) - endif () - get_target_property(DOCKER_DIR_LOCATION ${DOCKER_TARGET} "DOCKER_LOC") - foreach(DOCKER_FILE IN ITEMS ${DOCKER_FILES}) - add_custom_command(TARGET ${DOCKER_TARGET} - POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${DOCKER_DIR_LOCATION}/${DOCKER_DESTINATION} - POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${DOCKER_FILE}" ${DOCKER_DIR_LOCATION}/${DOCKER_DESTINATION} - COMMENT "Copying file '${DOCKER_FILE}' to '${DOCKER_DIR_LOCATION}/${DOCKER_DESTINATION}'" - ) - endforeach() -endfunction() - - -#[[ -Install docker container when 'make install' is executed and CELIX_BUILD_DOCKER_USE_DOCKER_DIR_TAR is defined. -Docker containers are installed at `/shared//containers`. - -CELIX_BUILD_DOCKER_TAR_LOCATION can be defined to override the default install-prefix. - -Optional arguments: -- PROJECT_NAME: The project name for installing. Default is the cmake project name. -- IMAGE_NAME: Configure the image name. Default is NAME. - -install_celix_docker( - [PROJECT_NAME] project_name - [IMAGE_NAME docker_image_name] -) -]] -function(install_celix_docker) - list(GET ARGN 0 DOCKER_TARGET) - list(REMOVE_AT ARGN 0) - - set(OPTIONS ) - set(ONE_VAL_ARGS PROJECT_NAME) - set(MULTI_VAL_ARGS ) - cmake_parse_arguments(DOCKER "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) - - if (NOT DEFINED DOCKER_PROJECT_NAME) - string(TOLOWER ${PROJECT_NAME} DOCKER_PROJECT_NAME) - endif() - if (NOT DEFINED DOCKER_NAME) - set(DOCKER_NAME "${DOCKER_TARGET}") - endif () - if (NOT DEFINED DOCKER_IMAGE_NAME) - set(DOCKER_IMAGE_NAME "${DOCKER_NAME}") - endif () - - if(CELIX_BUILD_DOCKER_USE_DOCKER_DIR_TAR) - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${DOCKER_PROJECT_NAME}/${DOCKER_IMAGE_NAME}.tar.gz - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${DOCKER_PROJECT_NAME} - COMMAND tar czf ${CMAKE_BINARY_DIR}/${DOCKER_PROJECT_NAME}/${DOCKER_IMAGE_NAME}.tar.gz --directory=$ . - DEPENDS ${DOCKERFILE} ${DOCKER_TARGET} - COMMENT "Generating '${DOCKER_IMAGE_NAME}.tar.gz'" VERBATIM - ) - add_custom_target(${DOCKER_IMAGE_NAME}-dirs-tars ALL DEPENDS ${CMAKE_BINARY_DIR}/${DOCKER_PROJECT_NAME}/${DOCKER_IMAGE_NAME}.tar.gz) - - if (DEFINED CELIX_BUILD_DOCKER_TAR_LOCATION) - set(DOCKER_TAR_LOCATION ${CELIX_BUILD_DOCKER_TAR_LOCATION}) - endif() - if (NOT DEFINED DOCKER_TAR_LOCATION) - set(DOCKER_TAR_LOCATION shared) - endif() - install(FILES ${CMAKE_BINARY_DIR}/${DOCKER_PROJECT_NAME}/${DOCKER_IMAGE_NAME}.tar.gz DESTINATION ${DOCKER_TAR_LOCATION}/${DOCKER_PROJECT_NAME}/containers) - endif() -endfunction() \ No newline at end of file diff --git a/cmake/cmake_celix/Runtimes.cmake b/cmake/cmake_celix/Runtimes.cmake deleted file mode 100644 index 925d5772a..000000000 --- a/cmake/cmake_celix/Runtimes.cmake +++ /dev/null @@ -1,253 +0,0 @@ -# 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. - -if (NOT TARGET celix-runtimes) - add_custom_target(celix-runtimes ALL - DEPENDS "$" - ) - set_target_properties(celix-runtimes PROPERTIES "DEPS" "") - set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/runtimes") -endif () - -function(add_runtime) - message(DEPRECATION "add_celix_runtime is deprecated, and will be removed in future Celix releases.") - add_celix_runtime(${ARGN}) -endfunction() -function(add_celix_runtime) - message(DEPRECATION "add_celix_runtime is deprecated, and will be removed in future Celix releases.") - list(GET ARGN 0 RUNTIME_TARGET_NAME) - list(REMOVE_AT ARGN 0) - - set(OPTIONS USE_TERM LOG_TO_FILES) - set(ONE_VAL_ARGS WAIT_FOR NAME GROUP) - set(MULTI_VAL_ARGS DEPLOYMENTS CONTAINERS COMMANDS ARGUMENTS RELEASE_FILES) - cmake_parse_arguments(RUNTIME "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) - - if (NOT DEFINED RUNTIME_NAME) - set(RUNTIME_NAME ${RUNTIME_TARGET_NAME}) - endif () - if (NOT DEFINED RUNTIME_GROUP) - set(RUNTIME_LOC "${CMAKE_BINARY_DIR}/runtimes/${RUNTIME_NAME}") - else () - set(RUNTIME_LOC "${CMAKE_BINARY_DIR}/runtimes/${RUNTIME_GROUP}/${RUNTIME_NAME}") - endif () - set(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${RUNTIME_TARGET_NAME}-runtime-timestamp") - - set(START_SCRIPT "$/start.sh") - set(STOP_SCRIPT "$/stop.sh") - set(COMMON_SCRIPT "$/common.sh") - - add_custom_command(OUTPUT "${TIMESTAMP_FILE}" - COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP_FILE} - COMMAND ${CMAKE_COMMAND} -E make_directory $ - COMMAND chmod +x $/start.sh - COMMAND chmod +x $/stop.sh - DEPENDS ${START_SCRIPT} ${STOP_SCRIPT} ${SETUP_SCRIPT} - WORKING_DIRECTORY "${RUNTIME_LOC}" - COMMENT "Creating runtime ${RUNTIME_TARGET_NAME}" VERBATIM - ) - add_custom_target(${RUNTIME_TARGET_NAME} - DEPENDS "${TIMESTAMP_FILE}" - ) - - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_CONTAINERS" "") #containers that should be runned - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_COMMANDS" "") #command that should be executed - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_ARGUMENTS" "") #potential arguments to use for deployments - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RELEASE_FILES" "") #release files which needs to be released before starting the containers/commands - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_NAME" "${RUNTIME_NAME}") #The runtime workdir - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_GROUP" "${RUNTIME_GROUP}") #The runtime workdir - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_LOC" "${RUNTIME_LOC}") #The runtime workdir - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_USE_TERM" "${RUNTIME_USE_TERM}") #Wether or not the use terminal - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_LOG_TO_FILES" "${RUNTIME_LOG_TO_FILES}") #log to files or std out/err - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_NEXT_CONTAINER_ID" "0") #used for indexes int he bash scripts - - #wait for deployment, e.g. the one that control the lifecycle of the runtime. - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_WAIT_FOR_CONTAINER" "") - - #wait for command, e.g. the one that control the lifecycle of the runtime. - set_target_properties(${RUNTIME_TARGET_NAME} PROPERTIES "RUNTIME_WAIT_FOR_COMMAND" "") - - - #replaces @RUNTIME_TARGET_NAME@ - configure_file("${CELIX_CMAKE_DIRECTORY}/runtime_start.sh.in" "${CMAKE_BINARY_DIR}/celix/gen/runtimes/${RUNTIME_TARGET_NAME}/start.sh.in.1" @ONLY) - configure_file("${CELIX_CMAKE_DIRECTORY}/runtime_stop.sh.in" "${CMAKE_BINARY_DIR}/celix/gen/runtimes/${RUNTIME_TARGET_NAME}/stop.sh.in.1" @ONLY) - configure_file("${CELIX_CMAKE_DIRECTORY}/runtime_common.sh.in" "${CMAKE_BINARY_DIR}/celix/gen/runtimes/${RUNTIME_TARGET_NAME}/common.sh.in.1" @ONLY) - - - file(GENERATE - OUTPUT "${CMAKE_BINARY_DIR}/celix/gen/runtimes/${RUNTIME_TARGET_NAME}/common.sh.in.2" - INPUT "${CMAKE_BINARY_DIR}/celix/gen/runtimes/${RUNTIME_TARGET_NAME}/common.sh.in.1" - ) - file(GENERATE - OUTPUT "${START_SCRIPT}" - INPUT "${CMAKE_BINARY_DIR}/celix/gen/runtimes/${RUNTIME_TARGET_NAME}/start.sh.in.1" - ) - file(GENERATE - OUTPUT "${STOP_SCRIPT}" - INPUT "${CMAKE_BINARY_DIR}/celix/gen/runtimes/${RUNTIME_TARGET_NAME}/stop.sh.in.1" - ) - - - file(GENERATE - OUTPUT "${COMMON_SCRIPT}" - INPUT "${CMAKE_BINARY_DIR}/celix/gen/runtimes/${RUNTIME_TARGET_NAME}/common.sh.in.2" - ) - - get_target_property(DEPS celix-runtimes "DEPS") - list(APPEND DEPS "${RUNTIME_TARGET_NAME}") - set_target_properties(celix-runtimes PROPERTIES "DEPS" "${DEPS}") - - celix_runtime_containers(${RUNTIME_TARGET_NAME} ${RUNTIME_DEPLOYMENTS}) - celix_runtime_containers(${RUNTIME_TARGET_NAME} ${RUNTIME_CONTAINERS}) - celix_runtime_commands(${RUNTIME_TARGET_NAME} ${RUNTIME_COMMANDS}) - celix_runtime_arguments(${RUNTIME_TARGET_NAME} ${RUNTIME_ARGUMENTS}) - celix_runtime_release_files(${RUNTIME_TARGET_NAME} ${RUNTIME_RELEASE_FILES}) - - if (RUNTIME_WAIT_FOR) - celix_runtime_container_wait_for(${RUNTIME_TARGET_NAME} ${RUNTIME_WAIT_FOR}) - endif () - -endfunction() - -function(runtime_use_term) - message(DEPRECATION "runtime_use_term is depecrated, use celix_runtime_use_term instead.") - celix_runtime_use_term(${ARGN}) -endfunction() -function(celix_runtime_use_term) - #0 is runtime TARGET - #1 is BOOL (use xterm) - list(GET ARGN 0 RUNTIME_NAME) - list(GET ARGN 1 USE_TERM) - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_USE_TERM" "${USE_TERM}") -endfunction() - -function(runtime_log_to_files) - message(DEPRECATION "runtime_log_to_files is depecrated, use celix_runtime_log_to_files instead.") - celix_runtime_log_to_files(${ARGN}) -endfunction() -function(celix_runtime_log_to_files) - #0 is runtime TARGET - #1 is BOOL (log to files) - list(GET ARGN 0 RUNTIME_NAME) - list(GET ARGN 1 LOG_TO_FILES) - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_LOG_TO_FILES" "${LOG_TO_FILES}") -endfunction() - -function(runtime_deployments) - message(DEPRECATION "runtime_deployments is depecrated, use celix_runtime_containers instead.") - celix_runtime_containers(${ARGN}) -endfunction() -function(celix_runtime_containers) - #0 is runtime TARGET - #1..n is deployments - list(GET ARGN 0 RUNTIME_NAME) - list(REMOVE_AT ARGN 0) - - get_target_property(CONTAINERS ${RUNTIME_NAME} "RUNTIME_CONTAINERS") - foreach(CONTAINER IN ITEMS ${ARGN}) - get_target_property(DEP_ID ${RUNTIME_NAME} "RUNTIME_NEXT_CONTAINER_ID") - math(EXPR DEP_ID "${DEP_ID}+1") - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_DEPLOYMENT_${CONTAINER}_ID" "${DEP_ID}") - list(APPEND CONTAINERS "CONTAINERS_NAMES[${DEP_ID}]=\"$\"") - list(APPEND CONTAINERS "CONTAINERS_DIRS[${DEP_ID}]=\"$\"") - list(APPEND CONTAINERS "CONTAINERS_DEBUG_OPTS[${DEP_ID}]=\"\${${CONTAINER}_DEBUG_OPTS:-}\"") - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_NEXT_CONTAINER_ID" "${DEP_ID}") - endforeach() - - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_CONTAINERS" "${CONTAINERS}") -endfunction() - -function(runtime_deployment_wait_for) - message(DEPRECATION "runtime_deployment_wait_for is depecrated, use celix_runtime_container_wait_for instead.") - celix_runtime_container_wait_for(${ARGN}) -endfunction() -function(celix_runtime_container_wait_for) - #0 is runtime TARGET - #1 is deployment TARGET - list(GET ARGN 0 RUNTIME_NAME) - list(GET ARGN 1 CONTAINER) - - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_WAIT_FOR_CONTAINER" "$") - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_WAIT_FOR_COMMAND" "") -endfunction() - -function(runtime_commands) - message(DEPRECATION "runtime_commands is depecrated, use celix_runtime_commands instead.") - celix_runtime_commands(${ARGN}) -endfunction() -function(celix_runtime_commands) - #0 is runtime TARGET - #1..n is commands - list(GET ARGN 0 RUNTIME_NAME) - list(REMOVE_AT ARGN 0) - - get_target_property(COMMANDS ${RUNTIME_NAME} "RUNTIME_COMMANDS") - foreach(CMD IN ITEMS ${ARGN}) - list(APPEND COMMANDS ${CMD}) - endforeach() - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_COMMANDS" "${COMMANDS}") -endfunction() - -function(runtime_command_wait_for) - message(DEPRECATION "runtime_command_wait_for is depecrated, use celix_runtime_command_wait_for instead.") - celix_runtime_command_wait_for(${ARGN}) -endfunction() -function(celix_runtime_command_wait_for) - #0 is runtime TARGET - #1 is COMMAND STR - list(GET ARGN 0 RUNTIME_NAME) - list(GET ARGN 1 COMMAND) - - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_WAIT_FOR_COMMAND" "${COMMAND}") - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_WAIT_FOR_CONTAINER" "") -endfunction() - -function(runtime_arguments) - message(DEPRECATION "runtime_arguments is depecrated, use celix_runtime_arguments instead.") - celix_runtime_arguments(${ARGN}) -endfunction() -function(celix_runtime_arguments) - #0 is runtime TARGET - #1..n is commands - list(GET ARGN 0 RUNTIME_NAME) - list(REMOVE_AT ARGN 0) - - get_target_property(ARGUMENTS ${RUNTIME_NAME} "RUNTIME_ARGUMENTS") - list(LENGTH ARGN ARG_LENGTH) - if (${ARG_LENGTH} GREATER 1) - foreach(I RANGE 1 ${ARG_LENGTH} 2) - math(EXPR IMINUS "${I}-1") - list(GET ARGN ${IMINUS} DEPLOY_NAME) - list(GET ARGN ${I} DEPLOY_ARGS) - list(APPEND ARGUMENTS "CONTAIMER_ARGUMENTS[$]=\"${DEPLOY_ARGS}\"") - endforeach() - endif () - set_target_properties(${RUNTIME_NAME} PROPERTIES "RUNTIME_ARGUMENTS" "${ARGUMENTS}") -endfunction() - -function(celix_runtime_release_files) - #0 is runtime TARGET - #1..n is release files - list(GET ARGN 0 RUNTIME_NAME) - list(REMOVE_AT ARGN 0) - - get_target_property(RELEASE_FILES ${RUNTIME_NAME} "RELEASE_FILES") - foreach(RELEASE_FILE IN ITEMS ${ARGN}) - list(APPEND RELEASE_FILES "source ${RELEASE_FILE}") - endforeach() - set_target_properties(${RUNTIME_NAME} PROPERTIES "RELEASE_FILES" "${RELEASE_FILES}") -endfunction() diff --git a/cmake/cmake_celix/UseCelix.cmake b/cmake/cmake_celix/UseCelix.cmake index 507715937..26d94619b 100644 --- a/cmake/cmake_celix/UseCelix.cmake +++ b/cmake/cmake_celix/UseCelix.cmake @@ -21,10 +21,7 @@ include(CMakeParseArguments) set(CELIX_CMAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CELIX_CMAKE_DIRECTORY}/../Modules") - #Celix CMake function include(${CELIX_CMAKE_DIRECTORY}/BundlePackaging.cmake) include(${CELIX_CMAKE_DIRECTORY}/ContainerPackaging.cmake) -include(${CELIX_CMAKE_DIRECTORY}/DockerPackaging.cmake) -include(${CELIX_CMAKE_DIRECTORY}/Runtimes.cmake) include(${CELIX_CMAKE_DIRECTORY}/Generic.cmake) diff --git a/cmake/cmake_celix/create_target_filesystem.sh b/cmake/cmake_celix/create_target_filesystem.sh deleted file mode 100644 index 96964f327..000000000 --- a/cmake/cmake_celix/create_target_filesystem.sh +++ /dev/null @@ -1,215 +0,0 @@ -# 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. - -#!/bin/bash - -declare -A EXE_ARGUMENTS -EXE_INDEX=0 -declare -A LIB_ARGUMENTS -LIB_INDEX=0 -declare -A BUNDLE_ARGUMENTS -BUNDLE_INDEX=0 - -while [ -n "${1}" ] -do - ARG="${1}" - case $ARG in - -h|--help) - echo "Usage ${0} [-e executable].. [-l library].. [-b bundle].." - exit 0 - ;; - -e|--executable) - EXE_ARGUMENTS[${EXE_INDEX}]="${2}" - EXE_INDEX=$((EXE_INDEX+1)) - shift - ;; - -l|--lib) - LIB_ARGUMENTS[${LIB_INDEX}]="${2}" - LIB_INDEX=$((LIB_INDEX+1)) - shift - ;; - -b|--bundle) - BUNDLE_ARGUMENTS[${BUNDLE_INDEX}]="${2}" - BUNDLE_INDEX=$((BUNDLE_INDEX+1)) - shift - ;; - *) - echo "unknown option '${ARG}'" - ;; - esac - shift -done - -celix_add_file() { - FILE=$1 - TO_DIR=$2 - if [ -f ${FILE} ] - then #is regular file and not symlink - if [ -n "${TO_DIR}" ]; then - DIR=${TO_DIR} - elif [[ "${FILE}" =~ ^/.* ]]; then #absolute path - DIR=.$(dirname ${FILE}) - else - DIR=$(dirname ${FILE}) - fi - - mkdir -p ${DIR} 2> /dev/null - cp -vu ${FILE} ${DIR}/ - else - echo "Skipping file ${FILE}" - fi -} - -celix_add_bundle() { - BUNDLE=$1 - if [ -e ${BUNDLE} ] - then - BUNDLE_DIR=bundles - mkdir -p ${BUNDLES_DIR} 2> /dev/null - cp -vu ${BUNDLE} ${BUNDLES_DIR}/ - else - echo "Bundle '${BUNDLE}' does not exists!" - fi -} - -celix_add_lib() { - LIB=$1 - for DEP in $(ldd ${LIB} | grep lib | awk '{print $3}') - do - celix_add_file ${DEP} lib64 - done - - #the ld-linux library is handled separately - LDLIB=$(ldd ${EXE} | grep ld-linux | awk '{print $1}') - if [ -n ${LDLIB} ] - then - celix_add_file ${LDLIB} lib64 - fi -} - -celix_add_libs_for_exe() { - EXE=$1 - for LIB in $(ldd ${EXE} | grep lib | awk '{print $3}') - do - celix_add_file ${LIB} lib64 - done - - #the ld-linux library is handled separately - LDLIB=$(ldd ${EXE} | grep ld-linux | awk '{print $1}') - if [ -n ${LDLIB} ] - then - celix_add_file ${LDLIB} lib64 - fi -} - -celix_add_exe() { - EXE=$1 - celix_add_libs_for_exe ${EXE} - - #if [[ "${EXE}" =~ ^/.* ]]; then - # DIR=.$(dirname ${EXE}) - #else - # #for relative paths use usr/bin - # DIR=usr/bin - #fi - - #Always put executables in /bin - DIR=bin - - mkdir -p ${DIR} 2> /dev/null - cp -vu ${EXE} ${DIR}/ -} - -celix_add_required_libs() { - if [ ! -d /lib64 ] - then - echo "ERROR: Assuming 64 bit architecture for docker creating. Created filesystem will not be valid" - fi - #LIBS=$(ls -1 /lib64/ld-linux* /lib64/libnss_dns* /lib64/libnss_files*) - LIBS=$(ls -1 /lib64/ld-linux* /lib64/libnss_dns* /lib64/libnss_files* /lib/x86_64-linux-gnu/libnss_dns* /lib/x86_64-linux-gnu/libnss_files* 2> /dev/null) - for LIB in ${LIBS} - do - celix_add_file ${LIB} - done -} - -for INDEX in "${!EXE_ARGUMENTS[@]}" -do - EXE=${EXE_ARGUMENTS[${INDEX}]} - echo "Adding exe ${EXE}" - celix_add_exe ${EXE} -done - -for INDEX in "${!LIB_ARGUMENTS[@]}" -do - LIB=${LIB_ARGUMENTS[${INDEX}]} - echo "Adding lib ${LIB}" - celix_add_lib ${LIB} -done - -for INDEX in "${!BUNDLE_ARGUMENTS[@]}" -do - BUNDLE=${BUNDLE_ARGUMENTS[${INDEX}]} - echo "Adding bundle ${BUNDLE}" - celix_add_bundle ${BUNDLE} -done - - -mkdir root 2> /dev/null - -echo "Creating minimal etc dir" - -mkdir etc 2> /dev/null -if [ ! -f etc/group ] -then - echo """root:x:0: -bin:x:1: -daemon:x:2: -adm:x:4: -lp:x:7: -mail:x:12: -games:x:20: -ftp:x:50: -nobody:x:99: -users:x:100: -nfsnobody:x:65534:""" > etc/group -fi - -if [ ! -f etc/nsswitch.conf ] -then - echo """passwd: files -shadow: files -group: files -hosts: files dns""" > etc/nsswitch.conf -fi - -if [ ! -f etc/passwd ] -then - echo """root:x:0:0:root:/root:/bin/bash -bin:x:1:1:bin:/bin:/sbin/nologin -daemon:x:2:2:daemon:/sbin:/sbin/nologin -adm:x:3:4:adm:/var/adm:/sbin/nologin -lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin -sync:x:5:0:sync:/sbin:/bin/sync -shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown -halt:x:7:0:halt:/sbin:/sbin/halt -mail:x:8:12:mail:/var/spool/mail:/sbin/nologin -operator:x:11:0:operator:/root:/sbin/nologin -games:x:12:100:games:/usr/games:/sbin/nologin -ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin -nobody:x:99:99:Nobody:/:/sbin/nologin""" > etc/passwd -fi - -celix_add_required_libs diff --git a/cmake/cmake_celix/runtime_common.sh.in b/cmake/cmake_celix/runtime_common.sh.in deleted file mode 100644 index 2a438529c..000000000 --- a/cmake/cmake_celix/runtime_common.sh.in +++ /dev/null @@ -1,230 +0,0 @@ -# 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. - -#!/bin/bash - -#Locations -BUILD_DIR="${BUILD_DIR:-@PROJECT_BINARY_DIR@}" -RUNTIME_DIR="${RUNTIME_DIR:-$}" -DEPLOY_DIR="${DEPLOY_DIR:-${BUILD_DIR}/deploy}" - -#Name & Group -RUNTIME_NAME="${RUNTIME_NAME:-$}" -RUNTIME_GROUP="${RUNTIME_GROUP:-$}" - -#commands -COMMANDS=${COMMANDS:-"$, >"} - -#containers -$, -> - -#container arguments -$, -> - -#release files -$, -> - -#Options -TERM_CMD="${TERM_CMD:-xterm}" -TERM_OPTS="${TERM_OPTS:-}" -USE_TERM="${USE_TERM:-$}" -RELEASE_SH="${RELEASE_SH:-}" -WAIT_FOR_CONTAINER="${WAIT_FOR_CONTAINER:-$}" -WAIT_FOR_CMD="${WAIT_FOR_CMD:-$}" -LOG_TO_FILES="${LOG_TO_FILES:-$}" -KILL_OPTS="${KILL_OPTS:--2}" #default is -2, e.g. SIGINT -PATIENCE="${PATIENCE:-5}" #in seconds - -PIDS="" -RUNTIME_STARTTIME=$(date +"%s") -trap stop_all INT - -##functions -function rt_init() { - rm -fr ${RUNTIME_DIR}/run #contains pids, etc - rm -fr ${RUNTIME_DIR}/logs - mkdir ${RUNTIME_DIR}/run - mkdir ${RUNTIME_DIR}/logs - echo "Name: ${RUNTIME_NAME}" > ${RUNTIME_DIR}/logs/init.log - echo "Start time: ${RUNTIME_STARTTIME}" >> ${RUNTIME_DIR}/logs/init.log -} - -function rt_start_all() { - echo "" - echo "" - echo "********** Starting runtime ${RUNTIME_NAME} **********" - for CONTAINERS_INDEX in "${!CONTAINERS_NAMES[@]}" - do - rt_run_deployment ${CONTAINERS_INDEX} - done - - for CMD in ${COMMANDS}; do - rt_run_cmd "${CMD}" - done -} - -function rt_stop_all() { - echo "********** Stopping runtime ${RUNTIME_NAME} **********" - for PID in ${PIDS}; do - echo "Sending signal to ${PID}" - kill ${KILL_OPTS} ${PID} 2> /dev/null; true - done -} - -function rt_stop() { - PIDS=$@ - echo "Stopping pids ${PIDS}" - kill ${KILL_OPTS} ${PIDS} 2> /dev/null; true -} - -function rt_run_deployment() { - INDEX=$1 - DEPLOYMENT=${CONTAINERS_NAMES[${INDEX}]} - CONTAINERS_DIR=${CONTAINERS_DIRS[${INDEX}]} - ARGS=${CONTAINERS_ARGUMENTS[${INDEX}]} - LOG_FILE="${RUNTIME_DIR}/logs/${DEPLOYMENT}.log" - DEBUG_OPTS=${CONTAINERS_DEBUG_OPTS[${INDEX}]} - - echo "" - echo "Starting deployment ${DEPLOYMENT}" - cd ${CONTAINERS_DIR} - if [ -d .cache ] ; then - echo " Clearing cache" - rm -fr .cache - fi - if [ -e release.sh ] ; then - . ./release.sh #run deployment release - fi - echo " Workdir: ${CONTAINERS_DIR}" - echo " Cmd used: '${DEBUG_OPTS} ./${DEPLOYMENT} ${ARGS}'" - if [ "${USE_TERM}" = "TRUE" ] ; then - if [ "${LOG_TO_FILES}" = "TRUE" ] ; then - echo " Using log file ${LOG_FILE}" - ${TERM_CMD} ${TERM_OPTS} -e "${DEBUG_OPTS} ./${DEPLOYMENT} ${ARGS} &> ${LOG_FILE}" &> /dev/null & - else - ${TERM_CMD} ${TERM_OPTS} -e "${DEBUG_OPTS} ./${DEPLOYMENT} ${ARGS}" &> /dev/null & - fi - else #run in this shell - if [ "${LOG_TO_FILES}" = "TRUE" ] ; then - echo " Using log file ${LOG_FILE}" - ${DEBUG_OPTS} ./${DEPLOYMENT} ${ARGS} &> ${LOG_FILE} & - else - ${DEBUG_OPTS} ./${DEPLOYMENT} ${ARGS} & - fi - fi - PID=$! - echo " Pid of deployment '${DEPLOYMENT}' is ${PID}" - if [ ! -z "${WAIT_FOR_CONTAINER}" -a "${CONTAINERS_DIR}" = "${WAIT_FOR_CONTAINER}" ] ; then - WAIT_FOR_PID=${PID} - echo "${PID}" > ${RUNTIME_DIR}/run/wait_for_pid - else - PIDS="${PID} ${PIDS}" - echo "${PIDS}" > ${RUNTIME_DIR}/run/pids - fi - cd - > /dev/null -} - -function rt_run_cmd() { - CMD="$1" - echo "" - echo "Starting command '${CMD}'" - read CMD_NAME _ <<< ${CMD} - LOG_FILE="${RUNTIME_DIR}/logs/${CMD_NAME}.log" - WD="${RUNTIME_DIR}/${CMD_NAME}" - if [ -d {WD} ] ; then - echo " Clearing previous workdir for command '${CMD}'" - rm -fr ${WD} - fi - echo " Workdir: ${WD}" - mkdir -p ${WD} - cd ${WD} - if [ "${USE_TERM}" = "TRUE" ] ; then - if [ "${LOG_TO_FILES}" = "TRUE" ] ; then - echo " Using log file ${LOG_FILE}" - ${TERM_CMD} ${TERM_OPTS} -e "${CMD} &> ${LOG_FILE}" &> /dev/null & - else - ${TERM_CMD} ${TERM_OPTS} -e "${CMD}" &> /dev/null & - fi - else - if [ "${LOG_TO_FILES}" = "TRUE" ] ; then - echo " Using log file ${LOG_FILE}" - ${CMD} &> ${LOG_FILE} & - else - ${CMD} & - fi - fi - PID=$! - echo " Pid of command '${CMD}' is ${PID}" - if [ ! -z "${WAIT_FOR_CMD}" -a "${CMD}" = "${MWAIT_FOR_CMD}" ] ; then - WAIT_FOR_PID=${PID} - echo "${PID}" > ${RUNTIME_DIR}/run/wait_for_pid - else - PIDS="${PID} ${PIDS}" - echo "${PIDS}" > ${RUNTIME_DIR}/run/pids - fi - cd - > /dev/null -} - -function rt_wait_for() { - RESULT=0 - echo "" - echo "Waiting for pid ${WAIT_FOR_PID}" - if wait ${WAIT_FOR_PID}; then - echo "${WAIT_FOR_PID} exited normal" - else - echo "${WAIT_FOR_PID} exited with error" - RESULT=1 - fi - - echo "Signalling pids '${PIDS}' with '${KILL_OPTS}'" - kill ${KILL_OPTS} ${PIDS} - echo -n "Waiting " - TIMES=${PATIENCE} - for (( I=1; I<=TIMES; I++ )) - do - echo -n "." - kill -0 ${PIDS} &> /dev/null - if [ $? -eq 1 ] ; then #e.g. no such process result - #all process stopped - break - else - sleep 1 - fi - done - echo "" - - for PID in ${PIDS}; do - kill -0 ${PID} &> /dev/null - if [ $? -eq 0 ] ; then - NAME=$(ps -p ${PID} -o comm | tail -n 1) - echo "Out of patience, killing process '${NAME}' (${PID}), with kill -9" - kill -9 ${PID} - fi - done -} - - -if [ -z "${RELEASE_SH}" ] ; then - true #pass -elif [ -e "${RELEASE_SH}" ]; then #absolute release file - source ${RELEASE_SH} -elif [ -e "${RUNTIME_DIR}/${RELEASE_SH}" ] ; then #release file in runtime dir - source ${RUNTIME_DIR}/${RELEASE_SH} -elif [ -e "${BUILD_DIR}/${RELEASE_SH}" ] ; then #release file in build dir - source ${BUILD_DIR}/${RELEASE_SH} -fi diff --git a/cmake/cmake_celix/runtime_start.sh.in b/cmake/cmake_celix/runtime_start.sh.in deleted file mode 100644 index ea1668968..000000000 --- a/cmake/cmake_celix/runtime_start.sh.in +++ /dev/null @@ -1,31 +0,0 @@ -# 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. - -#!/bin/bash - -source $/common.sh - -rt_init -rt_start_all - -if [ ! -z "${WAIT_FOR_PID}" ] ; then - rt_wait_for #sets RESULT - echo "********** Runtime ${RUNTIME_NAME} result is ${RESULT} **********" - exit ${RESULT} -fi - - - - diff --git a/cmake/cmake_celix/runtime_stop.sh.in b/cmake/cmake_celix/runtime_stop.sh.in deleted file mode 100644 index 4c4c7fc66..000000000 --- a/cmake/cmake_celix/runtime_stop.sh.in +++ /dev/null @@ -1,34 +0,0 @@ -# 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. - -#!/bin/bash - -source $/common.sh - -#Options -USE_SIGNAL=${USE_SIGNAL:-} - -#TODO parse option to easily select kill -9 - -if [ -e ${RUNTIME_DIR}/run/main_pid ] ; then - MAIN_PID=$(cat ${RUNTIME_DIR}/run/wait_for_pid) - rt_stop ${MAIN_PID} -fi - -if [ -e ${RUNTIME_DIR}/run/pids ] ; then - PIDS=$(cat ${RUNTIME_DIR}/run/pids) - rt_stop ${PIDS} -fi - From e3308a6a4b85ee70008f21051ebcdcfbca17fa6b Mon Sep 17 00:00:00 2001 From: Pepijn Noltes Date: Sat, 28 Oct 2023 16:14:02 +0200 Subject: [PATCH 07/11] #509: Remove service.lang support --- .../publisher/private/src/ps_pub_activator.c | 1 - .../private/src/ps_websocket_activator.c | 1 - .../pubsub_admin_tcp/src/psa_activator.c | 1 - .../src/pubsub_tcp_topic_receiver.c | 1 - .../src/pubsub_websocket_topic_receiver.c | 1 - .../pubsub_admin_zmq/src/psa_activator.c | 1 - .../src/pubsub_zmq_topic_receiver.c | 1 - .../src/pubsub_interceptors_handler.c | 1 - .../src/pstm_activator.c | 2 - .../pubsub/pubsub_utils/src/pubsub_matching.c | 1 - .../gtest/src/rsa_client_server_tests.cc | 2 - .../gtest/src/rsa_tests.cc | 3 - .../gtest/src/tst_activator.c | 2 - .../src/export_registration_dfi.c | 1 - .../rsa_shm/src/rsa_shm_export_registration.c | 1 - .../src/remote_interceptors_handler.c | 1 - bundles/shell/shell/src/c_shell_activator.c | 1 - .../gtest/src/DependencyManagerTestSuite.cc | 5 -- .../include/celix/UseServiceBuilder.h | 1 - .../include/celix/dm/ServiceDependency.h | 16 ------ .../include/celix/dm/ServiceDependency_Impl.h | 15 ----- libs/framework/include/celix_bundle_context.h | 34 +----------- libs/framework/include/celix_constants.h | 8 --- .../include/celix_dm_service_dependency.h | 6 -- .../dm_service_dependency.h | 6 -- .../include_deprecated/service_registry.h | 2 - libs/framework/src/dm_component_impl.c | 1 - libs/framework/src/dm_service_dependency.c | 55 +++++++------------ .../src/dm_service_dependency_impl.h | 31 +++++------ 29 files changed, 37 insertions(+), 165 deletions(-) diff --git a/bundles/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c b/bundles/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c index 00745e563..ed76baf60 100644 --- a/bundles/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c +++ b/bundles/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c @@ -70,7 +70,6 @@ static int pub_start(struct publisherActivator *act, celix_bundle_context_t *ctx opts.removeWithProperties = publisher_publishSvcRemoved; opts.filter.serviceName = PUBSUB_PUBLISHER_SERVICE_NAME; opts.filter.filter = filter; - opts.filter.ignoreServiceLanguage = true; long trackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts); celix_arrayList_addLong(act->trackerList,trackerId); diff --git a/bundles/pubsub/examples/pubsub/pubsub_websocket/private/src/ps_websocket_activator.c b/bundles/pubsub/examples/pubsub/pubsub_websocket/private/src/ps_websocket_activator.c index f5c511431..15173834b 100644 --- a/bundles/pubsub/examples/pubsub/pubsub_websocket/private/src/ps_websocket_activator.c +++ b/bundles/pubsub/examples/pubsub/pubsub_websocket/private/src/ps_websocket_activator.c @@ -90,7 +90,6 @@ static int pubsub_start(struct ps_websocketActivator *act, celix_bundle_context_ opts.removeWithProperties = publisher_publishSvcRemoved; opts.filter.serviceName = PUBSUB_PUBLISHER_SERVICE_NAME; opts.filter.filter = filter; - opts.filter.ignoreServiceLanguage = true; long trackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts); celix_arrayList_addLong(act->trackerList,trackerId); diff --git a/bundles/pubsub/pubsub_admin_tcp/src/psa_activator.c b/bundles/pubsub/pubsub_admin_tcp/src/psa_activator.c index 008cb7ce5..d8b5f13a6 100644 --- a/bundles/pubsub/pubsub_admin_tcp/src/psa_activator.c +++ b/bundles/pubsub/pubsub_admin_tcp/src/psa_activator.c @@ -59,7 +59,6 @@ int psa_tcp_start(psa_tcp_activator_t *act, celix_bundle_context_t *ctx) { if (status == CELIX_SUCCESS) { celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; opts.filter.serviceName = PUBSUB_PROTOCOL_SERVICE_NAME; - opts.filter.ignoreServiceLanguage = true; opts.callbackHandle = act->admin; opts.addWithProperties = pubsub_tcpAdmin_addProtocolSvc; opts.removeWithProperties = pubsub_tcpAdmin_removeProtocolSvc; diff --git a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_receiver.c b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_receiver.c index 8f862e8ed..7c02fc60e 100644 --- a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_receiver.c +++ b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_receiver.c @@ -235,7 +235,6 @@ pubsub_tcp_topic_receiver_t *pubsub_tcpTopicReceiver_create(celix_bundle_context char buf[size + 1]; snprintf(buf, (size_t) size + 1, "(%s=%s)", PUBSUB_SUBSCRIBER_TOPIC, topic); celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; - opts.filter.ignoreServiceLanguage = true; opts.filter.serviceName = PUBSUB_SUBSCRIBER_SERVICE_NAME; opts.filter.filter = buf; opts.callbackHandle = receiver; diff --git a/bundles/pubsub/pubsub_admin_websocket/src/pubsub_websocket_topic_receiver.c b/bundles/pubsub/pubsub_admin_websocket/src/pubsub_websocket_topic_receiver.c index 74d249e3e..acfb345d0 100644 --- a/bundles/pubsub/pubsub_admin_websocket/src/pubsub_websocket_topic_receiver.c +++ b/bundles/pubsub/pubsub_admin_websocket/src/pubsub_websocket_topic_receiver.c @@ -173,7 +173,6 @@ pubsub_websocket_topic_receiver_t* pubsub_websocketTopicReceiver_create(celix_bu char buf[size+1]; snprintf(buf, (size_t)size+1, "(%s=%s)", PUBSUB_SUBSCRIBER_TOPIC, topic); celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; - opts.filter.ignoreServiceLanguage = true; opts.filter.serviceName = PUBSUB_SUBSCRIBER_SERVICE_NAME; opts.filter.filter = buf; opts.callbackHandle = receiver; diff --git a/bundles/pubsub/pubsub_admin_zmq/src/psa_activator.c b/bundles/pubsub/pubsub_admin_zmq/src/psa_activator.c index 913ad34df..dfd9429eb 100644 --- a/bundles/pubsub/pubsub_admin_zmq/src/psa_activator.c +++ b/bundles/pubsub/pubsub_admin_zmq/src/psa_activator.c @@ -60,7 +60,6 @@ int psa_zmq_start(psa_zmq_activator_t *act, celix_bundle_context_t *ctx) { if (status == CELIX_SUCCESS) { celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; opts.filter.serviceName = PUBSUB_PROTOCOL_SERVICE_NAME; - opts.filter.ignoreServiceLanguage = true; opts.callbackHandle = act->admin; opts.addWithProperties = pubsub_zmqAdmin_addProtocolSvc; opts.removeWithProperties = pubsub_zmqAdmin_removeProtocolSvc; diff --git a/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c b/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c index 1d01f2299..894b42344 100644 --- a/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c +++ b/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c @@ -234,7 +234,6 @@ pubsub_zmq_topic_receiver_t* pubsub_zmqTopicReceiver_create(celix_bundle_context char buf[size+1]; snprintf(buf, (size_t)size+1, "(%s=%s)", PUBSUB_SUBSCRIBER_TOPIC, topic); celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; - opts.filter.ignoreServiceLanguage = true; opts.filter.serviceName = PUBSUB_SUBSCRIBER_SERVICE_NAME; opts.filter.filter = buf; opts.callbackHandle = receiver; diff --git a/bundles/pubsub/pubsub_spi/src/pubsub_interceptors_handler.c b/bundles/pubsub/pubsub_spi/src/pubsub_interceptors_handler.c index 03bd7ca0c..91deca6c7 100644 --- a/bundles/pubsub/pubsub_spi/src/pubsub_interceptors_handler.c +++ b/bundles/pubsub/pubsub_spi/src/pubsub_interceptors_handler.c @@ -60,7 +60,6 @@ pubsub_interceptors_handler_t* pubsubInterceptorsHandler_create(celix_bundle_con // Create service tracker here, and not in the activator celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; opts.filter.serviceName = PUBSUB_INTERCEPTOR_SERVICE_NAME; - opts.filter.ignoreServiceLanguage = true; opts.callbackHandle = handler; opts.addWithProperties = pubsubInterceptorsHandler_addInterceptor; opts.removeWithProperties = pubsubInterceptorsHandler_removeInterceptor; diff --git a/bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c b/bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c index 347d6471b..6462a41c6 100644 --- a/bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c +++ b/bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c @@ -79,7 +79,6 @@ static int pstm_start(pstm_activator_t *act, celix_bundle_context_t *ctx) { opts.removeWithProperties = pubsub_topologyManager_psaRemoved; opts.callbackHandle = act->manager; opts.filter.serviceName = PUBSUB_ADMIN_SERVICE_NAME; - opts.filter.ignoreServiceLanguage = true; act->pubsubAdminTrackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts); } @@ -90,7 +89,6 @@ static int pstm_start(pstm_activator_t *act, celix_bundle_context_t *ctx) { opts.removeWithOwner = pubsub_topologyManager_subscriberRemoved; opts.callbackHandle = act->manager; opts.filter.serviceName = PUBSUB_SUBSCRIBER_SERVICE_NAME; - opts.filter.ignoreServiceLanguage = true; act->pubsubSubscribersTrackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts); } diff --git a/bundles/pubsub/pubsub_utils/src/pubsub_matching.c b/bundles/pubsub/pubsub_utils/src/pubsub_matching.c index 514b83c4f..64855922c 100644 --- a/bundles/pubsub/pubsub_utils/src/pubsub_matching.c +++ b/bundles/pubsub/pubsub_utils/src/pubsub_matching.c @@ -118,7 +118,6 @@ static long getPSProtocol(celix_bundle_context_t *ctx, const char *requested_pro } else { celix_service_filter_options_t opts = CELIX_EMPTY_SERVICE_FILTER_OPTIONS; opts.serviceName = PUBSUB_PROTOCOL_SERVICE_NAME; - opts.ignoreServiceLanguage = true; //note findService will automatically return the highest ranking service id svcId = celix_bundleContext_findServiceWithOptions(ctx, &opts); diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc index 047fe8083..dbb0d5d92 100644 --- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc @@ -285,7 +285,6 @@ typedef struct rsa_dfi_exception_test_service { celix_service_use_options_t opts{}; opts.filter.serviceName = RSA_DIF_EXCEPTION_TEST_SERVICE; opts.use = testExceptionServiceCallback; - opts.filter.ignoreServiceLanguage = true; opts.waitTimeoutInSeconds = 2; bool called = celix_bundleContext_useServiceWithOptions(clientContext, &opts); ASSERT_TRUE(called); @@ -297,7 +296,6 @@ static void test(F&& f) { celix_service_use_options_t opts{}; opts.filter.serviceName = TST_SERVICE_NAME; opts.use = f; - opts.filter.ignoreServiceLanguage = true; opts.waitTimeoutInSeconds = 2; bool called = celix_bundleContext_useServiceWithOptions(clientContext, &opts); ASSERT_TRUE(called); diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc index 42028b3e5..9bf7bb518 100644 --- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc @@ -76,7 +76,6 @@ extern "C" { celix_service_use_options_t opts{}; opts.filter.serviceName = OSGI_RSA_REMOTE_SERVICE_ADMIN; opts.use = testServicesCallback; - opts.filter.ignoreServiceLanguage = true; opts.waitTimeoutInSeconds = 0.25; bool called = celix_bundleContext_useServiceWithOptions(context, &opts); ASSERT_TRUE(called); @@ -104,7 +103,6 @@ extern "C" { celix_service_use_options_t opts{}; opts.filter.serviceName = OSGI_RSA_REMOTE_SERVICE_ADMIN; opts.use = testExportServiceCallback; - opts.filter.ignoreServiceLanguage = true; opts.waitTimeoutInSeconds = 0.25; bool called = celix_bundleContext_useServiceWithOptions(context, &opts); ASSERT_TRUE(called); @@ -141,7 +139,6 @@ extern "C" { celix_service_use_options_t opts{}; opts.filter.serviceName = OSGI_RSA_REMOTE_SERVICE_ADMIN; opts.use = testImportServiceCallback; - opts.filter.ignoreServiceLanguage = true; opts.waitTimeoutInSeconds = 0.25; //first call -> init diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/tst_activator.c b/bundles/remote_services/remote_service_admin_dfi/gtest/src/tst_activator.c index a571f1d04..137867648 100644 --- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/tst_activator.c +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/tst_activator.c @@ -347,7 +347,6 @@ static celix_status_t bndStart(struct activator *act, celix_bundle_context_t* ct opts.set = bndSetCalc; opts.callbackHandle = act; opts.filter.serviceName = CALCULATOR_SERVICE; - opts.filter.ignoreServiceLanguage = true; act->trackerId1 = celix_bundleContext_trackServicesWithOptions(ctx, &opts); } { @@ -355,7 +354,6 @@ static celix_status_t bndStart(struct activator *act, celix_bundle_context_t* ct opts.set = bndSetRemoteExample; opts.callbackHandle = act; opts.filter.serviceName = REMOTE_EXAMPLE_NAME; - opts.filter.ignoreServiceLanguage = true; act->trackerId2 = celix_bundleContext_trackServicesWithOptions(ctx, &opts); } diff --git a/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.c b/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.c index fd7d8ee92..1ff6131ca 100644 --- a/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.c +++ b/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.c @@ -277,7 +277,6 @@ celix_status_t exportRegistration_start(export_registration_t *reg) { celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; opts.filter.filter = reg->filter; opts.filter.serviceName = "*"; - opts.filter.ignoreServiceLanguage = true; opts.callbackHandle = reg; opts.add = exportRegistration_addServ; opts.remove = exportRegistration_removeServ; diff --git a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_export_registration.c b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_export_registration.c index e86bcf7e4..872d1ef80 100644 --- a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_export_registration.c +++ b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_export_registration.c @@ -142,7 +142,6 @@ celix_status_t exportRegistration_create(celix_bundle_context_t *context, opts.filter.filter = filter; opts.filter.serviceName = RSA_RPC_FACTORY_NAME; opts.filter.versionRange = RSA_RPC_FACTORY_USE_RANGE; - opts.filter.ignoreServiceLanguage = true; opts.callbackHandle = export; opts.add = exportRegistration_addRpcFac; opts.remove = exportRegistration_removeRpcFac; diff --git a/bundles/remote_services/rsa_common/src/remote_interceptors_handler.c b/bundles/remote_services/rsa_common/src/remote_interceptors_handler.c index b1c9b969e..7b992f3a8 100644 --- a/bundles/remote_services/rsa_common/src/remote_interceptors_handler.c +++ b/bundles/remote_services/rsa_common/src/remote_interceptors_handler.c @@ -65,7 +65,6 @@ celix_status_t remoteInterceptorsHandler_create(celix_bundle_context_t *ctx, rem // Create service tracker here, and not in the activator celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; opts.filter.serviceName = REMOTE_INTERCEPTOR_SERVICE_NAME; - opts.filter.ignoreServiceLanguage = true; opts.callbackHandle = *handler; opts.addWithProperties = remoteInterceptorsHandler_addInterceptor; opts.removeWithProperties = remoteInterceptorsHandler_removeInterceptor; diff --git a/bundles/shell/shell/src/c_shell_activator.c b/bundles/shell/shell/src/c_shell_activator.c index 6dcc0d5d9..d9334e6b9 100644 --- a/bundles/shell/shell/src/c_shell_activator.c +++ b/bundles/shell/shell/src/c_shell_activator.c @@ -105,7 +105,6 @@ celix_status_t celix_bundleActivator_start(void *activatorData, celix_bundle_con opts.callbackHandle = activator->shell; opts.addWithProperties = (void*) shell_addCommand; opts.removeWithProperties = (void*) shell_removeCommand; - opts.filter.ignoreServiceLanguage = true; opts.filter.serviceName = CELIX_SHELL_COMMAND_SERVICE_NAME; activator->trackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts); } diff --git a/libs/framework/gtest/src/DependencyManagerTestSuite.cc b/libs/framework/gtest/src/DependencyManagerTestSuite.cc index 1d03134b6..f91a2be34 100644 --- a/libs/framework/gtest/src/DependencyManagerTestSuite.cc +++ b/libs/framework/gtest/src/DependencyManagerTestSuite.cc @@ -404,7 +404,6 @@ TEST_F(DependencyManagerTestSuite, BuildSvcProvide) { opts.serviceName = "TestService"; opts.filter = "(key1=value)"; - opts.ignoreServiceLanguage = true; svcId = celix_bundleContext_findServiceWithOptions(ctx, &opts); EXPECT_GT(svcId, -1); //found, so properties present @@ -575,7 +574,6 @@ TEST_F(DependencyManagerTestSuite, RequiredDepsAreInjectedDuringStartStop) { celix_service_registration_options opts{}; opts.svc = &svc; opts.serviceName = svcName.c_str(); - opts.serviceLanguage = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE; long svcId = celix_bundleContext_registerServiceWithOptions(dm.bundleContext(), &opts); EXPECT_GE(svcId, 0); @@ -867,7 +865,6 @@ TEST_F(DependencyManagerTestSuite, DepsAreInjectedAsSharedPointers) { celix_service_registration_options opts{}; opts.svc = &svc; opts.serviceName = svcName.c_str(); - opts.serviceLanguage = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE; long svcId = celix_bundleContext_registerServiceWithOptions(dm.bundleContext(), &opts); EXPECT_GE(svcId, 0); @@ -929,7 +926,6 @@ TEST_F(DependencyManagerTestSuite, DepsNoPropsAreInjectedAsSharedPointers) { celix_service_registration_options opts{}; opts.svc = &svc; opts.serviceName = svcName.c_str(); - opts.serviceLanguage = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE; long svcId = celix_bundleContext_registerServiceWithOptions(dm.bundleContext(), &opts); EXPECT_GE(svcId, 0); @@ -987,7 +983,6 @@ TEST_F(DependencyManagerTestSuite, UnneededSuspendIsPrevented) { celix_service_registration_options opts{}; opts.svc = &svc; opts.serviceName = svcName.c_str(); - opts.serviceLanguage = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE; long svcId = celix_bundleContext_registerServiceWithOptions(dm.bundleContext(), &opts); EXPECT_GE(svcId, 0); diff --git a/libs/framework/include/celix/UseServiceBuilder.h b/libs/framework/include/celix/UseServiceBuilder.h index db73ed898..bc24f4012 100644 --- a/libs/framework/include/celix/UseServiceBuilder.h +++ b/libs/framework/include/celix/UseServiceBuilder.h @@ -146,7 +146,6 @@ namespace celix { std::size_t build() { celix_service_use_options_t opts{}; opts.filter.serviceName = name.empty() ? nullptr : name.c_str(); - opts.filter.ignoreServiceLanguage = true; opts.filter.filter = filter.empty() ? nullptr : filter.getFilterCString(); opts.filter.versionRange = versionRange.empty() ? nullptr : versionRange.c_str(); opts.waitTimeoutInSeconds = timeoutInSeconds; diff --git a/libs/framework/include/celix/dm/ServiceDependency.h b/libs/framework/include/celix/dm/ServiceDependency.h index 3a2c14da1..f8a343f07 100644 --- a/libs/framework/include/celix/dm/ServiceDependency.h +++ b/libs/framework/include/celix/dm/ServiceDependency.h @@ -220,12 +220,6 @@ namespace celix { namespace dm { std::function remove ); - /** - * Specify if the service dependency should add a service.lang filter part if it is not already present - * For C service dependencies 'service.lang=C' will be added. - */ - CServiceDependency& setAddLanguageFilter(bool addLang); - /** * "Build" the service dependency. * When build the service dependency is active and the service tracker is created. @@ -422,16 +416,6 @@ namespace celix { namespace dm { */ ServiceDependency& setStrategy(DependencyUpdateStrategy strategy); - /** - * Specify if the service dependency should add a service.lang filter part if it is not already present - * For C++ service dependencies 'service.lang=C++' will be added. - * Should be called before - * - * @return the service dependency reference for chaining (fluent API) - */ - ServiceDependency& setAddLanguageFilter(bool addLang); - - /** * "Build" the service dependency. * When build the service dependency is active and the service tracker is created. diff --git a/libs/framework/include/celix/dm/ServiceDependency_Impl.h b/libs/framework/include/celix/dm/ServiceDependency_Impl.h index 8fc501045..6bb03d2d0 100644 --- a/libs/framework/include/celix/dm/ServiceDependency_Impl.h +++ b/libs/framework/include/celix/dm/ServiceDependency_Impl.h @@ -112,13 +112,6 @@ void CServiceDependency::setupService() { celix_dmServiceDependency_setService(this->cServiceDependency(), this->name.c_str(), cversion, cfilter); } -template -CServiceDependency& CServiceDependency::setAddLanguageFilter(bool addLang) { - celix_serviceDependency_setAddCLanguageFilter(this->cServiceDependency(), addLang); - this->setupService(); - return *this; -} - template CServiceDependency& CServiceDependency::setRequired(bool req) { celix_dmServiceDependency_setRequired(this->cServiceDependency(), req); @@ -310,14 +303,6 @@ ServiceDependency& ServiceDependency::setVersionRange(const std::strin return *this; } - -template -ServiceDependency& ServiceDependency::setAddLanguageFilter(bool addLang) { - this->addCxxLanguageFilter = addLang; - setupService(); - return *this; -} - //set callbacks template ServiceDependency& ServiceDependency::setCallbacks(void (T::*set)(I* service)) { diff --git a/libs/framework/include/celix_bundle_context.h b/libs/framework/include/celix_bundle_context.h index 24ef1a5ae..d582fabd6 100644 --- a/libs/framework/include/celix_bundle_context.h +++ b/libs/framework/include/celix_bundle_context.h @@ -169,13 +169,6 @@ typedef struct celix_service_registration_options { */ celix_properties_t *properties CELIX_OPTS_INIT; - /** - * @brief The optional service language. - * - * If this is NULL, CELIX_FRAMEWORK_SERVICE_LANGUAGE_C is used. - */ - const char* serviceLanguage CELIX_OPTS_INIT; - /** * @brief The optional service version (in the form of ...). * @@ -212,7 +205,6 @@ typedef struct celix_service_registration_options { .factory = NULL, \ .serviceName = NULL, \ .properties = NULL, \ - .serviceLanguage = NULL, \ .serviceVersion = NULL, \ .asyncData = NULL, \ .asyncCallback = NULL } @@ -373,26 +365,13 @@ typedef struct celix_service_filter_options { * The filter will be applied to all the user provided and framework provided service properties. */ const char* filter CELIX_OPTS_INIT; - - /** - * @deprecated This value is not used any more. If a service language filter is still required add it to the - * filter. - */ - const char* serviceLanguage CELIX_OPTS_INIT; - - - /** - * @deprecated This value is not used any more. If a service language filter is still required add it to the - * filter. - */ - bool ignoreServiceLanguage CELIX_OPTS_INIT; } celix_service_filter_options_t; #ifndef __cplusplus /*! * @brief C Macro to create a empty celix_service_filter_options_t type. */ -#define CELIX_EMPTY_SERVICE_FILTER_OPTIONS {.serviceName = NULL, .versionRange = NULL, .filter = NULL, .serviceLanguage = NULL, .ignoreServiceLanguage = false} +#define CELIX_EMPTY_SERVICE_FILTER_OPTIONS {.serviceName = NULL, .versionRange = NULL, .filter = NULL} #endif /** @@ -602,8 +581,6 @@ typedef struct celix_service_tracking_options { #define CELIX_EMPTY_SERVICE_TRACKING_OPTIONS { .filter.serviceName = NULL, \ .filter.versionRange = NULL, \ .filter.filter = NULL, \ - .filter.serviceLanguage = NULL, \ - .filter.ignoreServiceLanguage = false, \ .callbackHandle = NULL, \ .set = NULL, \ .add = NULL, \ @@ -820,7 +797,6 @@ typedef struct celix_service_use_options { #define CELIX_EMPTY_SERVICE_USE_OPTIONS {.filter.serviceName = NULL, \ .filter.versionRange = NULL, \ .filter.filter = NULL, \ - .filter.serviceLanguage = NULL, \ .waitTimeoutInSeconds = 0.0F, \ .callbackHandle = NULL, \ .use = NULL, \ @@ -1187,7 +1163,7 @@ CELIX_FRAMEWORK_EXPORT size_t celix_bundleContext_useBundles( */ typedef struct celix_service_tracker_info { /** - * @brief The parsed service filter, e.g. parsed "(&(objectClass=example_calc)(service.language=C)(meta.info=foo))" + * @brief The parsed service filter, e.g. parsed "(&(objectClass=example_calc)(meta.info=foo))" */ celix_filter_t *filter; @@ -1196,12 +1172,6 @@ typedef struct celix_service_tracker_info { */ const char* serviceName; - /** - * @deprecated - * Deprecated. the value will be NULL. - */ - const char* serviceLanguage; - /** * @brief Bundle id of the owner of the service tracker. */ diff --git a/libs/framework/include/celix_constants.h b/libs/framework/include/celix_constants.h index 76920c5bf..8f09b4d8b 100644 --- a/libs/framework/include/celix_constants.h +++ b/libs/framework/include/celix_constants.h @@ -118,14 +118,6 @@ extern "C" { */ #define CELIX_FRAMEWORK_SERVICE_VERSION "service.version" -/** - * The service language property and values are deprecated - */ -#define CELIX_FRAMEWORK_SERVICE_LANGUAGE "service.lang" -#define CELIX_FRAMEWORK_SERVICE_C_LANGUAGE "C" -#define CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE "C++" -#define CELIX_FRAMEWORK_SERVICE_SHARED_LANGUAGE "shared" //e.g. marker services - #define CELIX_FRAMEWORK_BUNDLE_ACTIVATOR "Bundle-Activator" #define OSGI_FRAMEWORK_BUNDLE_ACTIVATOR CELIX_FRAMEWORK_BUNDLE_ACTIVATOR diff --git a/libs/framework/include/celix_dm_service_dependency.h b/libs/framework/include/celix_dm_service_dependency.h index c416c6a0b..daa9be290 100644 --- a/libs/framework/include/celix_dm_service_dependency.h +++ b/libs/framework/include/celix_dm_service_dependency.h @@ -86,12 +86,6 @@ CELIX_FRAMEWORK_EXPORT void celix_dmServiceDependency_destroy(celix_dm_service_d */ CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmServiceDependency_setRequired(celix_dm_service_dependency_t *dependency, bool required); -/** - * Specify if the service dependency should add a C language filter for this dependency if no "service.lang" part is found the in the provided filter. - * Default is false - */ -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t celix_dmServiceDependency_setAddCLanguageFilter(celix_dm_service_dependency_t *dependency, bool addCLangFilter); - /** * Specify if the service dependency update strategy. * diff --git a/libs/framework/include_deprecated/dm_service_dependency.h b/libs/framework/include_deprecated/dm_service_dependency.h index 9d021a650..eba99c019 100644 --- a/libs/framework/include_deprecated/dm_service_dependency.h +++ b/libs/framework/include_deprecated/dm_service_dependency.h @@ -75,12 +75,6 @@ CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t serviceDependency_destroy(celix */ CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t serviceDependency_setRequired(celix_dm_service_dependency_t *dependency, bool required); -/** - * Specify if the service dependency should add a C language filter for this dependency if no "service.lang" part is found the in the provided filter. - * Default is false - */ -CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t serviceDependency_setAddCLanguageFilter(celix_dm_service_dependency_t *dependency, bool addCLangFilter); - /** * Specify if the service dependency update strategy. * diff --git a/libs/framework/include_deprecated/service_registry.h b/libs/framework/include_deprecated/service_registry.h index 2b9cf794a..40e568cca 100644 --- a/libs/framework/include_deprecated/service_registry.h +++ b/libs/framework/include_deprecated/service_registry.h @@ -140,8 +140,6 @@ CELIX_FRAMEWORK_EXPORT void celix_serviceRegistry_unregisterService(celix_servic * @param serviceName The optional service name * @param versionRange The optional version range * @param filter The optional filter - * @param serviceLanguage The optional service lang. if NULL, lang C will be used. - * @param ignoreServiceLanguage The whether the service lang filter needs to be added to the filter. * @return a LDAP filter. Caller is responsible for freeing the filter. */ CELIX_FRAMEWORK_EXPORT char* celix_serviceRegistry_createFilterFor( diff --git a/libs/framework/src/dm_component_impl.c b/libs/framework/src/dm_component_impl.c index 73ae3783f..8ba8def34 100644 --- a/libs/framework/src/dm_component_impl.c +++ b/libs/framework/src/dm_component_impl.c @@ -906,7 +906,6 @@ static celix_status_t celix_dmComponent_registerServices(celix_dm_component_t *c opts.properties = regProps; opts.svc = (void*)interface->service; opts.serviceName = interface->serviceName; - opts.serviceLanguage = celix_properties_get(regProps, CELIX_FRAMEWORK_SERVICE_LANGUAGE, NULL); celix_bundleContext_log(component->context, CELIX_LOG_LEVEL_TRACE, "Async registering service %s for component %s (uuid=%s)", interface->serviceName, diff --git a/libs/framework/src/dm_service_dependency.c b/libs/framework/src/dm_service_dependency.c index e2e074af9..ab80e835b 100644 --- a/libs/framework/src/dm_service_dependency.c +++ b/libs/framework/src/dm_service_dependency.c @@ -95,15 +95,6 @@ celix_status_t celix_dmServiceDependency_setRequired(celix_dm_service_dependency return status; } -celix_status_t serviceDependency_setAddCLanguageFilter(celix_dm_service_dependency_t *dependency, bool addCLangFilter) { - return celix_dmServiceDependency_setAddCLanguageFilter(dependency, addCLangFilter); -} - -celix_status_t celix_dmServiceDependency_setAddCLanguageFilter(celix_dm_service_dependency_t *dependency, bool addCLangFilter) { - dependency->addCLanguageFilter = addCLangFilter; - return CELIX_SUCCESS; -} - celix_status_t serviceDependency_setStrategy(celix_dm_service_dependency_t *dependency, dm_service_dependency_strategy_t strategy) { return celix_dmServiceDependency_setStrategy(dependency, strategy); } @@ -192,36 +183,30 @@ celix_status_t celix_dmServiceDependency_setComponent(celix_dm_service_dependenc return CELIX_SUCCESS; } -celix_status_t celix_dmServiceDependency_enable(celix_dm_service_dependency_t *dependency) { - celix_bundle_context_t* ctx = celix_dmComponent_getBundleContext(dependency->component); +celix_status_t celix_dmServiceDependency_enable(celix_dm_service_dependency_t* dependency) { + celix_bundle_context_t* ctx = celix_dmComponent_getBundleContext(dependency->component); - if (dependency->serviceName == NULL && dependency->filter == NULL) { - celix_bundleContext_log(ctx, CELIX_LOG_LEVEL_ERROR, - "Cannot start a service dependency without a service name and filter"); - return CELIX_ILLEGAL_ARGUMENT; - } + if (dependency->serviceName == NULL && dependency->filter == NULL) { + celix_bundleContext_log( + ctx, CELIX_LOG_LEVEL_ERROR, "Cannot start a service dependency without a service name and filter"); + return CELIX_ILLEGAL_ARGUMENT; + } - celixThreadMutex_lock(&dependency->mutex); - if (dependency->svcTrackerId == -1L) { - celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; - opts.filter.filter = dependency->filter; - opts.filter.serviceName = dependency->serviceName; - opts.filter.versionRange = dependency->versionRange; - opts.callbackHandle = dependency; - opts.addWithProperties = serviceDependency_addServiceTrackerCallback; - opts.removeWithProperties = serviceDependency_removeServiceTrackerCallback; - opts.setWithProperties = serviceDependency_setServiceTrackerCallback; - if (dependency->addCLanguageFilter) { - opts.filter.ignoreServiceLanguage = false; - opts.filter.serviceLanguage = CELIX_FRAMEWORK_SERVICE_C_LANGUAGE; - } else { - opts.filter.ignoreServiceLanguage = true; + celixThreadMutex_lock(&dependency->mutex); + if (dependency->svcTrackerId == -1L) { + celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS; + opts.filter.filter = dependency->filter; + opts.filter.serviceName = dependency->serviceName; + opts.filter.versionRange = dependency->versionRange; + opts.callbackHandle = dependency; + opts.addWithProperties = serviceDependency_addServiceTrackerCallback; + opts.removeWithProperties = serviceDependency_removeServiceTrackerCallback; + opts.setWithProperties = serviceDependency_setServiceTrackerCallback; + dependency->svcTrackerId = celix_bundleContext_trackServicesWithOptionsAsync(ctx, &opts); } - dependency->svcTrackerId = celix_bundleContext_trackServicesWithOptionsAsync(ctx, &opts); - } - celixThreadMutex_unlock(&dependency->mutex); + celixThreadMutex_unlock(&dependency->mutex); - return CELIX_SUCCESS; + return CELIX_SUCCESS; } static void celix_serviceDependency_stopCallback(void *data) { diff --git a/libs/framework/src/dm_service_dependency_impl.h b/libs/framework/src/dm_service_dependency_impl.h index 4682ee397..6d43785d6 100644 --- a/libs/framework/src/dm_service_dependency_impl.h +++ b/libs/framework/src/dm_service_dependency_impl.h @@ -35,32 +35,31 @@ extern "C" { #include "dm_component.h" struct celix_dm_service_dependency_svc_entry { - void *svc; + void* svc; const celix_properties_t* props; }; struct celix_dm_service_dependency { - celix_dm_service_update_fp set; - celix_dm_service_update_fp add; - celix_dm_service_update_fp remove; + celix_dm_service_update_fp set; + celix_dm_service_update_fp add; + celix_dm_service_update_fp remove; - celix_dm_service_update_with_props_fp setWithProperties; - celix_dm_service_update_with_props_fp addWithProperties; - celix_dm_service_update_with_props_fp remWithProperties; + celix_dm_service_update_with_props_fp setWithProperties; + celix_dm_service_update_with_props_fp addWithProperties; + celix_dm_service_update_with_props_fp remWithProperties; - char *serviceName; - char *filter; - char *versionRange; + char* serviceName; + char* filter; + char* versionRange; bool required; dm_service_dependency_strategy_t strategy; - bool addCLanguageFilter; - celix_dm_component_t *component; + celix_dm_component_t* component; - celix_thread_mutex_t mutex; //protects below - long svcTrackerId; //active tracker id - size_t nrOfActiveStoppingTrackers; //nr of async stop tracker still active (should be 0 or 1) + celix_thread_mutex_t mutex; // protects below + long svcTrackerId; // active tracker id + size_t nrOfActiveStoppingTrackers; // nr of async stop tracker still active (should be 0 or 1) size_t trackedSvcCount; - void* callbackHandle; //This handle can be set to be used instead of the component implementation + void* callbackHandle; // This handle can be set to be used instead of the component implementation }; celix_status_t celix_dmServiceDependency_enable(celix_dm_service_dependency_t *dependency); From 0e47071f6a9387707afec78c1b23784475fb8e25 Mon Sep 17 00:00:00 2001 From: Pepijn Noltes Date: Sat, 28 Oct 2023 16:44:33 +0200 Subject: [PATCH 08/11] #509: Update CHANGES.md --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index ef9792dbb..11cb59521 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -33,6 +33,8 @@ limitations under the License. - pubsub_serializer.h is removed and no longer supported. Use pubsub_message_serialization_service.h instead. - C++11 support for dm is removed. C++14 is now the minimum required version. - C++17 string_view support is removed from the utils and framework lib. +- Apache Celix CMake bundle functions without a celix_ prefix or infix are removed. +- Apache Celix CMake support for creating docker images and creating runtimes dirs is removed. # Noteworthy Changes for 2.4.0 (2023-09-27) From 70d22bf73e5ccfbfe34ea3f7bd92e42e56462d9f Mon Sep 17 00:00:00 2001 From: Pepijn Noltes Date: Sat, 28 Oct 2023 16:45:19 +0200 Subject: [PATCH 09/11] #509: Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index ef9792dbb..3880cd00d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -33,6 +33,7 @@ limitations under the License. - pubsub_serializer.h is removed and no longer supported. Use pubsub_message_serialization_service.h instead. - C++11 support for dm is removed. C++14 is now the minimum required version. - C++17 string_view support is removed from the utils and framework lib. +- Support and usage of "service.lang" service property is removed. # Noteworthy Changes for 2.4.0 (2023-09-27) From 96acf4d2b83c5560482f64ee0d744feb37e8515e Mon Sep 17 00:00:00 2001 From: PengZheng Date: Tue, 31 Oct 2023 12:27:45 +0800 Subject: [PATCH 10/11] Upgrade ccache to 4.7.4. --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index dbc61bac2..f1d242112 100644 --- a/conanfile.py +++ b/conanfile.py @@ -147,7 +147,7 @@ def build_requirements(self): self.test_requires("gtest/1.10.0") self.test_requires("cpputest/4.0") if self.options.enable_ccache: - self.build_requires("ccache/4.6") + self.build_requires("ccache/4.7.4") def configure(self): # copy options to options, fill in defaults if not set From afedd68c0a395742ab39e0d50d81d515d7cee57f Mon Sep 17 00:00:00 2001 From: PengZheng Date: Tue, 31 Oct 2023 12:43:50 +0800 Subject: [PATCH 11/11] Update the default conan profile to C++17. --- .github/workflows/conan_create.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/conan_create.yml b/.github/workflows/conan_create.yml index c93bf7e87..460607f3a 100644 --- a/.github/workflows/conan_create.yml +++ b/.github/workflows/conan_create.yml @@ -38,6 +38,7 @@ jobs: run: | # build profile conan profile detect -f + sed -i 's/compiler.cppstd=gnu14/compiler.cppstd=gnu17/g' `conan profile path default` - name: Conan Cache id: cache-conan uses: actions/cache@v3