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

pnoltes pushed a commit to branch feature/509-remove-static-dm-libs
in repository https://gitbox.apache.org/repos/asf/celix.git

commit c93e516bd39dc5d2af82e671ae8a29052108bba2
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sun Oct 1 13:30:27 2023 +0200

    #509: Remove static dm libs (dm is integral part of framework)
---
 libs/CMakeLists.txt                             |  7 --
 libs/dependency_manager/CMakeLists.txt          | 58 ----------------
 libs/dependency_manager/api/dm_activator.h      | 54 ---------------
 libs/dependency_manager/src/dm_activator.c      | 42 -----------
 libs/dependency_manager_cxx/CMakeLists.txt      | 38 ----------
 libs/dependency_manager_cxx/src/dm_activator.cc | 92 -------------------------
 6 files changed, 291 deletions(-)

diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
index 7c712776..8da61c27 100644
--- a/libs/CMakeLists.txt
+++ b/libs/CMakeLists.txt
@@ -29,14 +29,7 @@ add_subdirectory(framework)
 #launcher
 add_subdirectory(launcher)
 
-#add_subdirectory(event_admin)# event_admin is unstable
-add_subdirectory(dependency_manager)
-if (CELIX_CXX14)
-    add_subdirectory(dependency_manager_cxx)
-endif ()
-
 # Error Injectors
 if (ENABLE_TESTING AND EI_TESTS)
     add_subdirectory(error_injector)
 endif ()
