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

pnoltes pushed a commit to branch feature/509-remove-install-of-v2-headers
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 54e2d65abcc33b67a793ac20fc3b40ad947aa212
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sun Oct 1 13:26:16 2023 +0200

    #509: Remove install and use of deprecated shell headers
---
 bundles/shell/shell/CMakeLists.txt                 | 10 +---
 bundles/shell/shell/deprecated_api/command.h       | 53 --------------------
 bundles/shell/shell/deprecated_api/shell.h         | 31 ------------
 .../shell/shell/deprecated_api/shell_constants.h   | 28 -----------
 bundles/shell/shell/gtest/CMakeLists.txt           |  3 --
 bundles/shell/shell/gtest/src/ShellTestSuite.cc    | 20 --------
 bundles/shell/shell/src/c_shell.c                  | 56 ----------------------
 7 files changed, 1 insertion(+), 200 deletions(-)

diff --git a/bundles/shell/shell/CMakeLists.txt 
b/bundles/shell/shell/CMakeLists.txt
index 140f4ea4..b37cb3ea 100644
--- a/bundles/shell/shell/CMakeLists.txt
+++ b/bundles/shell/shell/CMakeLists.txt
@@ -22,11 +22,7 @@ if (SHELL_API)
             $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api>
             )
     target_link_libraries(shell_api INTERFACE Celix::utils)
-
-        target_include_directories(shell_api INTERFACE 
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/deprecated_api>)
-    if (CELIX_INSTALL_DEPRECATED_API)
-        install(DIRECTORY deprecated_api/ DESTINATION 
${CMAKE_INSTALL_INCLUDEDIR}/celix/shell COMPONENT shell)
-    endif ()
+    target_include_directories(shell_api INTERFACE 
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/deprecated_api>)
 
     install(TARGETS shell_api EXPORT celix COMPONENT shell
             INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/shell)
@@ -68,11 +64,7 @@ if (SHELL)
             )
     target_include_directories(shell PRIVATE src)
     target_link_libraries(shell PRIVATE shell_commands Celix::shell_api 
Celix::log_helper)
-    target_compile_options(shell PRIVATE -Wno-deprecated-declarations)
     celix_deprecated_utils_headers(shell)
-    if (CELIX_INSTALL_DEPRECATED_API)
-        target_compile_definitions(shell PRIVATE CELIX_INSTALL_DEPRECATED_API)
-    endif ()
     install_celix_bundle(shell EXPORT celix COMPONENT shell)
 
     #Setup target aliases to match external usage
