Browse Source

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

Gautham B A 4 years ago
parent
commit
61bfa42389

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt

@@ -278,7 +278,7 @@ if(NEED_LINK_DL)
 endif()
 endif()
 
 
 set(LIBHDFSPP_VERSION "0.1.0")
 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)
 if (HADOOP_BUILD)
   hadoop_add_dual_library(hdfspp ${EMPTY_FILE_CC} ${LIBHDFSPP_ALL_OBJECTS})
   hadoop_add_dual_library(hdfspp ${EMPTY_FILE_CC} ${LIBHDFSPP_ALL_OBJECTS})
   hadoop_target_link_dual_libraries(hdfspp
   hadoop_target_link_dual_libraries(hdfspp

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/c/connect_cancel/CMakeLists.txt

@@ -23,6 +23,6 @@ set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
 include_directories( ${LIBHDFSPP_DIR}/include )
 include_directories( ${LIBHDFSPP_DIR}/include )
 link_directories( ${LIBHDFSPP_DIR}/lib )
 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_link_libraries(connect_cancel_c hdfspp_static uriparser2)
 target_include_directories(connect_cancel_c PRIVATE ../../lib)
 target_include_directories(connect_cancel_c PRIVATE ../../lib)

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/c/connect_cancel/connect_cancel.c

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

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/cc/connect_cancel/CMakeLists.txt

@@ -23,6 +23,6 @@ set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
 include_directories( ${LIBHDFSPP_DIR}/include )
 include_directories( ${LIBHDFSPP_DIR}/include )
 link_directories( ${LIBHDFSPP_DIR}/lib )
 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_link_libraries(connect_cancel hdfspp_static)
 target_include_directories(connect_cancel PRIVATE ../../lib)
 target_include_directories(connect_cancel PRIVATE ../../lib)

+ 3 - 3
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/CMakeLists.txt

@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # specific language governing permissions and limitations
 # under the License.
 # 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>)

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/CMakeLists.txt

@@ -22,5 +22,5 @@ else()
   set(SYSCALL_SRC syscall_linux.cc)
   set(SYSCALL_SRC syscall_linux.cc)
 endif()
 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)

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/c_api.cc → hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/c-api/syscall.cc

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

+ 3 - 3
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/c_api.h → hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/c-api/syscall.h

@@ -16,8 +16,8 @@
  * limitations under the License.
  * 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
  * C APIs for accessing XPlatform
@@ -25,4 +25,4 @@
 
 
 int x_platform_syscall_write_to_stdout(const char* msg);
 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

+ 3 - 3
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/CMakeLists.txt

@@ -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})
 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_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})
 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)
 add_memcheck_test(logging_test logging_test)
 
 
@@ -144,10 +144,10 @@ include_directories (
     ${CMAKE_CURRENT_SOURCE_DIR}/../../libhdfs-tests/
     ${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_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)
 add_dependencies(hdfspp_test_static proto)
 
 
 # TODO: get all of the mini dfs library bits here in one place
 # TODO: get all of the mini dfs library bits here in one place

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/x-platform/CMakeLists.txt

@@ -17,9 +17,9 @@
 #
 #
 
 
 if(WIN32)
 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)
 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)
 endif(WIN32)
 target_include_directories(x_platform_utils_test PRIVATE ${LIBHDFSPP_LIB_DIR})
 target_include_directories(x_platform_utils_test PRIVATE ${LIBHDFSPP_LIB_DIR})
 target_link_libraries(x_platform_utils_test gmock_main)
 target_link_libraries(x_platform_utils_test gmock_main)