-
diff --git a/libs/dependency_manager/CMakeLists.txt 
b/libs/dependency_manager/CMakeLists.txt
deleted file mode 100644
index 2c1f759b..00000000
--- a/libs/dependency_manager/CMakeLists.txt
+++ /dev/null
@@ -1,58 +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.
-
-#dummy libaries to ensure backward compatability with projects using the 
dependency manager libs/shell
-celix_subproject(DEPENDENCY_MANAGER "Option to enable building the legacy 
Dependency Manager" ON)
-if (DEPENDENCY_MANAGER)
-    add_library(dependency_manager_static STATIC src/dm_activator.c)
-    celix_deprecated_framework_headers(dependency_manager_static)
-    target_include_directories(dependency_manager_static PUBLIC
-            $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api>
-            )
-    if (APPLE)
-        target_link_libraries(dependency_manager_static Celix::framework 
"-undefined dynamic_lookup")
-    else()
-        target_link_libraries(dependency_manager_static Celix::framework)
-    endif()
-
-    add_library(dependency_manager_so SHARED src/dm_activator.c)
-    celix_deprecated_framework_headers(dependency_manager_so)
-    target_include_directories(dependency_manager_so PUBLIC
-            $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api>
-            )
-    if (APPLE)
-        target_link_libraries(dependency_manager_so Celix::framework 
"-undefined dynamic_lookup")
-    else()
-        target_link_libraries(dependency_manager_so Celix::framework)
-    endif()
-
-    #now part of the the shell bundle
-    add_library(dm_shell INTERFACE)
-
-    celix_deprecated_utils_headers(dependency_manager_static)
-    celix_deprecated_utils_headers(dependency_manager_so)
-
-    #Setup target aliases to match external usage
-    add_library(Celix::dm_shell ALIAS dm_shell)
-    add_library(Celix::dependency_manager_static ALIAS 
dependency_manager_static)
-    add_library(Celix::dependency_manager_so ALIAS dependency_manager_so)
-
-    #install dummy libs
-    install(TARGETS dependency_manager_static dependency_manager_so dm_shell 
EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework
-            INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix)
-endif ()
-
diff --git a/libs/dependency_manager/api/dm_activator.h 
b/libs/dependency_manager/api/dm_activator.h
deleted file mode 100644
index ffc8ccc1..00000000
--- a/libs/dependency_manager/api/dm_activator.h
+++ /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.
- */
-
-#ifndef DM_ACTIVATOR_BASE_H_
-#define DM_ACTIVATOR_BASE_H_
-
-#include "celix_bundle_context.h"
-#include "dm_dependency_manager.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Should be implemented by a bundle specific DM activator.
- * Should allocate and initialize a bundle specific activator struct.
- */
-celix_status_t dm_create(celix_bundle_context_t *ctx, void ** userData);
-
-/**
- * Should be implemented by a bundle specific DM activator.
- * Will be called after the dm_create function.
- * Can be used to specify with use of the provided dependency manager the 
bundle specific components.
- */
-celix_status_t dm_init(void * userData, celix_bundle_context_t *ctx, 
dm_dependency_manager_t *mng);
-
-/**
- * Should be implemented by a bundle specific DM activator.
- * Should deinitialize and deallocate the bundle specific activator struct.
- */
-celix_status_t dm_destroy(void * userData, celix_bundle_context_t *ctx, 
dm_dependency_manager_t *mng);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* DM_ACTIVATOR_BASE_H_ */
-
diff --git a/libs/dependency_manager/src/dm_activator.c 
b/libs/dependency_manager/src/dm_activator.c
deleted file mode 100644
index 35dc5bb8..00000000
--- a/libs/dependency_manager/src/dm_activator.c
+++ /dev/null
@@ -1,42 +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.
- */
-
-#include "dm_activator.h"
-#include "celix_compiler.h"
-
-#include <stdlib.h>
-
-
-celix_status_t bundleActivator_create(celix_bundle_context_t *ctx, void 
**userData) {
-    return dm_create(ctx, userData);
-}
-
-celix_status_t bundleActivator_start(void *userData, celix_bundle_context_t 
*ctx) {
-    dm_dependency_manager_t *mng = 
celix_bundleContext_getDependencyManager(ctx);
-    return dm_init(userData, ctx, mng);
-}
-
-celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t 
*ctx) {
-    dm_dependency_manager_t *mng = 
celix_bundleContext_getDependencyManager(ctx);
-    return dm_destroy(userData, ctx, mng);
-}
-
-celix_status_t bundleActivator_destroy(void * userData  CELIX_UNUSED, 
celix_bundle_context_t *ctx CELIX_UNUSED) {
-    return CELIX_SUCCESS; //nothing to do
-}
diff --git a/libs/dependency_manager_cxx/CMakeLists.txt 
b/libs/dependency_manager_cxx/CMakeLists.txt
deleted file mode 100644
index e28880d0..00000000
--- a/libs/dependency_manager_cxx/CMakeLists.txt
+++ /dev/null
@@ -1,38 +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.
-celix_subproject(DEPENDENCY_MANAGER_CXX "Option to enable building the legacy 
C++ Dependency Manager" ON)
-if (DEPENDENCY_MANAGER_CXX)
-    add_library(dependency_manager_cxx_static STATIC
-            src/dm_activator.cc
-            )
-    celix_deprecated_framework_headers(dependency_manager_cxx_static)
-    set_target_properties(dependency_manager_cxx_static PROPERTIES OUTPUT_NAME 
"celix_dependency_manager_cxx_static")
-    target_compile_options(dependency_manager_cxx_static PRIVATE -fPIC)
-    target_compile_options(dependency_manager_cxx_static PRIVATE 
-Wno-deprecated-declarations)
-    if (APPLE)
-        target_link_libraries(dependency_manager_cxx_static Celix::framework 
"-undefined dynamic_lookup")
-    else()
-        target_link_libraries(dependency_manager_cxx_static Celix::framework)
-    endif()
-
-    install(TARGETS dependency_manager_cxx_static EXPORT celix DESTINATION 
${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
-
-    celix_deprecated_utils_headers(dependency_manager_cxx_static)
-
-    #Setup target aliases to match external usage
-    add_library(Celix::dependency_manager_cxx_static ALIAS 
dependency_manager_cxx_static)
-endif ()
diff --git a/libs/dependency_manager_cxx/src/dm_activator.cc 
b/libs/dependency_manager_cxx/src/dm_activator.cc
deleted file mode 100644
index 0bba0a56..00000000
--- a/libs/dependency_manager_cxx/src/dm_activator.cc
+++ /dev/null
@@ -1,92 +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.
- */
-
-#include <utility>
-#include <memory>
-
-#include "celix/dm/DependencyManager.h"
-#include "celix/dm/DmActivator.h"
-#include "bundle_activator.h"
-
-
-/**
- * Deprecated. Use the CELIX_GEN_CXX_BUNDLE_ACTIVATOR marco from 
celix_bundle_activator.h instead
- */
-struct BundleActivatorData {
-    std::shared_ptr<DependencyManager> mng;
-    std::unique_ptr<celix::dm::DmActivator> act;
-};
-
-extern "C" celix_status_t bundleActivator_create(celix_bundle_context_t 
*context, void** userData) {
-    int status = CELIX_SUCCESS;
-
-    BundleActivatorData* data = nullptr;
-#ifdef __EXCEPTIONS
-    data = new BundleActivatorData{
-        .mng = std::make_shared<celix::dm::DependencyManager>(context),
-        .act = nullptr
-    };
-#else
-    data = new(std::nothrow) BundleActivatorData{
-            .mng = celix::dm::DependencyManager{context},
-            .act = nullptr
-    };
-#endif
-    if (data != nullptr) {
-        data->act = 
std::unique_ptr<celix::dm::DmActivator>{celix::dm::DmActivator::create(*data->mng)};
-    }
-
-    if (data == nullptr || data->act == nullptr) {
-        status = CELIX_ENOMEM;
-        if (data != nullptr) {
-            delete data;
-        }
-        *userData = nullptr;
-    } else {
-        *userData = data;
-    }
-    return status;
-}
-
-extern "C" celix_status_t bundleActivator_start(void* userData, 
celix_bundle_context_t *) {
-    int status = CELIX_SUCCESS;
-    auto* data = static_cast<BundleActivatorData*>(userData);
-    if (data != nullptr) {
-        status = data->act->start();
-    }
-    return status;
-}
-
-extern "C" celix_status_t bundleActivator_stop(void* userData, 
celix_bundle_context_t *) {
-    int status = CELIX_SUCCESS;
-    auto* data = static_cast<BundleActivatorData*>(userData);
-    if (data != nullptr) {
-        status = data->act->stop();
-        data->act = nullptr;
-    }
-    return status;
-}
-
-extern "C" celix_status_t bundleActivator_destroy(void *userData, 
celix_bundle_context_t* ) {
-    auto* data = static_cast<BundleActivatorData*>(userData);
-    if (data != nullptr) {
-        delete data;
-    }
-    return CELIX_SUCCESS;
-}
\ No newline at end of file

Reply via email to