diff --git a/bundles/shell/shell/deprecated_api/command.h 
b/bundles/shell/shell/deprecated_api/command.h
deleted file mode 100644
index c3fae14b..00000000
--- a/bundles/shell/shell/deprecated_api/command.h
+++ /dev/null
@@ -1,53 +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 COMMAND_H_
-#define COMMAND_H_
-
-#include "celix_errno.h"
-#include <stdio.h>
-
-#define OSGI_SHELL_COMMAND_NAME "command.name"
-#define OSGI_SHELL_COMMAND_USAGE "command.usage"
-#define OSGI_SHELL_COMMAND_DESCRIPTION "command.description"
-
-#define OSGI_SHELL_COMMAND_SERVICE_NAME "commandService"
-#define OSGI_SHELL_COMMAND_SERVICE_VERSION "1.0.0"
-
-typedef struct commandService command_service_t;
-typedef command_service_t * command_service_pt;
-
-
-/**
- * The command service can be used to register additional shell commands.
- * The service should be register with the following properties:
- *  - command.name: mandatory, name of the command e.g. 'lb'
- *  - command.usage: optional, string describing how tu use the command e.g. 
'lb [-l | -s | -u]'
- *  - command.description: optional, string describing the command e.g. 'list 
bundles.'
- *
- *  \deprecated Replaced by celix_shell_command_t
- */
-struct commandService {
-    void *handle;
-
-    celix_status_t (*executeCommand)(void *handle, char * commandLine, FILE 
*outStream, FILE *errorStream) __attribute__((deprecated("command_service_t is 
replaced by celix_shell_command_t in celix_shell_command.h")));
-};
-
-
-#endif /* COMMAND_H_ */
diff --git a/bundles/shell/shell/deprecated_api/shell.h 
b/bundles/shell/shell/deprecated_api/shell.h
deleted file mode 100644
index 5a852ed2..00000000
--- a/bundles/shell/shell/deprecated_api/shell.h
+++ /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.
- */
-#ifndef SHELL_H_
-#define SHELL_H_
-
-#include "celix_shell.h"
-
-#define OSGI_SHELL_SERVICE_NAME     CELIX_SHELL_SERVICE_NAME
-#define OSGI_SHELL_SERVICE_VERSION  CELIX_SHELL_SERVICE_VERSION
-
-//NOTE celix_shell_t is a backwards compatible service for - the deprecated - 
shell_service_t.
-typedef celix_shell_t shell_service_t; //use celix_shell.h instead
-typedef celix_shell_t* shell_service_pt; //use celix_shell.h instead
-
-#endif /* SHELL_H_ */
diff --git a/bundles/shell/shell/deprecated_api/shell_constants.h 
b/bundles/shell/shell/deprecated_api/shell_constants.h
deleted file mode 100644
index 37f1750a..00000000
--- a/bundles/shell/shell/deprecated_api/shell_constants.h
+++ /dev/null
@@ -1,28 +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 SHELL_CONSTANTS_H_
-#define SHELL_CONSTANTS_H_
-
-#include "celix_shell_constants.h"
-
-#define SHELL_USE_ANSI_COLORS                   CELIX_SHELL_USE_ANSI_COLORS
-#define SHELL_USE_ANSI_COLORS_DEFAULT_VALUE     
CELIX_SHELL_USE_ANSI_COLORS_DEFAULT_VALUE
-
-#endif /* SHELL_CONSTANTS_H_ */
diff --git a/bundles/shell/shell/gtest/CMakeLists.txt 
b/bundles/shell/shell/gtest/CMakeLists.txt
index 2167e07d..91a50aef 100644
--- a/bundles/shell/shell/gtest/CMakeLists.txt
+++ b/bundles/shell/shell/gtest/CMakeLists.txt
@@ -22,9 +22,6 @@ add_executable(test_shell
 target_link_libraries(test_shell PRIVATE Celix::framework Celix::shell_api 
GTest::gtest GTest::gtest_main)
 celix_target_bundle_set_definition(test_shell NAME TEST_BUNDLES Celix::shell)
 target_compile_options(test_shell PRIVATE -Wno-deprecated-declarations)
-if (CELIX_INSTALL_DEPRECATED_API)
-    target_compile_definitions(test_shell PRIVATE CELIX_INSTALL_DEPRECATED_API)
-endif ()
 
 add_test(NAME test_shell COMMAND test_shell)
 setup_target_for_coverage(test_shell SCAN_DIR ..)
diff --git a/bundles/shell/shell/gtest/src/ShellTestSuite.cc 
b/bundles/shell/shell/gtest/src/ShellTestSuite.cc
index 8c43e016..8ee7c015 100644
--- a/bundles/shell/shell/gtest/src/ShellTestSuite.cc
+++ b/bundles/shell/shell/gtest/src/ShellTestSuite.cc
@@ -214,26 +214,6 @@ TEST_F(ShellTestSuite, localNameClashTest) {
 
 }
 
-#ifdef CELIX_INSTALL_DEPRECATED_API
-#include "command.h"
-TEST_F(ShellTestSuite, legacyCommandTest) {
-    command_service_t cmdService;
-    cmdService.handle = nullptr;
-    cmdService.executeCommand = [](void *, char* cmdLine, FILE *, FILE *) -> 
celix_status_t {
-        EXPECT_TRUE(cmdLine != nullptr);
-        return CELIX_SUCCESS;
-    };
-
-    celix_properties_t *props = celix_properties_create();
-    celix_properties_set(props, OSGI_SHELL_COMMAND_NAME, "testCommand");
-    long svcId = celix_bundleContext_registerService(ctx.get(), &cmdService, 
OSGI_SHELL_COMMAND_SERVICE_NAME, props);
-
-    callCommand(ctx, "testCommand", true);
-
-    celix_bundleContext_unregisterService(ctx.get(), svcId);
-}
-#endif
-
 #ifdef CXX_SHELL
 #include "celix/BundleContext.h"
 #include "celix/IShellCommand.h"
diff --git a/bundles/shell/shell/src/c_shell.c 
b/bundles/shell/shell/src/c_shell.c
index d4f063b1..ad386b6a 100644
--- a/bundles/shell/shell/src/c_shell.c
+++ b/bundles/shell/shell/src/c_shell.c
@@ -113,62 +113,6 @@ celix_status_t shell_removeCommand(shell_t *shell, 
celix_shell_command_t *svc, c
     return status;
 }
 
-#ifdef CELIX_INSTALL_DEPRECATED_API
-celix_status_t shell_addLegacyCommand(shell_t *shell, command_service_t *svc, 
const celix_properties_t *props) {
-    celix_status_t status = CELIX_SUCCESS;
-    const char *name = celix_properties_get(props, OSGI_SHELL_COMMAND_NAME, 
NULL);
-
-    if (name == NULL) {
-        celix_logHelper_log(shell->logHelper, CELIX_LOG_LEVEL_WARNING, 
"Command service must contain a '%s' property!", CELIX_SHELL_COMMAND_NAME);
-        status = CELIX_BUNDLE_EXCEPTION;
-    } else {
-        long svcId = celix_properties_getAsLong(props, 
OSGI_FRAMEWORK_SERVICE_ID, -1L);
-        celixThreadRwlock_writeLock(&shell->lock);
-        if (hashMap_containsKey(shell->legacyCommandServices, name)) {
-            celix_logHelper_log(shell->logHelper, CELIX_LOG_LEVEL_WARNING, 
"Command with name %s already registered!", name);
-        } else {
-            celix_legacy_command_entry_t *entry = calloc(1, sizeof(*entry));
-            entry->svcId = svcId;
-            entry->svc = svc;
-            entry->props = props;
-            hashMap_put(shell->legacyCommandServices, (void*)name, entry);
-        }
-        celixThreadRwlock_unlock(&shell->lock);
-    }
-
-    return status;
-}
-#endif
-
-#ifdef CELIX_INSTALL_DEPRECATED_API
-celix_status_t shell_removeLegacyCommand(shell_t *shell, command_service_t 
*svc, const celix_properties_t *props) {
-    celix_status_t status = CELIX_SUCCESS;
-    const char *name = celix_properties_get(props, OSGI_SHELL_COMMAND_NAME, 
NULL);
-
-    if (name == NULL) {
-        celix_logHelper_log(shell->logHelper, CELIX_LOG_LEVEL_WARNING, 
"Command service must contain a '%s' property!", OSGI_SHELL_COMMAND_NAME);
-        status = CELIX_BUNDLE_EXCEPTION;
-    } else {
-        long svcId = celix_properties_getAsLong(props, 
OSGI_FRAMEWORK_SERVICE_ID, -1L);
-        celixThreadRwlock_writeLock(&shell->lock);
-        if (hashMap_containsKey(shell->legacyCommandServices, name)) {
-            celix_legacy_command_entry_t *entry = 
hashMap_get(shell->legacyCommandServices, name);
-            if (entry->svcId == svcId) {
-                hashMap_remove(shell->legacyCommandServices, name);
-                free(entry);
-            } else {
-                celix_logHelper_log(shell->logHelper, CELIX_LOG_LEVEL_WARNING, 
"svc id for command with name %s does not match (%li == %li)!", name, svcId, 
entry->svcId);
-            }
-        } else {
-            celix_logHelper_log(shell->logHelper, CELIX_LOG_LEVEL_WARNING, 
"Cannot find shell command with name %s!", name);
-        }
-        celixThreadRwlock_unlock(&shell->lock);
-    }
-
-    return status;
-}
-#endif
-
 celix_status_t shell_getCommands(shell_t *shell, celix_array_list_t 
**outCommands) {
        celix_status_t status = CELIX_SUCCESS;
        celix_array_list_t *result = celix_arrayList_create();

Reply via email to