HDFS-15903. Refactor X-Platform lib (#2783)

This commit is contained in:
Gautham B A 2021-03-22 21:10:54 +05:30 committed by GitHub
parent 343ce8a8c9
commit 61bfa42389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 18 deletions

View File

@ -278,7 +278,7 @@ if(NEED_LINK_DL)
endif()
set(LIBHDFSPP_VERSION "0.1.0")
set(LIBHDFSPP_ALL_OBJECTS $<TARGET_OBJECTS:x_platform_utils_obj> $<TARGET_OBJECTS:bindings_c_obj> $<TARGET_OBJECTS:fs_obj> $<TARGET_OBJECTS:rpc_obj> $<TARGET_OBJECTS:reader_obj> $<TARGET_OBJECTS:proto_obj> $<TARGET_OBJECTS:connection_obj> $<TARGET_OBJECTS:common_obj> $<TARGET_OBJECTS:uriparser2_obj>)
set(LIBHDFSPP_ALL_OBJECTS $<TARGET_OBJECTS:x_platform_obj> $<TARGET_OBJECTS:bindings_c_obj> $<TARGET_OBJECTS:fs_obj> $<TARGET_OBJECTS:rpc_obj> $<TARGET_OBJECTS:reader_obj> $<TARGET_OBJECTS:proto_obj> $<TARGET_OBJECTS:connection_obj> $<TARGET_OBJECTS:common_obj> $<TARGET_OBJECTS:uriparser2_obj>)
if (HADOOP_BUILD)
hadoop_add_dual_library(hdfspp ${EMPTY_FILE_CC} ${LIBHDFSPP_ALL_OBJECTS})
hadoop_target_link_dual_libraries(hdfspp

View File

@ -23,6 +23,6 @@ set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
include_directories( ${LIBHDFSPP_DIR}/include )
link_directories( ${LIBHDFSPP_DIR}/lib )
add_executable(connect_cancel_c $<TARGET_OBJECTS:x_platform_utils_obj_c_api> connect_cancel.c)
add_executable(connect_cancel_c $<TARGET_OBJECTS:x_platform_obj_c_api> connect_cancel.c)
target_link_libraries(connect_cancel_c hdfspp_static uriparser2)
target_include_directories(connect_cancel_c PRIVATE ../../lib)

View File

@ -29,7 +29,7 @@
#include "hdfspp/hdfs_ext.h"
#include "common/util_c.h"
#include "x-platform/c_api.h"
#include "x-platform/c-api/syscall.h"
#define ERROR_BUFFER_SIZE 1024

View File

@ -23,6 +23,6 @@ set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
include_directories( ${LIBHDFSPP_DIR}/include )
link_directories( ${LIBHDFSPP_DIR}/lib )
add_executable(connect_cancel $<TARGET_OBJECTS:x_platform_utils_obj> connect_cancel.cc)
add_executable(connect_cancel $<TARGET_OBJECTS:x_platform_obj> connect_cancel.cc)
target_link_libraries(connect_cancel hdfspp_static)
target_include_directories(connect_cancel PRIVATE ../../lib)

View File

@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
add_library(bindings_c_obj OBJECT $<TARGET_OBJECTS:x_platform_utils_obj> hdfs.cc)
add_dependencies(bindings_c_obj fs rpc reader proto common fs rpc reader proto common x_platform_utils_obj)
add_library(bindings_c_obj OBJECT $<TARGET_OBJECTS:x_platform_obj> hdfs.cc)
add_dependencies(bindings_c_obj fs rpc reader proto common fs rpc reader proto common x_platform_obj)
add_library(bindings_c $<TARGET_OBJECTS:bindings_c_obj> $<TARGET_OBJECTS:x_platform_utils_obj>)
add_library(bindings_c $<TARGET_OBJECTS:bindings_c_obj> $<TARGET_OBJECTS:x_platform_obj>)

View File

@ -22,5 +22,5 @@ else()
set(SYSCALL_SRC syscall_linux.cc)
endif()
add_library(x_platform_utils_obj OBJECT ${SYSCALL_SRC} utils.cc)
add_library(x_platform_utils_obj_c_api OBJECT $<TARGET_OBJECTS:x_platform_utils_obj> c_api.cc)
add_library(x_platform_obj OBJECT ${SYSCALL_SRC} utils.cc)
add_library(x_platform_obj_c_api OBJECT $<TARGET_OBJECTS:x_platform_obj> c-api/syscall.cc)

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
#include "syscall.h"
#include "x-platform/syscall.h"
extern "C" int x_platform_syscall_write_to_stdout(const char* msg) {
return XPlatform::Syscall::WriteToStdout(msg) ? 1 : 0;

View File

@ -16,8 +16,8 @@
* limitations under the License.
*/
#ifndef NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_C_API_H
#define NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_C_API_H
#ifndef NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_C_API_SYSCALL_H
#define NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_C_API_SYSCALL_H
/**
* C APIs for accessing XPlatform
@ -25,4 +25,4 @@
int x_platform_syscall_write_to_stdout(const char* msg);
#endif // NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_C_API_H
#endif // NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_C_API_SYSCALL_H

View File

@ -112,7 +112,7 @@ add_executable(hdfs_builder_test hdfs_builder_test.cc)
target_link_libraries(hdfs_builder_test test_common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
add_memcheck_test(hdfs_builder_test hdfs_builder_test)
add_executable(logging_test logging_test.cc $<TARGET_OBJECTS:x_platform_utils_obj>)
add_executable(logging_test logging_test.cc $<TARGET_OBJECTS:x_platform_obj>)
target_link_libraries(logging_test common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
add_memcheck_test(logging_test logging_test)
@ -144,10 +144,10 @@ include_directories (
${CMAKE_CURRENT_SOURCE_DIR}/../../libhdfs-tests/
)
add_library(hdfspp_test_shim_static STATIC $<TARGET_OBJECTS:x_platform_utils_obj> hdfs_shim.c libhdfs_wrapper.c libhdfspp_wrapper.cc ${LIBHDFSPP_BINDING_C}/hdfs.cc)
add_library(hdfspp_test_shim_static STATIC $<TARGET_OBJECTS:x_platform_obj> hdfs_shim.c libhdfs_wrapper.c libhdfspp_wrapper.cc ${LIBHDFSPP_BINDING_C}/hdfs.cc)
add_dependencies(hdfspp_test_shim_static proto)
add_library(hdfspp_test_static STATIC $<TARGET_OBJECTS:x_platform_utils_obj> ${LIBHDFSPP_BINDING_C}/hdfs.cc)
add_library(hdfspp_test_static STATIC $<TARGET_OBJECTS:x_platform_obj> ${LIBHDFSPP_BINDING_C}/hdfs.cc)
add_dependencies(hdfspp_test_static proto)
# TODO: get all of the mini dfs library bits here in one place

View File

@ -17,9 +17,9 @@
#
if(WIN32)
add_executable(x_platform_utils_test $<TARGET_OBJECTS:x_platform_utils_obj> utils_common_test.cc utils_test_main.cc utils_win_test.cc)
add_executable(x_platform_utils_test $<TARGET_OBJECTS:x_platform_obj> utils_common_test.cc utils_test_main.cc utils_win_test.cc)
else(WIN32)
add_executable(x_platform_utils_test $<TARGET_OBJECTS:x_platform_utils_obj> utils_common_test.cc utils_test_main.cc utils_nix_test.cc)
add_executable(x_platform_utils_test $<TARGET_OBJECTS:x_platform_obj> utils_common_test.cc utils_test_main.cc utils_nix_test.cc)
endif(WIN32)
target_include_directories(x_platform_utils_test PRIVATE ${LIBHDFSPP_LIB_DIR})
target_link_libraries(x_platform_utils_test gmock_main)