From 4c0bcefd32b711dbc16022bf0a2abf43da274362 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Thu, 21 Sep 2017 14:40:40 -0400 Subject: [PATCH] HBASE-18901 [C++] Provide CMAKE infrastructure * Provided cmake files for packages in which a default module did not exist. * Moved tests to a location where we could automatically build the test suite. * Resolved minor issues with tests * Tested across OSX, RHEL7, and Ubuntu16 * Fix PROTOBUF_LIBRARY by removing static override in FindZookeeper --- hbase-native-client/.gitignore | 12 + hbase-native-client/CMakeLists.txt | 187 +++++++++++++ hbase-native-client/Makefile | 176 ------------ hbase-native-client/Makefile.protos | 80 ------ hbase-native-client/bin/cpplint.sh | 9 +- hbase-native-client/cmake/BuildTests.cmake | 80 ++++++ hbase-native-client/cmake/FindFolly.cmake | 48 ++++ hbase-native-client/cmake/FindGMock.cmake | 23 ++ hbase-native-client/cmake/FindGflags.cmake | 23 ++ hbase-native-client/cmake/FindGlog.cmake | 23 ++ hbase-native-client/cmake/FindKrb5.cmake | 43 +++ hbase-native-client/cmake/FindSasl2.cmake | 29 ++ hbase-native-client/cmake/FindWangle.cmake | 43 +++ hbase-native-client/cmake/FindZookeeper.cmake | 51 ++++ hbase-native-client/cmake/ProtobufGen.cmake | 62 +++++ hbase-native-client/include/hbase/client/BUCK | 93 ------- hbase-native-client/include/hbase/connection/BUCK | 57 ---- hbase-native-client/include/hbase/exceptions/BUCK | 28 -- hbase-native-client/include/hbase/security/BUCK | 30 -- hbase-native-client/include/hbase/serde/BUCK | 37 --- .../hbase/test-util/mini-cluster.h | 3 +- .../{src => include}/hbase/test-util/test-util.h | 0 hbase-native-client/include/hbase/utils/BUCK | 40 --- hbase-native-client/src/hbase/client/BUCK | 301 --------------------- hbase-native-client/src/hbase/connection/BUCK | 68 ----- .../src/hbase/{client => examples}/load-client.cc | 0 .../hbase/{client => examples}/simple-client.cc | 0 hbase-native-client/src/hbase/exceptions/BUCK | 37 --- hbase-native-client/src/hbase/if/BUCK | 49 ---- hbase-native-client/src/hbase/security/BUCK | 27 -- hbase-native-client/src/hbase/serde/BUCK | 86 ------ hbase-native-client/src/hbase/test-util/BUCK | 53 ---- .../src/hbase/test-util/mini-cluster.cc | 3 +- hbase-native-client/src/hbase/utils/BUCK | 57 ---- hbase-native-client/src/hbase/utils/bytes-util.cc | 1 - .../src/{hbase/client => test}/append-test.cc | 0 .../async-batch-rpc-retrying-test.cc | 0 .../client => test}/async-rpc-retrying-test.cc | 1 - .../src/{hbase/utils => test}/bytes-util-test.cc | 0 .../src/{hbase/client => test}/cell-test.cc | 0 .../serde => test}/client-deserializer-test.cc | 0 .../serde => test}/client-serializer-test.cc | 0 .../src/{hbase/client => test}/client-test.cc | 1 + .../{hbase/utils => test}/concurrent-map-test.cc | 0 .../{hbase/client => test}/configuration-test.cc | 0 .../connection => test}/connection-pool-test.cc | 0 .../src/{hbase/client => test}/delete-test.cc | 0 .../{hbase/exceptions => test}/exception-test.cc | 0 .../src/{hbase/client => test}/filter-test.cc | 0 .../src/{hbase/client => test}/get-test.cc | 0 .../client => test}/hbase-configuration-test.cc | 0 .../src/{hbase/client => test}/increment-test.cc | 0 .../client => test}/location-cache-retry-test.cc | 0 .../{hbase/client => test}/location-cache-test.cc | 0 .../src/{hbase/client => test}/put-test.cc | 0 .../region-info-deserializer-test.cc | 0 .../client => test}/request-converter-test.cc | 0 .../src/{hbase/client => test}/result-test.cc | 0 .../src/{hbase/connection => test}/rpc-test.cc | 0 .../client => test}/scan-result-cache-test.cc | 0 .../src/{hbase/client => test}/scan-test.cc | 0 .../src/{hbase/client => test}/scanner-test.cc | 0 .../src/{hbase/serde => test}/server-name-test.cc | 0 .../src/{hbase/serde => test}/table-name-test.cc | 0 .../src/{hbase/client => test}/time-range-test.cc | 0 .../src/{hbase/utils => test}/user-util-test.cc | 0 .../{hbase/serde => test}/zk-deserializer-test.cc | 0 .../src/{hbase/client => test}/zk-util-test.cc | 0 hbase-native-client/third-party/BUCK | 118 -------- 69 files changed, 633 insertions(+), 1346 deletions(-) create mode 100644 hbase-native-client/CMakeLists.txt delete mode 100644 hbase-native-client/Makefile delete mode 100644 hbase-native-client/Makefile.protos create mode 100644 hbase-native-client/cmake/BuildTests.cmake create mode 100644 hbase-native-client/cmake/FindFolly.cmake create mode 100644 hbase-native-client/cmake/FindGMock.cmake create mode 100644 hbase-native-client/cmake/FindGflags.cmake create mode 100644 hbase-native-client/cmake/FindGlog.cmake create mode 100644 hbase-native-client/cmake/FindKrb5.cmake create mode 100644 hbase-native-client/cmake/FindSasl2.cmake create mode 100644 hbase-native-client/cmake/FindWangle.cmake create mode 100644 hbase-native-client/cmake/FindZookeeper.cmake create mode 100644 hbase-native-client/cmake/ProtobufGen.cmake delete mode 100644 hbase-native-client/include/hbase/client/BUCK delete mode 100644 hbase-native-client/include/hbase/connection/BUCK delete mode 100644 hbase-native-client/include/hbase/exceptions/BUCK delete mode 100644 hbase-native-client/include/hbase/security/BUCK delete mode 100644 hbase-native-client/include/hbase/serde/BUCK rename hbase-native-client/{src => include}/hbase/test-util/mini-cluster.h (98%) rename hbase-native-client/{src => include}/hbase/test-util/test-util.h (100%) delete mode 100644 hbase-native-client/include/hbase/utils/BUCK delete mode 100644 hbase-native-client/src/hbase/client/BUCK delete mode 100644 hbase-native-client/src/hbase/connection/BUCK rename hbase-native-client/src/hbase/{client => examples}/load-client.cc (100%) rename hbase-native-client/src/hbase/{client => examples}/simple-client.cc (100%) delete mode 100644 hbase-native-client/src/hbase/exceptions/BUCK delete mode 100644 hbase-native-client/src/hbase/if/BUCK delete mode 100644 hbase-native-client/src/hbase/security/BUCK delete mode 100644 hbase-native-client/src/hbase/serde/BUCK delete mode 100644 hbase-native-client/src/hbase/test-util/BUCK delete mode 100644 hbase-native-client/src/hbase/utils/BUCK rename hbase-native-client/src/{hbase/client => test}/append-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/async-batch-rpc-retrying-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/async-rpc-retrying-test.cc (99%) rename hbase-native-client/src/{hbase/utils => test}/bytes-util-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/cell-test.cc (100%) rename hbase-native-client/src/{hbase/serde => test}/client-deserializer-test.cc (100%) rename hbase-native-client/src/{hbase/serde => test}/client-serializer-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/client-test.cc (99%) rename hbase-native-client/src/{hbase/utils => test}/concurrent-map-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/configuration-test.cc (100%) rename hbase-native-client/src/{hbase/connection => test}/connection-pool-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/delete-test.cc (100%) rename hbase-native-client/src/{hbase/exceptions => test}/exception-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/filter-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/get-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/hbase-configuration-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/increment-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/location-cache-retry-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/location-cache-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/put-test.cc (100%) rename hbase-native-client/src/{hbase/serde => test}/region-info-deserializer-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/request-converter-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/result-test.cc (100%) rename hbase-native-client/src/{hbase/connection => test}/rpc-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/scan-result-cache-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/scan-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/scanner-test.cc (100%) rename hbase-native-client/src/{hbase/serde => test}/server-name-test.cc (100%) rename hbase-native-client/src/{hbase/serde => test}/table-name-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/time-range-test.cc (100%) rename hbase-native-client/src/{hbase/utils => test}/user-util-test.cc (100%) rename hbase-native-client/src/{hbase/serde => test}/zk-deserializer-test.cc (100%) rename hbase-native-client/src/{hbase/client => test}/zk-util-test.cc (100%) delete mode 100644 hbase-native-client/third-party/BUCK diff --git a/hbase-native-client/.gitignore b/hbase-native-client/.gitignore index e8dd42d455..2fdbfc80ab 100644 --- a/hbase-native-client/.gitignore +++ b/hbase-native-client/.gitignore @@ -27,3 +27,15 @@ third-party/* # Generated files src/hbase/utils/version.h + +# Tests +*-test + +# Executables +load-client +simple-client + +# CMake temporary files +CMakeCache.txt +CMakeFiles +*.cmake diff --git a/hbase-native-client/CMakeLists.txt b/hbase-native-client/CMakeLists.txt new file mode 100644 index 0000000000..5c3c54c245 --- /dev/null +++ b/hbase-native-client/CMakeLists.txt @@ -0,0 +1,187 @@ +# 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. +# +cmake_minimum_required(VERSION 3.0) +PROJECT(hbaseclient CXX) +set(PROJECT_NAME "hbaseclient") +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 1 ) +set(PROJECT_VERSION_PATCH 0) +set(BUILD_SHARED_LIBS ON) +## set our cmake module path +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +## include the Protobuf generation code +include(ProtobufGen) +if(COMPILER_SUPPORTS_CXX14) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.") +endif() +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(HBASE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase") +set(HBASE_PROTO_GEN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase/if") +set(HBASE_PROTO_GEN_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/hbase/if") +# Set the right openssl root path +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl/") +else() + set(OPENSSL_ROOT_DIR "/usr/lib/x86_64-linux-gnu") +endif() +# Include OpenSSL +find_package (OpenSSL REQUIRED) +if (OPENSSL_FOUND) + include_directories(${OPENSSL_INCLUDE_DIR}) +else () + message( FATAL_ERROR "OpenSSL was not found. Please install OpenSSL" ) +endif (OPENSSL_FOUND) +# ensure we have required dependencies +find_package(Threads) +find_package(Boost REQUIRED COMPONENTS thread system filesystem) +find_package(Gflags REQUIRED) +find_package(Folly REQUIRED) +find_package(Krb5 REQUIRED) +find_package(Sasl2 REQUIRED) +find_package(Wangle REQUIRED) +find_package(GTest) +find_package(Glog) +find_package(Java REQUIRED) +find_package(JNI REQUIRED) +find_package(Zookeeper REQUIRED) +find_package(Protobuf REQUIRED) +if (NOT FOLLY_FOUND) + message(FATAL_ERROR "-- Folly not found") +endif() +if (NOT WANGLE_FOUND) + message(FATAL_ERROR "-- Wangle not found") +endif() +if (NOT PROTOBUF_FOUND) + message(FATAL_ERROR "-- Protocol buffer include directory not found ${PROTOBUF_INCLUDE_DIRS}") +endif() +if (NOT JNI_FOUND) + message(FATAL_ERROR "-- JAVA include directory not found") +endif() +### provide the include directories, starting at the base +### and including those from our +include_directories(include) +include_directories(${PROTOBUF_INCLUDE_DIRS}) +include_directories(${Zookeeper_INCLUDE_DIRS}) +include_directories(${Boost_INCLUDE_DIR}) +include_directories(${KRB5_INCLUDE_DIRS}) +include_directories(${JAVA_INCLUDE_DIRS}) +include_directories(${FOLLY_INCLUDE_DIRS}) +### create a directory for the hbase protobuf headers. +### this is helpful so that when we include it, later, we can generate +### the protocol buffer source/headers without polluting our tree. +set(CMAKE_BINARY_DIR_GEN "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/hbase/if/") +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR_GEN}) +## build a recursive list of sources +file(GLOB_RECURSE CONNECTION_SRC "${HBASE_SRC_DIR}/connection/*.cc" ) +file(GLOB_RECURSE EXCEPTION_SRC "${HBASE_SRC_DIR}/exceptions/*.cc" ) +file(GLOB_RECURSE PROTO_SRC "${HBASE_SRC_DIR}/if/*.cc" ) +file(GLOB_RECURSE UTILS_SRC "${HBASE_SRC_DIR}/utils/*.cc" ) +file(GLOB_RECURSE CLIENT_SRC "${HBASE_SRC_DIR}/client/*.cc" ) +file(GLOB_RECURSE SECURITY_SRC "${HBASE_SRC_DIR}/security/*.cc" ) +file(GLOB_RECURSE SRDE_SRC "${HBASE_SRC_DIR}/serde/*.cc" ) +file(GLOB_RECURSE TEST_UTIL "${HBASE_SRC_DIR}/test-util/*.cc" ) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}) +include_directories(${SASL_INCLUDE_DIRS}) +include_directories(${GFLAGS_INCLUDE_DIR}) +file(GLOB_RECURSE PROTO_FILES "${HBASE_SRC_DIR}/if/*.proto" ) +### generate the protocol buffers. +generate_protobuf_src(PROTO_SOURCES PROTO_HEADERS ${PROTO_FILES}) + +add_library(hbaseclient-static STATIC ${PROTO_SOURCES} ${CLIENT_SRC} ${CONNECTION_SRC} ${EXCEPTION_SRC} ${PROTO_SRC} ${SECURITY_SRC} ${SRDE_SRC} ${UTILS_SRC}) +set_target_properties(hbaseclient-static PROPERTIES LINKER_LANGUAGE CXX) +SET_TARGET_PROPERTIES(hbaseclient-static PROPERTIES OUTPUT_NAME hbaseclient CLEAN_DIRECT_OUTPUT 1) +target_link_libraries(hbaseclient-static ${PROTOBUF_LIBRARY}) +target_link_libraries(hbaseclient-static ${FOLLY_LIBRARIES}) +target_link_libraries(hbaseclient-static ${Boost_LIBRARIES}) +target_link_libraries(hbaseclient-static ${SASL_LIBS}) +target_link_libraries(hbaseclient-static ${GLOG_SHARED_LIB}) +target_link_libraries(hbaseclient-static ${GFLAGS_SHARED_LIB}) +target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES}) +target_link_libraries(hbaseclient-static ${WANGLE_LIBRARIES}) +target_link_libraries(hbaseclient-static ${Zookeeper_LIBRARIES}) +target_link_libraries(hbaseclient-static ${OPENSSL_LIBRARIES}) +add_library(hbaseclient-shared SHARED ${PROTO_SOURCES} ${CLIENT_SRC} ${CONNECTION_SRC} ${EXCEPTION_SRC} ${PROTO_SRC} ${SECURITY_SRC} ${SRDE_SRC} ${UTILS_SRC}) +set_target_properties(hbaseclient-shared PROPERTIES LINKER_LANGUAGE CXX) +SET_TARGET_PROPERTIES(hbaseclient-shared PROPERTIES COMPILE_FLAGS " -fPIC") +SET_TARGET_PROPERTIES(hbaseclient-shared PROPERTIES OUTPUT_NAME hbaseclient CLEAN_DIRECT_OUTPUT 1) +target_link_libraries(hbaseclient-shared ${PROTOBUF_LIBRARY}) +target_link_libraries(hbaseclient-shared ${FOLLY_LIBRARIES}) +target_link_libraries(hbaseclient-shared ${Boost_LIBRARIES}) +target_link_libraries(hbaseclient-shared ${SASL_LIBS}) +target_link_libraries(hbaseclient-shared ${GLOG_SHARED_LIB}) +target_link_libraries(hbaseclient-shared ${GFLAGS_SHARED_LIB}) +target_link_libraries(hbaseclient-shared ${KRB5_LIBRARIES}) +target_link_libraries(hbaseclient-shared ${WANGLE_LIBRARIES}) +target_link_libraries(hbaseclient-shared ${Zookeeper_LIBRARIES}) +add_executable(simple-client "${HBASE_SRC_DIR}/examples/simple-client.cc") +SET_TARGET_PROPERTIES(simple-client PROPERTIES COMPILE_FLAGS " ") +target_link_libraries(simple-client ${PROTOBUF_LIBRARY}) +target_link_libraries(simple-client ${Boost_LIBRARIES}) +target_link_libraries(simple-client ${SASL_LIBS}) +target_link_libraries(simple-client ${GFLAGS_SHARED_LIB}) +target_link_libraries(simple-client ${KRB5_LIBRARIES}) +target_link_libraries(simple-client ${Zookeeper_LIBRARIES}) +target_link_libraries(simple-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT}) +add_executable(load-client "${HBASE_SRC_DIR}/examples/load-client.cc") +SET_TARGET_PROPERTIES(load-client PROPERTIES COMPILE_FLAGS " ") +target_link_libraries(load-client ${PROTOBUF_LIBRARY}) +target_link_libraries(load-client ${Boost_LIBRARIES}) +target_link_libraries(load-client ${SASL_LIBS}) +target_link_libraries(load-client ${GFLAGS_SHARED_LIB}) +target_link_libraries(load-client ${KRB5_LIBRARIES}) +target_link_libraries(load-client ${Zookeeper_LIBRARIES}) +target_link_libraries(load-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT}) +if (JNI_FOUND) + message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") + message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}") +endif() +if (NOT SKIP_TESTS) + include(BuildTests) +endif() +## Create a custom target for our linter +add_custom_target( + linter + COMMAND ${CMAKE_SOURCE_DIR}/bin/cpplint.sh) + +# Install library headers +include(GNUInstallDirs) +file(GLOB RECURSE HEADERS include/*.h) +set_target_properties(hbaseclient-static PROPERTIES PUBLIC_HEADER "${HEADERS}") +install(TARGETS hbaseclient-static + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION include/ + COMPONENT LIBRARY ) +install(TARGETS hbaseclient-shared + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION include/ + COMPONENT LIBRARY ) +INSTALL ( + DIRECTORY ${CMAKE_SOURCE_DIR}/include/ + DESTINATION include/ + FILES_MATCHING PATTERN "*.h*") +# Install pb-generated headers too +INSTALL ( + DIRECTORY "${CMAKE_BINARY_DIR_GEN}" + DESTINATION include/hbase/if + FILES_MATCHING PATTERN "hbase/if/*.h") diff --git a/hbase-native-client/Makefile b/hbase-native-client/Makefile deleted file mode 100644 index cd818ca2ed..0000000000 --- a/hbase-native-client/Makefile +++ /dev/null @@ -1,176 +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. - -#use "g++" to compile source files -CC := g++ -LD := g++ - -SRC_HBASE := src/hbase -INCLUDE_HBASE := include/ -BUILD_PATH := build -DEBUG_PATH := $(BUILD_PATH)/debug -RELEASE_PATH := $(BUILD_PATH)/release -PROTO_SRC_DIR := $(SRC_HBASE)/if -PROTO_CXX_DIR := $(BUILD_PATH)/$(PROTO_SRC_DIR) -MODULES := connection client exceptions security serde utils -TEST_MODULES := test-util # These modules contain test code, not included in the build for the lib -SRC_DIR := $(addprefix $(SRC_HBASE)/,$(MODULES)) -DEBUG_BUILD_DIR := $(addprefix $(DEBUG_PATH)/hbase/,$(MODULES)) -RELEASE_BUILD_DIR := $(addprefix $(RELEASE_PATH)/hbase/,$(MODULES)) - -INCLUDE_DIR := . src $(BUILD_PATH)/src $(INCLUDE_HBASE) -TEST_BUILD_INCLUDE_DIR := $(INLCUDE_DIR) $(JAVA_HOME)/include/ $(JAVA_HOME)/include/linux - -#flags to pass to the CPP compiler & linker -CPPFLAGS_DEBUG := -D_GLIBCXX_USE_CXX11_ABI=0 -g -Wall -std=c++14 -pedantic -fPIC -MMD -MP -CPPFLAGS_RELEASE := -D_GLIBCXX_USE_CXX11_ABI=0 -DNDEBUG -O2 -Wall -std=c++14 -pedantic -fPIC -MMD -MP -LDFLAGS := -lprotobuf -lzookeeper_mt -lsasl2 -lfolly -lwangle -TEST_BUILD_LDFLAGS := $(LDFLAGS) -L $(JAVA_HOME)/jre/lib/amd64/server -ljvm -LINKFLAG := -shared - -#define list of source files and object files -ALLSRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cc)) -EXCLUDE_SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*-test.cc)) \ - $(SRC_HBASE)/client/simple-client.cc $(SRC_HBASE)/client/load-client.cc -SRC := $(filter-out $(EXCLUDE_SRC), $(ALLSRC)) -PROTOSRC := $(patsubst $(PROTO_SRC_DIR)/%.proto, $(addprefix $(PROTO_CXX_DIR)/,%.pb.cc),$(wildcard $(PROTO_SRC_DIR)/*.proto)) -PROTOHDR := $(patsubst $(PROTO_SRC_DIR)/%.proto, $(addprefix $(PROTO_CXX_DIR)/,%.pb.h),$(wildcard $(PROTO_SRC_DIR)/*.proto)) -DEBUG_OBJ := $(patsubst $(SRC_HBASE)/%.cc,$(DEBUG_PATH)/hbase/%.o,$(SRC)) -DEBUG_OBJ += $(patsubst $(PROTO_CXX_DIR)/%.cc,$(DEBUG_PATH)/hbase/if/%.o,$(PROTOSRC)) -RELEASE_OBJ := $(patsubst $(SRC_HBASE)/%.cc,$(RELEASE_PATH)/hbase/%.o,$(SRC)) -RELEASE_OBJ += $(patsubst $(PROTO_CXX_DIR)/%.cc,$(RELEASE_PATH)/hbase/if/%.o,$(PROTOSRC)) -INCLUDES := $(addprefix -I,$(INCLUDE_DIR)) - -LIB_DIR := /usr/local -LIB_LIBDIR := $(LIB_DIR)/lib -LIB_INCDIR := $(LIB_DIR)/include -LIB_RELEASE := $(RELEASE_PATH)/libHBaseClient.so -ARC_RELEASE := $(RELEASE_PATH)/libHBaseClient.a -LIB_DEBUG := $(DEBUG_PATH)/libHBaseClient_d.so -ARC_DEBUG := $(DEBUG_PATH)/libHBaseClient_d.a -LOCAL_INCLUDE_DIR := /usr/local/include/ - -build: checkdirs protos copyfiles $(LIB_DEBUG) $(LIB_RELEASE) $(ARC_DEBUG) $(ARC_RELEASE) - -vpath %.cc $(SRC_DIR) - -$(LIB_DEBUG): -define make-goal-dbg -DEPS := $(DEBUG_OBJ:.o=.d) --include $(DEPS) -$1/%.o: %.cc - $(CC) -c $$< -o $$@ -MF$$(@:%.o=%.d) -MT$$@ $(CPPFLAGS_DEBUG) $(INCLUDES) -endef - -$(LIB_RELEASE): -define make-goal-rel -DEPS := $(RELEASE_OBJ:.o=.d) --include $(DEPS) -$1/%.o: %.cc - $(CC) -c $$< -o $$@ -MF$$(@:%.o=%.d) -MT$$@ $(CPPFLAGS_RELEASE) $(INCLUDES) -endef - -.PHONY: all clean install copyfiles - -checkdirs: $(DEBUG_BUILD_DIR) $(RELEASE_BUILD_DIR) $(PROTO_CXX_DIR) - -copyfiles: - @bin/copy-protobuf.sh - @bin/copy-version.sh - -# .proto files are in src/hbase/if. These are compiled into C++ code by the -# protoc compiler, and turned into .cc and .h files under build/src/hbase/if -$(PROTO_CXX_DIR)/%.pb.cc $(PROTO_CXX_DIR)/%.pb.h: $(PROTO_SRC_DIR)/%.proto - @protoc --proto_path=$(PROTO_SRC_DIR) --cpp_out=$(PROTO_CXX_DIR) $< - -# protos target compiles the .cc and .h files into .o files for the protobuf -# generated source files -protos: $(PROTO_CXX_DIR) $(PROTOSRC) $(PROTOHDR) - @make -j8 all -f Makefile.protos - -install_headers: - cp -r $(INCLUDE_HBASE)/hbase $(LOCAL_INCLUDE_DIR) - mkdir -p $(LOCAL_INCLUDE_DIR)/hbase/if - cp -r $(PROTO_CXX_DIR)/*.h $(LOCAL_INCLUDE_DIR)/hbase/if - -uninstall_headers: - rm -rf $(LOCAL_INCLUDE_DIR)/hbase - -install: install_headers - cp $(LIB_RELEASE) $(LIB_LIBDIR)/libHBaseClient.so - cp $(ARC_RELEASE) $(LIB_LIBDIR)/libHBaseClient.a - cp $(LIB_DEBUG) $(LIB_LIBDIR)/libHBaseClient_d.so - cp $(ARC_DEBUG) $(LIB_LIBDIR)/libHBaseClient_d.a - ldconfig - -uninstall: uninstall_headers - rm -f $(LIB_LIBDIR)/libHBaseClient.so $(LIB_LIBDIR)/libHBaseClient.a $(LIB_LIBDIR)/libHBaseClient_d.so $(LIB_LIBDIR)/libHBaseClient_d.a - ldconfig - -$(PROTO_CXX_DIR): - @mkdir -p $@ - -$(DEBUG_BUILD_DIR): - @mkdir -p $@ - -$(RELEASE_BUILD_DIR): - @mkdir -p $@ - -$(ARC_DEBUG): $(DEBUG_OBJ) - ar rcs $@ $^ - -$(ARC_RELEASE): $(RELEASE_OBJ) - ar rcs $@ $^ - -$(LIB_RELEASE): $(RELEASE_OBJ) - $(LD) $(LINKFLAG) -o $@ $(LDFLAGS) $(RELEASE_OBJ) - -$(LIB_DEBUG): $(DEBUG_OBJ) - $(LD) $(LINKFLAG) -o $@ $(LDFLAGS) $(DEBUG_OBJ) - -clean: - @rm -rf docs buck-out $(BUILD_PATH) - -$(foreach bdir,$(DEBUG_BUILD_DIR), $(eval $(call make-goal-dbg,$(bdir)))) - -$(foreach bdir,$(RELEASE_BUILD_DIR),$(eval $(call make-goal-rel,$(bdir)))) - -check: - $(shell buck test --all --no-results-cache) - -lint: - bin/cpplint.sh - -doc: - $(shell doxygen hbase.doxygen > /dev/null) - -help: - @echo "Available targets:" - @echo "" - @echo " all : builds everything, creates doc and runs tests." - @echo " build : will build/rebuild everything." - @echo " check : will test everything." - @echo " clean : removes docs folder, object files and local libraries from build/ directory." - @echo " copyfiles : copies native version.h from mvn build and proto locally to hbase-native-client." - @echo " doc : generates documentation." - @echo " install : will copy the libs to $(LIB_LIBDIR). super user priviliege would be required." - @echo " protos : will create PB CPP sec and headers from if/*.proto and build them." - @echo " uninstall : removes the libs from $(LIB_LIBDIR)." - @echo " lint : will ensure that code conforms to Google coding style." - @echo "If no target is specified 'build' will be executed" - -all: copyfiles build doc check diff --git a/hbase-native-client/Makefile.protos b/hbase-native-client/Makefile.protos deleted file mode 100644 index 8712029d93..0000000000 --- a/hbase-native-client/Makefile.protos +++ /dev/null @@ -1,80 +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. - -#use "g++" to compile source files -CC := g++ - -BUILD_PATH := build -DEBUG_PATH := $(BUILD_PATH)/debug -RELEASE_PATH := $(BUILD_PATH)/release -MODULES := if -SRC_DIR := $(BUILD_PATH)/src/hbase/$(MODULES) -DEBUG_BUILD_DIR := $(addprefix $(DEBUG_PATH)/hbase/,$(MODULES)) -RELEASE_BUILD_DIR := $(addprefix $(RELEASE_PATH)/hbase/,$(MODULES)) -INCLUDE_DIR := . $(BUILD_PATH)/src/hbase/if - -#flags to pass to the CPP compiler & linker -CPPFLAGS_DEBUG := -D_GLIBCXX_USE_CXX11_ABI=0 -g -Wall -std=c++14 -pedantic -fPIC -MMD -MP -CPPFLAGS_RELEASE := -D_GLIBCXX_USE_CXX11_ABI=0 -DNDEBUG -O2 -Wall -std=c++14 -pedantic -fPIC -MMD -MP - -#define list of source files and object files -SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cc)) -DEBUG_OBJ := $(patsubst $(SRC_DIR)/%.cc,$(DEBUG_PATH)/hbase/if/%.o,$(SRC)) -RELEASE_OBJ := $(patsubst $(SRC_DIR)/%.cc,$(RELEASE_PATH)/hbase/if/%.o,$(SRC)) -INCLUDES := $(addprefix -I,$(INCLUDE_DIR)) - -all: $(DEBUG_BUILD_DIR) $(RELEASE_BUILD_DIR) $(DEBUG_OBJ) $(RELEASE_OBJ) - -vpath %.cc $(SRC_DIR) - -$(DEBUG_OBJ): -define make-goal-dbg -DEPS := $(DEBUG_OBJ:.o=.d) --include $(DEPS) -$1/%.o: %.cc - $(CC) -c $$< -o $$@ -MF$$(@:%.o=%.d) -MT$$@ $(CPPFLAGS_DEBUG) $(INCLUDES) -endef - -$(RELEASE_OBJ): -define make-goal-rel -DEPS := $(RELEASE_OBJ:.o=.d) --include $(DEPS) -$1/%.o: %.cc - $(CC) -c $$< -o $$@ -MF$$(@:%.o=%.d) -MT$$@ $(CPPFLAGS_RELEASE) $(INCLUDES) -endef - -.PHONY: all clean - -$(DEBUG_BUILD_DIR): - @mkdir -p $@ - -$(RELEASE_BUILD_DIR): - @mkdir -p $@ - -clean: - @rm -rf $(DEBUG_BUILD_DIR) $(RELEASE_BUILD_DIR) - -$(foreach bdir,$(DEBUG_BUILD_DIR),$(eval $(call make-goal-dbg,$(bdir)))) - -$(foreach bdir,$(RELEASE_BUILD_DIR),$(eval $(call make-goal-rel,$(bdir)))) - -help: - @echo "This Makefile invocation will only work when protobuf sources and headers have been generated by running 'make protos'" - @echo "Available targets:" - @echo "" - @echo " all : creates objects for the generated PB src." - @echo " clean : removes PB objects." diff --git a/hbase-native-client/bin/cpplint.sh b/hbase-native-client/bin/cpplint.sh index 7a27945d7a..497ab24f07 100755 --- a/hbase-native-client/bin/cpplint.sh +++ b/hbase-native-client/bin/cpplint.sh @@ -16,9 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. IFS=$'\n\t' - +OUTPUT_DIR=$1 +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" CPPLINT_LOC=https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py -OUTPUT=build/cpplint.py +OUTPUT=$OUTPUT_DIR/cpplint.py declare -a MODULES=( client connection exceptions security serde utils test-util ) @@ -31,9 +32,9 @@ wget -nc $CPPLINT_LOC -O $OUTPUT # build/c++11 (We are building with c++14) for m in ${MODULES[@]}; do if [ $m != "security" ]; then #These are empty - exec find src/hbase/$m -name "*.h" -or -name "*.cc" | xargs -P8 python $OUTPUT --filter=-build/header_guard,-readability/todo,-build/c++11 --linelength=100 + exec find ${SCRIPT_DIR}/../src/hbase/$m -name "*.h" -or -name "*.cc" | xargs -P8 python $OUTPUT --filter=-build/header_guard,-readability/todo,-build/c++11 --linelength=100 fi if [ $m != "test-util" ]; then - exec find include/hbase/$m -name "*.h" -or -name "*.cc" | xargs -P8 python $OUTPUT --filter=-build/header_guard,-readability/todo,-build/c++11 --linelength=100 + exec find ${SCRIPT_DIR}/../include/hbase/$m -name "*.h" -or -name "*.cc" | xargs -P8 python $OUTPUT --filter=-build/header_guard,-readability/todo,-build/c++11 --linelength=100 fi done diff --git a/hbase-native-client/cmake/BuildTests.cmake b/hbase-native-client/cmake/BuildTests.cmake new file mode 100644 index 0000000000..7ab210259e --- /dev/null +++ b/hbase-native-client/cmake/BuildTests.cmake @@ -0,0 +1,80 @@ +# 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. +### test functions +MACRO(GETSOURCEFILES result curdir) + FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) + SET(dirlist "") + FOREACH(child ${children}) + IF( "${child}" MATCHES ^[^.].*\\.cc) + + LIST(APPEND dirlist ${child}) + ENDIF() + ENDFOREACH() + SET(${result} ${dirlist}) +ENDMACRO() +find_package(GMock REQUIRED) +add_library(testutil STATIC ${TEST_UTIL}) +target_include_directories(testutil PRIVATE BEFORE "include") +target_include_directories(testutil PRIVATE BEFORE "${Java_INCLUDE_DIRS}") +target_include_directories(testutil PRIVATE BEFORE "${JNI_INCLUDE_DIRS}") +target_include_directories(testutil PRIVATE BEFORE "${Boost_INCLUDE_DIR}") +target_include_directories(testutil PRIVATE BEFORE "${GTEST_INCLUDE_DIRS}") +target_include_directories(testutil PRIVATE BEFORE${PROTOBUF_INCLUDE_DIRS}) +target_include_directories(testutil PRIVATE BEFORE${Zookeeper_INCLUDE_DIRS}) +target_include_directories(testutil PRIVATE BEFORE${KRB5_INCLUDE_DIRS}) +target_include_directories(testutil PRIVATE BEFORE${Java_INCLUDE_DIRS}) +target_include_directories(testutil PRIVATE BEFORE${FOLLY_INCLUDE_DIRS}) +target_link_libraries(testutil hbaseclient-static ${CMAKE_THREAD_LIBS_INIT} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GMOCK_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} ${KRB5_LIBRARIES} ${OPENSSL_LIBRARIES} ${Zookeeper_LIBRARIES}) +function(createTests testName) + message ("-- Including Test: ${testName}") + target_include_directories(${testName} PRIVATE BEFORE "include") + target_include_directories(${testName} PRIVATE BEFORE "${Java_INCLUDE_DIRS}") + target_include_directories(${testName} PRIVATE BEFORE "${JNI_INCLUDE_DIRS}") + target_include_directories(${testName} PRIVATE BEFORE "${Boost_INCLUDE_DIR}") + target_include_directories(${testName} PRIVATE BEFORE "${GTEST_INCLUDE_DIRS}") + target_include_directories(${testName} PRIVATE BEFORE "${OPENSSL_INCLUDE_DIR}") + + target_link_libraries(hbaseclient-static ${PROTOBUF_LIBRARY}) + target_link_libraries(hbaseclient-static ${FOLLY_LIBRARIES}) + + target_link_libraries(${testName} hbaseclient-static testutil ${CMAKE_THREAD_LIBS_INIT} + ${Java_LIBRARIES} + ${JNI_LIBRARIES} + ${PROTOBUF_LIBRARY} + ${Boost_LIBRARIES} + ${GFLAGS_SHARED_LIB} + ${GTEST_BOTH_LIBRARIES} + ${SASL_LIBS} + ${GFLAGS_SHARED_LIB} + ${KRB5_LIBRARIES} + ${Zookeeper_LIBRARIES} ${OPENSSL_LIBRARIES} + ${WANGLE_LIBRARIES} + ${FOLLY_LIBRARIES} + ${GLOG_SHARED_LIB}) +endfunction() +enable_testing(test) +SET(TEST_DIR ${CMAKE_SOURCE_DIR}/src/test) +GETSOURCEFILES(UNIT_TESTS "${TEST_DIR}") +SET(UNIT_TEST_COUNT 0) +FOREACH(testfile ${UNIT_TESTS}) + get_filename_component(testfilename "${testfile}" NAME_WE) + add_executable("${testfilename}" "${TEST_DIR}/${testfile}") + createTests("${testfilename}") + MATH(EXPR UNIT_TEST_COUNT "${UNIT_TEST_COUNT}+1") + add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR}) +ENDFOREACH() +message("-- Finished building ${UNIT_TEST_COUNT} unit test file(s)...") diff --git a/hbase-native-client/cmake/FindFolly.cmake b/hbase-native-client/cmake/FindFolly.cmake new file mode 100644 index 0000000000..e7854a00c1 --- /dev/null +++ b/hbase-native-client/cmake/FindFolly.cmake @@ -0,0 +1,48 @@ +# 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. +# +find_path(FOLLY_ROOT_DIR + NAMES include/folly/AtomicHashMap.h +) +find_library(FOLLY_LIBRARIES + NAMES folly + HINTS ${FOLLY_ROOT_DIR}/lib /usr/lib/ /usr/local/lib/ /usr/lib/x86_64-linux-gnu/ +) +find_library(FOLLY_BENCHMARK_LIBRARIES + NAMES follybenchmark + HINTS ${FOLLY_ROOT_DIR}/lib +) +find_path(FOLLY_INCLUDE_DIR + NAMES folly/AtomicHashMap.h + HINTS ${FOLLY_ROOT_DIR}/include +) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Folly DEFAULT_MSG + FOLLY_LIBRARIES + FOLLY_INCLUDE_DIR +) +mark_as_advanced( + FOLLY_ROOT_DIR + FOLLY_LIBRARIES + FOLLY_BENCHMARK_LIBRARIES + FOLLY_INCLUDE_DIR +) +if (FOLLY_LIBRARIES) + set(FOLLY_FOUND "true") + message("-- Folly found, ${FOLLY_LIBRARIES}") +endif(FOLLY_LIBRARIES) diff --git a/hbase-native-client/cmake/FindGMock.cmake b/hbase-native-client/cmake/FindGMock.cmake new file mode 100644 index 0000000000..998fa6d2e3 --- /dev/null +++ b/hbase-native-client/cmake/FindGMock.cmake @@ -0,0 +1,23 @@ +# 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. +find_path(GMOCK_INCLUDE_DIR gmock/gmock.h) + # make sure we don't accidentally pick up a different version +find_library(GMOCK_SHARED_LIB gmock) +find_library(GMOCK_STATIC_LIB libgmock.a) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GMOCK REQUIRED_VARS + GMOCK_SHARED_LIB GMOCK_STATIC_LIB GMOCK_INCLUDE_DIR) diff --git a/hbase-native-client/cmake/FindGflags.cmake b/hbase-native-client/cmake/FindGflags.cmake new file mode 100644 index 0000000000..59c65df600 --- /dev/null +++ b/hbase-native-client/cmake/FindGflags.cmake @@ -0,0 +1,23 @@ +# 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. +find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h) + # make sure we don't accidentally pick up a different version +find_library(GFLAGS_SHARED_LIB gflags) +find_library(GFLAGS_STATIC_LIB libgflags.a) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GFLAGS REQUIRED_VARS + GFLAGS_SHARED_LIB GFLAGS_STATIC_LIB GFLAGS_INCLUDE_DIR) diff --git a/hbase-native-client/cmake/FindGlog.cmake b/hbase-native-client/cmake/FindGlog.cmake new file mode 100644 index 0000000000..a2c541db70 --- /dev/null +++ b/hbase-native-client/cmake/FindGlog.cmake @@ -0,0 +1,23 @@ +# 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. +find_path(GLOG_INCLUDE_DIR glog/logging.h) + # make sure we don't accidentally pick up a different version +find_library(GLOG_SHARED_LIB glog) +find_library(GLOG_STATIC_LIB libglog.a) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLOG REQUIRED_VARS + GLOG_SHARED_LIB GLOG_STATIC_LIB GLOG_INCLUDE_DIR) diff --git a/hbase-native-client/cmake/FindKrb5.cmake b/hbase-native-client/cmake/FindKrb5.cmake new file mode 100644 index 0000000000..e4c6fb8357 --- /dev/null +++ b/hbase-native-client/cmake/FindKrb5.cmake @@ -0,0 +1,43 @@ +# 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. +# +find_path(KRB5_ROOT_DIR + NAMES include/krb5/krb5.h +) +find_library(KRB5_LIBRARIES + NAMES krb5 + HINTS ${KRB5_ROOT_DIR}/lib +) +find_path(KRB5_INCLUDE_DIR + NAMES krb5/krb5.h + HINTS ${KRB5_ROOT_DIR}/include +) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(krb5 DEFAULT_MSG + KRB5_LIBRARIES + KRB5_INCLUDE_DIR +) +if (KRB5_LIBRARIES) + set(KRB5_FOUND "true") + message("-- KRB5 Libs Found, ${KRB5_LIBRARIES}") +endif() +mark_as_advanced( + KRB5_ROOT_DIR + KRB5_LIBRARIES + KRB5_INCLUDE_DIR +) diff --git a/hbase-native-client/cmake/FindSasl2.cmake b/hbase-native-client/cmake/FindSasl2.cmake new file mode 100644 index 0000000000..871385bb3a --- /dev/null +++ b/hbase-native-client/cmake/FindSasl2.cmake @@ -0,0 +1,29 @@ +# 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(CheckSymbolExists) +find_path ( + SASL_INCLUDE_DIRS NAMES sasl/sasl.h + PATHS /include /usr/include /usr/local/include /usr/share/include) +find_library( + SASL_LIBS NAMES sasl2 + PATHS /usr/lib /lib /usr/local/lib /usr/lib/x86_64-linux-gnu/) +if (SASL_INCLUDE_DIRS AND SASL_LIBS) + set (SASL_FOUND 1) + message("-- LibSASL found, ${SASL_LIBS}") +endif () diff --git a/hbase-native-client/cmake/FindWangle.cmake b/hbase-native-client/cmake/FindWangle.cmake new file mode 100644 index 0000000000..6e69faa36f --- /dev/null +++ b/hbase-native-client/cmake/FindWangle.cmake @@ -0,0 +1,43 @@ +# 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. +# +find_path(WANGLE_ROOT_DIR + NAMES include/wangle/acceptor/Acceptor.h +) +find_library(WANGLE_LIBRARIES + NAMES wangle + HINTS ${WANGLE_ROOT_DIR}/lib /usr/lib/ /usr/local/lib/ +) +find_path(WANGLE_INCLUDE_DIR + NAMES wangle/acceptor/Acceptor.h + HINTS ${WANGLE_ROOT_DIR}/include /usr/local/include/ +) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WANGLE DEFAULT_MSG + WANGLE_LIBRARIES + WANGLE_INCLUDE_DIR +) +mark_as_advanced( + WANGLE_ROOT_DIR + WANGLE_LIBRARIES + WANGLE_INCLUDE_DIR +) +if (WANGLE_LIBRARIES) + set(WANGLE_FOUND "true") + message("-- Wangle found, ${WANGLE_LIBRARIES}") +endif(WANGLE_LIBRARIES) diff --git a/hbase-native-client/cmake/FindZookeeper.cmake b/hbase-native-client/cmake/FindZookeeper.cmake new file mode 100644 index 0000000000..a9e9d3d1c8 --- /dev/null +++ b/hbase-native-client/cmake/FindZookeeper.cmake @@ -0,0 +1,51 @@ +# 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 (MSVC) + if(${CMAKE_BUILD_TYPE} MATCHES "Debug") + set(ZK_BuildOutputDir "Debug") + else() + set(ZK_BuildOutputDir "Release") + endif() + if("${ZOOKEEPER_HOME}_" MATCHES "^_$") + message(" ") + message("- Please set the cache variable ZOOKEEPER_HOME to point to the directory with the zookeeper source.") + message("- CMAKE will look for zookeeper include files in $ZOOKEEPER_HOME/src/c/include.") + message("- CMAKE will look for zookeeper library files in $ZOOKEEPER_HOME/src/c/Debug or $ZOOKEEPER_HOME/src/c/Release.") + else() + FILE(TO_CMAKE_PATH ${ZOOKEEPER_HOME} Zookeeper_HomePath) + set(Zookeeper_LIB_PATHS ${Zookeeper_HomePath}/src/c/${ZK_BuildOutputDir}) + find_path(ZK_INCLUDE_DIR zookeeper.h ${Zookeeper_HomePath}/src/c/include) + find_path(ZK_INCLUDE_DIR_GEN zookeeper.jute.h ${Zookeeper_HomePath}/src/c/generated) + set(Zookeeper_INCLUDE_DIR zookeeper.h ${ZK_INCLUDE_DIR} ${ZK_INCLUDE_DIR_GEN} ) + find_library(Zookeeper_LIBRARY NAMES zookeeper PATHS ${Zookeeper_LIB_PATHS}) + endif() +else() + set(Zookeeper_LIB_PATHS /usr/local/lib /usr/lib/ /usr/lib/x86_64-linux-gnu/) + find_path(Zookeeper_INCLUDE_DIR zookeeper/zookeeper.h /usr/local/include) + find_library(Zookeeper_LIBRARY NAMES libzookeeper_mt.a PATHS ${Zookeeper_LIB_PATHS}) +endif() +set(Zookeeper_LIBRARIES ${Zookeeper_LIBRARY} ) +set(Zookeeper_INCLUDE_DIRS ${Zookeeper_INCLUDE_DIR} ) +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set Zookeeper_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(Zookeeper DEFAULT_MSG + Zookeeper_LIBRARY Zookeeper_INCLUDE_DIR) +if (Zookeeper_LIBRARY) + message("-- Zookeeper found, ${Zookeeper_LIBRARY}") +endif() +mark_as_advanced(Zookeeper_INCLUDE_DIR Zookeeper_LIBRARY ) diff --git a/hbase-native-client/cmake/ProtobufGen.cmake b/hbase-native-client/cmake/ProtobufGen.cmake new file mode 100644 index 0000000000..0cc2c2f6a9 --- /dev/null +++ b/hbase-native-client/cmake/ProtobufGen.cmake @@ -0,0 +1,62 @@ +# 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. +# copied in most part from protobuf cmake +# there are similar protobuf gen changes online, all of which do +# a similar job of customizing their generation. +function(generate_protobuf_src SRCS HDRS) + if(NOT ARGN) + message(SEND_ERROR "Error: generate_protobuf_src() called without any proto files") + return() + endif() + + set(_protobuf_include_path -I .) + if(DEFINED PROTOBUF_INCLUDE_DIRS) + foreach(DIR ${PROTOBUF_INCLUDE_DIRS}) + file(RELATIVE_PATH REL_PATH ${CMAKE_SOURCE_DIR} ${DIR}) + list(FIND _protobuf_include_path ${REL_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${REL_PATH}) + endif() + endforeach() + endif() + set(${SRCS}) + set(${HDRS}) + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(FIL_WE ${FIL} NAME_WE) + ## get the directory where our protobufs are stored + file(RELATIVE_PATH REL_FIL ${CMAKE_SOURCE_DIR} ${ABS_FIL}) + get_filename_component(REL_DIR ${REL_FIL} DIRECTORY) + list(APPEND ${SRCS} "${CMAKE_BINARY_DIR_GEN}/${FIL_WE}.pb.cc") + list(APPEND ${HDRS} "${CMAKE_BINARY_DIR_GEN}/${FIL_WE}.pb.h") + add_custom_command( + OUTPUT "${CMAKE_BINARY_DIR_GEN}/${FIL_WE}.pb.cc" + "${CMAKE_BINARY_DIR_GEN}/${FIL_WE}.pb.h" + COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} + ARGS --cpp_out=${CMAKE_BINARY_DIR_GEN} + --proto_path=${REL_DIR} + ${_protobuf_include_path} + ${REL_FIL} + DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Generating ${FIL}" + VERBATIM) + endforeach() + set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) + set(${SRCS} ${${SRCS}} PARENT_SCOPE) + set(${HDRS} ${${HDRS}} PARENT_SCOPE) +endfunction() diff --git a/hbase-native-client/include/hbase/client/BUCK b/hbase-native-client/include/hbase/client/BUCK deleted file mode 100644 index 66d6896e07..0000000000 --- a/hbase-native-client/include/hbase/client/BUCK +++ /dev/null @@ -1,93 +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. - -# This is the main library. -cxx_library( - name="client", - header_namespace="hbase/client", - exported_headers=[ - "async-client-scanner.h", - "async-connection.h", - "async-region-locator.h", - "async-rpc-retrying-caller-factory.h", - "async-rpc-retrying-caller.h", - "async-table-result-scanner.h", - "client.h", - "cell.h", - "filter.h", - "query.h", - "keyvalue-codec.h", - "region-location.h", - "location-cache.h", - "connection-configuration.h", - # TODO: move this out of exported - # Once meta lookup works - "meta-utils.h", - "get.h", - "increment.h", - "mutation.h", - "put.h", - "delete.h", - "scan.h", - "append.h", - "result.h", - "result-scanner.h", - "request-converter.h", - "response-converter.h", - "table.h", - "async-scan-rpc-retrying-caller.h", - "raw-async-table.h", - "raw-scan-result-consumer.h", - "scan-result-cache.h", - "hbase-rpc-controller.h", - "time-range.h", - "zk-util.h", - "action.h", - "multi-response.h", - "region-request.h", - "region-result.h", - "row.h", - "server-request.h", - "async-batch-rpc-retrying-caller.h", - ], - deps=[ - "//include/hbase/exceptions:exceptions", - "//include/hbase/utils:utils", - "//include/hbase/connection:connection", - "//include/hbase/client:conf", - "//src/hbase/if:if", - "//include/hbase/serde:serde", - "//third-party:folly", - "//third-party:wangle", - "//third-party:zookeeper_mt", - ], - compiler_flags=['-Weffc++', '-ggdb'], - visibility=[ - 'PUBLIC', - ],) -cxx_library( - name="conf", - header_namespace="hbase/client", - exported_headers=[ - "configuration.h", - "hbase-configuration-loader.h", - ], - deps=["//src/hbase/utils:utils", "//third-party:folly"], - compiler_flags=['-Weffc++', '-ggdb'], - visibility=[ - 'PUBLIC', - ],) diff --git a/hbase-native-client/include/hbase/connection/BUCK b/hbase-native-client/include/hbase/connection/BUCK deleted file mode 100644 index 9a0b0cf318..0000000000 --- a/hbase-native-client/include/hbase/connection/BUCK +++ /dev/null @@ -1,57 +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. - -# This is the library dealing with a single connection -# to a single server. -cxx_library( - name="connection", - header_namespace="hbase/connection", - exported_headers=[ - "client-dispatcher.h", - "client-handler.h", - "sasl-handler.h", - "connection-factory.h", - "connection-pool.h", - "connection-id.h", - "pipeline.h", - "request.h", - "rpc-connection.h", - "response.h", - "service.h", - "rpc-client.h", - "sasl-util.h", - "rpc-test-server.h", - "rpc-test-server-handler.h", - "rpc-fault-injector.h", - "rpc-fault-injector-inl.h", - ], - deps=[ - "//src/hbase/if:if", - "//include/hbase/utils:utils", - "//include/hbase/serde:serde", - "//include/hbase/security:security", - "//third-party:folly", - "//third-party:wangle", - "//include/hbase/exceptions:exceptions", - ], - compiler_flags=['-Weffc++'], - linker_flags=['-L/usr/local/lib', '-lsasl2', '-lkrb5'], - exported_linker_flags=['-L/usr/local/lib', '-lsasl2', '-lkrb5'], - visibility=[ - '//include/hbase/client/...', - '//src/hbase/connection/...', - ],) diff --git a/hbase-native-client/include/hbase/exceptions/BUCK b/hbase-native-client/include/hbase/exceptions/BUCK deleted file mode 100644 index ee296ff6ae..0000000000 --- a/hbase-native-client/include/hbase/exceptions/BUCK +++ /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. - -cxx_library( - name="exceptions", - header_namespace="hbase/exceptions", - exported_headers=[ - "exception.h", - ], - deps=[ - "//third-party:folly", - ], - compiler_flags=['-Weffc++'], - visibility=['//src/hbase/exceptions/...', '//include/hbase/client/...', '//include/hbase/connection/...'],) diff --git a/hbase-native-client/include/hbase/security/BUCK b/hbase-native-client/include/hbase/security/BUCK deleted file mode 100644 index 2e7530baf2..0000000000 --- a/hbase-native-client/include/hbase/security/BUCK +++ /dev/null @@ -1,30 +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. - -# This is the library dealing with a single connection -# to a single server. -cxx_library( - name="security", - header_namespace="hbase/security", - exported_headers=[ - "user.h", - ], - deps=["//src/hbase/client:conf"], - compiler_flags=['-Weffc++'], - visibility=[ - 'PUBLIC', - ],) diff --git a/hbase-native-client/include/hbase/serde/BUCK b/hbase-native-client/include/hbase/serde/BUCK deleted file mode 100644 index ee8ef825cf..0000000000 --- a/hbase-native-client/include/hbase/serde/BUCK +++ /dev/null @@ -1,37 +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. - -cxx_library( - name="serde", - header_namespace="hbase/serde", - exported_headers=[ - "cell-scanner.h", - "cell-outputstream.h", - "codec.h", - "region-info.h", - "rpc-serde.h", - "server-name.h", - "table-name.h", - "zk.h", - ], - deps=[ - "//src/hbase/if:if", "//third-party:folly", "//src/hbase/utils:utils", "//src/hbase/security:security" - ], - compiler_flags=['-Weffc++'], - visibility=[ - 'PUBLIC', - ],) diff --git a/hbase-native-client/src/hbase/test-util/mini-cluster.h b/hbase-native-client/include/hbase/test-util/mini-cluster.h similarity index 98% rename from hbase-native-client/src/hbase/test-util/mini-cluster.h rename to hbase-native-client/include/hbase/test-util/mini-cluster.h index 6b4547cd69..978ded8c69 100644 --- a/hbase-native-client/src/hbase/test-util/mini-cluster.h +++ b/hbase-native-client/include/hbase/test-util/mini-cluster.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace hbase { @@ -69,7 +70,7 @@ class MiniCluster { jmethodID str_ctor_mid_; jobject htu_; jobject cluster_; - pthread_mutex_t count_mutex_; + std::mutex count_mutex_; JavaVM *jvm_; JNIEnv *CreateVM(JavaVM **jvm); void Setup(); diff --git a/hbase-native-client/src/hbase/test-util/test-util.h b/hbase-native-client/include/hbase/test-util/test-util.h similarity index 100% rename from hbase-native-client/src/hbase/test-util/test-util.h rename to hbase-native-client/include/hbase/test-util/test-util.h diff --git a/hbase-native-client/include/hbase/utils/BUCK b/hbase-native-client/include/hbase/utils/BUCK deleted file mode 100644 index d44e90854f..0000000000 --- a/hbase-native-client/include/hbase/utils/BUCK +++ /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. - -cxx_library( - name="utils", - header_namespace="hbase/utils", - exported_headers=[ - "bytes-util.h", - "connection-util.h", - "concurrent-map.h", - "optional.h", - "sys-util.h", - "time-util.h", - "user-util.h", - "version.h", - ], - deps=[ - '//third-party:folly', - ], - tests=[":user-util-test"], - linker_flags=['-L/usr/local/lib', '-lkrb5'], - exported_linker_flags=['-L/usr/local/lib', '-lkrb5'], - visibility=[ - 'PUBLIC', - ], - compiler_flags=['-Weffc++'],) diff --git a/hbase-native-client/src/hbase/client/BUCK b/hbase-native-client/src/hbase/client/BUCK deleted file mode 100644 index 1a8f434dee..0000000000 --- a/hbase-native-client/src/hbase/client/BUCK +++ /dev/null @@ -1,301 +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. - -# This is the main library. -cxx_library( - name="client", - srcs=[ - "async-client-scanner.cc", - "async-connection.cc", - "async-rpc-retrying-caller-factory.cc", - "async-rpc-retrying-caller.cc", - "async-scan-rpc-retrying-caller.cc", - "async-table-result-scanner.cc", - "cell.cc", - "client.cc", - "hbase-rpc-controller.cc", - "keyvalue-codec.cc", - "location-cache.cc", - "meta-utils.cc", - "increment.cc", - "get.cc", - "mutation.cc", - "put.cc", - "delete.cc", - "scan.cc", - "append.cc", - "scan-result-cache.cc", - "raw-async-table.cc", - "result.cc", - "request-converter.cc", - "response-converter.cc", - "table.cc", - "time-range.cc", - "zk-util.cc", - "multi-response.cc", - "region-result.cc", - "async-batch-rpc-retrying-caller.cc", - ], - deps=[ - "//include/hbase/client:client", - "//src/hbase/exceptions:exceptions", - "//src/hbase/utils:utils", - "//src/hbase/connection:connection", - "//src/hbase/client:conf", - "//src/hbase/if:if", - "//src/hbase/serde:serde", - "//third-party:folly", - "//third-party:wangle", - "//third-party:zookeeper_mt", - ], - compiler_flags=['-Weffc++', '-ggdb'], - visibility=[ - 'PUBLIC', - ],) -cxx_library( - name="conf", - exported_headers=[ - ], - srcs=[ - "configuration.cc", - "hbase-configuration-loader.cc", - ], - deps=["//include/hbase/client:conf", "//src/hbase/utils:utils", "//third-party:folly"], - compiler_flags=['-Weffc++', '-ggdb'], - visibility=[ - 'PUBLIC', - ],) -cxx_test( - name="location-cache-test", - srcs=[ - "location-cache-test.cc", - ], - deps=[ - ":client", - "//src/hbase/test-util:test-util", - ], - run_test_separately=True,) -cxx_test( - name="location-cache-retry-test", - srcs=[ - "location-cache-retry-test.cc", - ], - deps=[ - ":client", - "//src/hbase/if:if", - "//src/hbase/serde:serde", - "//src/hbase/test-util:test-util", - ], - run_test_separately=True,) -cxx_test( - name="cell-test", - srcs=[ - "cell-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="filter-test", - srcs=[ - "filter-test.cc", - ], - deps=[ - ":client", - "//src/hbase/if:if", - "//src/hbase/serde:serde", - "//src/hbase/test-util:test-util", - ], - run_test_separately=True,) -cxx_test( - name="get-test", - srcs=[ - "get-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="delete-test", - srcs=[ - "delete-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="increment-test", - srcs=[ - "increment-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="put-test", - srcs=[ - "put-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="append-test", - srcs=[ - "append-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="retry-test", - srcs=[ - "async-rpc-retrying-test.cc", - ], - deps=[ - ":client", - "//src/hbase/test-util:test-util", - "//src/hbase/exceptions:exceptions", - ], - run_test_separately=True,) -cxx_test( - name="time-range-test", - srcs=[ - "time-range-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="configuration-test", - srcs=[ - "configuration-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="hbase-configuration-test", - srcs=[ - "hbase-configuration-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="scan-test", - srcs=[ - "scan-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="result-test", - srcs=[ - "result-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="request-converter-test", - srcs=[ - "request-converter-test.cc", - ], - deps=[ - ":client", - "//src/hbase/connection:connection", - "//src/hbase/if:if", - ], - run_test_separately=True,) -cxx_test( - name="client-test", - srcs=[ - "client-test.cc", - ], - deps=[ - ":client", - "//src/hbase/if:if", - "//src/hbase/serde:serde", - "//src/hbase/test-util:test-util", - ], - run_test_separately=True,) -cxx_test( - name="scan-result-cache-test", - srcs=[ - "scan-result-cache-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="scanner-test", - srcs=[ - "scanner-test.cc", - ], - deps=[ - ":client", - "//src/hbase/if:if", - "//src/hbase/serde:serde", - "//src/hbase/test-util:test-util", - ], - run_test_separately=True,) -cxx_test( - name="zk-util-test", - srcs=[ - "zk-util-test.cc", - ], - deps=[ - ":client", - ], - run_test_separately=True,) -cxx_test( - name="multi-retry-test", - srcs=[ - "async-batch-rpc-retrying-test.cc", - ], - deps=[ - ":client", - "//src/hbase/test-util:test-util", - "//src/hbase/exceptions:exceptions", - ], - run_test_separately=True,) -cxx_binary( - name="simple-client", - srcs=[ - "simple-client.cc", - ], - deps=[":client", "//src/hbase/connection:connection"],) -cxx_binary( - name="load-client", - srcs=[ - "load-client.cc", - ], - deps=[":client", "//src/hbase/connection:connection"],) diff --git a/hbase-native-client/src/hbase/connection/BUCK b/hbase-native-client/src/hbase/connection/BUCK deleted file mode 100644 index 1a856fb122..0000000000 --- a/hbase-native-client/src/hbase/connection/BUCK +++ /dev/null @@ -1,68 +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. - -# This is the library dealing with a single connection -# to a single server. -cxx_library( - name="connection", - srcs=[ - "client-dispatcher.cc", - "client-handler.cc", - "connection-factory.cc", - "connection-pool.cc", - "pipeline.cc", - "request.cc", - "rpc-client.cc", - "sasl-handler.cc", - "sasl-util.cc", - "rpc-test-server.cc", - "rpc-test-server-handler.cc", - "rpc-fault-injector.cc", - ], - deps=[ - "//include/hbase/connection:connection", - "//src/hbase/if:if", - "//src/hbase/utils:utils", - "//src/hbase/serde:serde", - "//src/hbase/security:security", - "//third-party:folly", - "//third-party:wangle", - "//src/hbase/exceptions:exceptions", - ], - compiler_flags=['-Weffc++'], - linker_flags=['-L/usr/local/lib', '-lsasl2', '-lkrb5'], - exported_linker_flags=['-L/usr/local/lib', '-lsasl2', '-lkrb5'], - visibility=[ - '//src/hbase/client/...', - ],) -cxx_test( - name="connection-pool-test", - srcs=[ - "connection-pool-test.cc", - ], - deps=[ - ":connection", - ],) -cxx_test( - name="rpc-test", - srcs=[ - "rpc-test.cc", - ], - deps=[ - ":connection", - ], - run_test_separately=True,) diff --git a/hbase-native-client/src/hbase/client/load-client.cc b/hbase-native-client/src/hbase/examples/load-client.cc similarity index 100% rename from hbase-native-client/src/hbase/client/load-client.cc rename to hbase-native-client/src/hbase/examples/load-client.cc diff --git a/hbase-native-client/src/hbase/client/simple-client.cc b/hbase-native-client/src/hbase/examples/simple-client.cc similarity index 100% rename from hbase-native-client/src/hbase/client/simple-client.cc rename to hbase-native-client/src/hbase/examples/simple-client.cc diff --git a/hbase-native-client/src/hbase/exceptions/BUCK b/hbase-native-client/src/hbase/exceptions/BUCK deleted file mode 100644 index 00ed3449c2..0000000000 --- a/hbase-native-client/src/hbase/exceptions/BUCK +++ /dev/null @@ -1,37 +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. - -cxx_library( - name="exceptions", - srcs=[ - "exception.cc", - ], - deps=[ - "//include/hbase/exceptions:exceptions", - "//third-party:folly", - ], - compiler_flags=['-Weffc++'], - visibility=['//src/hbase/client/...', '//src/hbase/connection/...'],) -cxx_test( - name="exception-test", - srcs=[ - "exception-test.cc", - ], - deps=[ - ":exceptions", - ], - run_test_separately=True,) diff --git a/hbase-native-client/src/hbase/if/BUCK b/hbase-native-client/src/hbase/if/BUCK deleted file mode 100644 index c8d51f2a23..0000000000 --- a/hbase-native-client/src/hbase/if/BUCK +++ /dev/null @@ -1,49 +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. - -PROTO_SRCS = glob(['*.proto']) -HEADER_FILENAMES = [x.replace('.proto', '.pb.h') for x in PROTO_SRCS] -CC_FILENAMES = [x.replace('.proto', '.pb.cc') for x in PROTO_SRCS] - -genrule( - name='generate-proto-sources', - srcs=PROTO_SRCS, - cmd='mkdir -p $OUT && pwd && protoc --proto_path=. --cpp_out=$OUT *.proto', - out='output', ) - -for header_filename in HEADER_FILENAMES: - genrule(name=header_filename, - cmd='mkdir -p `dirname $OUT` ' - ' && cp $(location :generate-proto-sources)/{} $OUT'.format( - header_filename), - out=header_filename, ) -for cc_filename in CC_FILENAMES: - genrule( - name=cc_filename, - cmd='mkdir -p `dirname $OUT` ' - ' && cp $(location :generate-proto-sources)/*.cc `dirname $OUT` ' - ' && cp $(location :generate-proto-sources)/*.h `dirname $OUT`'.format( - cc_filename), - out=cc_filename, ) - -cxx_library(name='if', - header_namespace="hbase/if", - exported_headers=[':' + x for x in HEADER_FILENAMES], - srcs=[':' + x for x in CC_FILENAMES], - deps=['//third-party:protobuf'], - visibility=['PUBLIC', ], - exported_deps=['//third-party:protobuf']) diff --git a/hbase-native-client/src/hbase/security/BUCK b/hbase-native-client/src/hbase/security/BUCK deleted file mode 100644 index c329f30f6a..0000000000 --- a/hbase-native-client/src/hbase/security/BUCK +++ /dev/null @@ -1,27 +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. - -# This is the library dealing with a single connection -# to a single server. -cxx_library( - name="security", - srcs=[], - deps=["//include/hbase/security:security", "//src/hbase/client:conf"], - compiler_flags=['-Weffc++'], - visibility=[ - 'PUBLIC', - ],) diff --git a/hbase-native-client/src/hbase/serde/BUCK b/hbase-native-client/src/hbase/serde/BUCK deleted file mode 100644 index 6b39e0b8f9..0000000000 --- a/hbase-native-client/src/hbase/serde/BUCK +++ /dev/null @@ -1,86 +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. - -cxx_library( - name="serde", - srcs=[ - "rpc-serde.cc", - "zk.cc", - ], - deps=[ - "//include/hbase/serde:serde", "//src/hbase/if:if", "//third-party:folly", "//src/hbase/utils:utils", "//src/hbase/security:security" - ], - tests=[ - ":client-deserializer-test", - ":client-serializer-test", - ":server-name-test", - ":table-name-test", - ":zk-deserializer-test", - ":region-info-deserializer-test", - ], - compiler_flags=['-Weffc++'], - visibility=[ - 'PUBLIC', - ],) -cxx_test( - name="table-name-test", - srcs=[ - "table-name-test.cc", - ], - deps=[ - ":serde", - ],) -cxx_test( - name="server-name-test", - srcs=[ - "server-name-test.cc", - ], - deps=[ - ":serde", - ],) -cxx_test( - name="client-serializer-test", - srcs=[ - "client-serializer-test.cc", - ], - deps=[ - ":serde", - ],) -cxx_test( - name="client-deserializer-test", - srcs=[ - "client-deserializer-test.cc", - ], - deps=[ - ":serde", - ],) -cxx_test( - name="zk-deserializer-test", - srcs=[ - "zk-deserializer-test.cc", - ], - deps=[ - ":serde", - ],) -cxx_test( - name="region-info-deserializer-test", - srcs=[ - "region-info-deserializer-test.cc", - ], - deps=[ - ":serde", - ],) diff --git a/hbase-native-client/src/hbase/test-util/BUCK b/hbase-native-client/src/hbase/test-util/BUCK deleted file mode 100644 index f1aedab550..0000000000 --- a/hbase-native-client/src/hbase/test-util/BUCK +++ /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. -import os - -cxx_library( - name="test-util", - header_namespace="hbase/test-util", - exported_headers=["test-util.h", "mini-cluster.h"], - srcs=["test-util.cc", "mini-cluster.cc"], - deps=[ - "//third-party:folly", - "//src/hbase/client:client", - ], - preprocessor_flags=[ - '-I' + os.environ['JAVA_HOME'] + '/include', - '-I' + os.environ['JAVA_HOME'] + '/include/darwin', - '-I' + os.environ['JAVA_HOME'] + '/include/linux' - ], - exported_preprocessor_flags=[ - '-I' + os.environ['JAVA_HOME'] + '/include', - '-I' + os.environ['JAVA_HOME'] + '/include/darwin', - '-I' + os.environ['JAVA_HOME'] + '/include/linux' - ], - compiler_flags=[ - '-I' + os.environ['JAVA_HOME'] + '/include', - '-I' + os.environ['JAVA_HOME'] + '/include/darwin', - '-I' + os.environ['JAVA_HOME'] + '/include/linux', '-ggdb' - ], - linker_flags=[ - '-ljvm', '-L' + os.environ['JAVA_HOME'] + '/jre/lib/amd64/server', - '-ggdb' - ], - exported_linker_flags=[ - '-ljvm', '-L' + os.environ['JAVA_HOME'] + '/jre/lib/amd64/server', - '-Wl,-rpath=' + os.environ['JAVA_HOME'] + '/jre/lib/amd64/server' - ], - visibility=[ - 'PUBLIC', - ],) diff --git a/hbase-native-client/src/hbase/test-util/mini-cluster.cc b/hbase-native-client/src/hbase/test-util/mini-cluster.cc index 1e491a24f0..98a4e7e4c4 100644 --- a/hbase-native-client/src/hbase/test-util/mini-cluster.cc +++ b/hbase-native-client/src/hbase/test-util/mini-cluster.cc @@ -80,7 +80,7 @@ MiniCluster::~MiniCluster() { void MiniCluster::Setup() { jmethodID constructor; - pthread_mutex_lock(&count_mutex_); + std::lock_guard lock(count_mutex_); if (env_ == NULL) { env_ = CreateVM(&jvm_); if (env_ == NULL) { @@ -176,7 +176,6 @@ void MiniCluster::Setup() { exit(-1); } } - pthread_mutex_unlock(&count_mutex_); } jobject MiniCluster::htu() { diff --git a/hbase-native-client/src/hbase/utils/BUCK b/hbase-native-client/src/hbase/utils/BUCK deleted file mode 100644 index ab55d8f534..0000000000 --- a/hbase-native-client/src/hbase/utils/BUCK +++ /dev/null @@ -1,57 +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. - -cxx_library( - name="utils", - exported_headers=[ - ], - srcs=["bytes-util.cc", "connection-util.cc", "user-util.cc"], - deps=[ - '//include/hbase/utils:utils', - '//third-party:folly', - ], - tests=[":user-util-test"], - linker_flags=['-L/usr/local/lib', '-lkrb5'], - exported_linker_flags=['-L/usr/local/lib', '-lkrb5'], - visibility=[ - 'PUBLIC', - ], - compiler_flags=['-Weffc++'],) -cxx_test( - name="bytes-util-test", - srcs=[ - "bytes-util-test.cc", - ], - deps=[ - ":utils", - ],) -cxx_test( - name="concurrent-map-test", - srcs=[ - "concurrent-map-test.cc", - ], - deps=[ - ":utils", - ],) -cxx_test( - name="user-util-test", - srcs=[ - "user-util-test.cc", - ], - deps=[ - ":utils", - ],) diff --git a/hbase-native-client/src/hbase/utils/bytes-util.cc b/hbase-native-client/src/hbase/utils/bytes-util.cc index 144b866801..5b34aa09a7 100644 --- a/hbase-native-client/src/hbase/utils/bytes-util.cc +++ b/hbase-native-client/src/hbase/utils/bytes-util.cc @@ -19,7 +19,6 @@ #include "hbase/utils/bytes-util.h" -#include #include #include diff --git a/hbase-native-client/src/hbase/client/append-test.cc b/hbase-native-client/src/test/append-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/append-test.cc rename to hbase-native-client/src/test/append-test.cc diff --git a/hbase-native-client/src/hbase/client/async-batch-rpc-retrying-test.cc b/hbase-native-client/src/test/async-batch-rpc-retrying-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/async-batch-rpc-retrying-test.cc rename to hbase-native-client/src/test/async-batch-rpc-retrying-test.cc diff --git a/hbase-native-client/src/hbase/client/async-rpc-retrying-test.cc b/hbase-native-client/src/test/async-rpc-retrying-test.cc similarity index 99% rename from hbase-native-client/src/hbase/client/async-rpc-retrying-test.cc rename to hbase-native-client/src/test/async-rpc-retrying-test.cc index 6782d05cf9..b590b43fd3 100644 --- a/hbase-native-client/src/hbase/client/async-rpc-retrying-test.cc +++ b/hbase-native-client/src/test/async-rpc-retrying-test.cc @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/hbase-native-client/src/hbase/utils/bytes-util-test.cc b/hbase-native-client/src/test/bytes-util-test.cc similarity index 100% rename from hbase-native-client/src/hbase/utils/bytes-util-test.cc rename to hbase-native-client/src/test/bytes-util-test.cc diff --git a/hbase-native-client/src/hbase/client/cell-test.cc b/hbase-native-client/src/test/cell-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/cell-test.cc rename to hbase-native-client/src/test/cell-test.cc diff --git a/hbase-native-client/src/hbase/serde/client-deserializer-test.cc b/hbase-native-client/src/test/client-deserializer-test.cc similarity index 100% rename from hbase-native-client/src/hbase/serde/client-deserializer-test.cc rename to hbase-native-client/src/test/client-deserializer-test.cc diff --git a/hbase-native-client/src/hbase/serde/client-serializer-test.cc b/hbase-native-client/src/test/client-serializer-test.cc similarity index 100% rename from hbase-native-client/src/hbase/serde/client-serializer-test.cc rename to hbase-native-client/src/test/client-serializer-test.cc diff --git a/hbase-native-client/src/hbase/client/client-test.cc b/hbase-native-client/src/test/client-test.cc similarity index 99% rename from hbase-native-client/src/hbase/client/client-test.cc rename to hbase-native-client/src/test/client-test.cc index 0773d3dea0..b1d5180e97 100644 --- a/hbase-native-client/src/hbase/client/client-test.cc +++ b/hbase-native-client/src/test/client-test.cc @@ -19,6 +19,7 @@ #include +#include #include "hbase/client/append.h" #include "hbase/client/cell.h" #include "hbase/client/client.h" diff --git a/hbase-native-client/src/hbase/utils/concurrent-map-test.cc b/hbase-native-client/src/test/concurrent-map-test.cc similarity index 100% rename from hbase-native-client/src/hbase/utils/concurrent-map-test.cc rename to hbase-native-client/src/test/concurrent-map-test.cc diff --git a/hbase-native-client/src/hbase/client/configuration-test.cc b/hbase-native-client/src/test/configuration-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/configuration-test.cc rename to hbase-native-client/src/test/configuration-test.cc diff --git a/hbase-native-client/src/hbase/connection/connection-pool-test.cc b/hbase-native-client/src/test/connection-pool-test.cc similarity index 100% rename from hbase-native-client/src/hbase/connection/connection-pool-test.cc rename to hbase-native-client/src/test/connection-pool-test.cc diff --git a/hbase-native-client/src/hbase/client/delete-test.cc b/hbase-native-client/src/test/delete-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/delete-test.cc rename to hbase-native-client/src/test/delete-test.cc diff --git a/hbase-native-client/src/hbase/exceptions/exception-test.cc b/hbase-native-client/src/test/exception-test.cc similarity index 100% rename from hbase-native-client/src/hbase/exceptions/exception-test.cc rename to hbase-native-client/src/test/exception-test.cc diff --git a/hbase-native-client/src/hbase/client/filter-test.cc b/hbase-native-client/src/test/filter-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/filter-test.cc rename to hbase-native-client/src/test/filter-test.cc diff --git a/hbase-native-client/src/hbase/client/get-test.cc b/hbase-native-client/src/test/get-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/get-test.cc rename to hbase-native-client/src/test/get-test.cc diff --git a/hbase-native-client/src/hbase/client/hbase-configuration-test.cc b/hbase-native-client/src/test/hbase-configuration-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/hbase-configuration-test.cc rename to hbase-native-client/src/test/hbase-configuration-test.cc diff --git a/hbase-native-client/src/hbase/client/increment-test.cc b/hbase-native-client/src/test/increment-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/increment-test.cc rename to hbase-native-client/src/test/increment-test.cc diff --git a/hbase-native-client/src/hbase/client/location-cache-retry-test.cc b/hbase-native-client/src/test/location-cache-retry-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/location-cache-retry-test.cc rename to hbase-native-client/src/test/location-cache-retry-test.cc diff --git a/hbase-native-client/src/hbase/client/location-cache-test.cc b/hbase-native-client/src/test/location-cache-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/location-cache-test.cc rename to hbase-native-client/src/test/location-cache-test.cc diff --git a/hbase-native-client/src/hbase/client/put-test.cc b/hbase-native-client/src/test/put-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/put-test.cc rename to hbase-native-client/src/test/put-test.cc diff --git a/hbase-native-client/src/hbase/serde/region-info-deserializer-test.cc b/hbase-native-client/src/test/region-info-deserializer-test.cc similarity index 100% rename from hbase-native-client/src/hbase/serde/region-info-deserializer-test.cc rename to hbase-native-client/src/test/region-info-deserializer-test.cc diff --git a/hbase-native-client/src/hbase/client/request-converter-test.cc b/hbase-native-client/src/test/request-converter-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/request-converter-test.cc rename to hbase-native-client/src/test/request-converter-test.cc diff --git a/hbase-native-client/src/hbase/client/result-test.cc b/hbase-native-client/src/test/result-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/result-test.cc rename to hbase-native-client/src/test/result-test.cc diff --git a/hbase-native-client/src/hbase/connection/rpc-test.cc b/hbase-native-client/src/test/rpc-test.cc similarity index 100% rename from hbase-native-client/src/hbase/connection/rpc-test.cc rename to hbase-native-client/src/test/rpc-test.cc diff --git a/hbase-native-client/src/hbase/client/scan-result-cache-test.cc b/hbase-native-client/src/test/scan-result-cache-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/scan-result-cache-test.cc rename to hbase-native-client/src/test/scan-result-cache-test.cc diff --git a/hbase-native-client/src/hbase/client/scan-test.cc b/hbase-native-client/src/test/scan-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/scan-test.cc rename to hbase-native-client/src/test/scan-test.cc diff --git a/hbase-native-client/src/hbase/client/scanner-test.cc b/hbase-native-client/src/test/scanner-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/scanner-test.cc rename to hbase-native-client/src/test/scanner-test.cc diff --git a/hbase-native-client/src/hbase/serde/server-name-test.cc b/hbase-native-client/src/test/server-name-test.cc similarity index 100% rename from hbase-native-client/src/hbase/serde/server-name-test.cc rename to hbase-native-client/src/test/server-name-test.cc diff --git a/hbase-native-client/src/hbase/serde/table-name-test.cc b/hbase-native-client/src/test/table-name-test.cc similarity index 100% rename from hbase-native-client/src/hbase/serde/table-name-test.cc rename to hbase-native-client/src/test/table-name-test.cc diff --git a/hbase-native-client/src/hbase/client/time-range-test.cc b/hbase-native-client/src/test/time-range-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/time-range-test.cc rename to hbase-native-client/src/test/time-range-test.cc diff --git a/hbase-native-client/src/hbase/utils/user-util-test.cc b/hbase-native-client/src/test/user-util-test.cc similarity index 100% rename from hbase-native-client/src/hbase/utils/user-util-test.cc rename to hbase-native-client/src/test/user-util-test.cc diff --git a/hbase-native-client/src/hbase/serde/zk-deserializer-test.cc b/hbase-native-client/src/test/zk-deserializer-test.cc similarity index 100% rename from hbase-native-client/src/hbase/serde/zk-deserializer-test.cc rename to hbase-native-client/src/test/zk-deserializer-test.cc diff --git a/hbase-native-client/src/hbase/client/zk-util-test.cc b/hbase-native-client/src/test/zk-util-test.cc similarity index 100% rename from hbase-native-client/src/hbase/client/zk-util-test.cc rename to hbase-native-client/src/test/zk-util-test.cc diff --git a/hbase-native-client/third-party/BUCK b/hbase-native-client/third-party/BUCK deleted file mode 100644 index 418323b286..0000000000 --- a/hbase-native-client/third-party/BUCK +++ /dev/null @@ -1,118 +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. - - -def add_system_libs(names=[], - lib_dir="/usr/lib/x86_64-linux-gnu", - deps=[], - exported_deps=[], - exported_linker_flags=[]): - rules = [] - for name in names: - rule_visibility = ['PUBLIC'] - gen_rule_name = "gen_lib{}".format(name) - genrule( - name=gen_rule_name, - out=gen_rule_name, - bash="mkdir -p $OUT && cp {}/lib{}.a $OUT".format(lib_dir, name),) - prebuilt_cxx_library( - name=name, - lib_name=name, - lib_dir='$(location :{})'.format(gen_rule_name), - deps=deps, - force_static=True, - exported_deps=exported_deps, - visibility=rule_visibility,) - rules.append(":" + name) - return rules - - -def add_dynamic_libs(names=[]): - rules = [] - for name in names: - prebuilt_cxx_library( - name=name, - header_only=True, - exported_linker_flags=["-l" + name], - visibility=["PUBLIC"],) - rules.append(":" + name) - return rules - - -system_libs = [ - "lzma", - "event", -] -local_libs = [ - "double-conversion", - "boost_regex", - "boost_context", - "boost_thread", - "boost_system", - "boost_filesystem", - "boost_program_options", - "boost_chrono", - "gflags", - "glog", - "protobuf", -] -dynamic_libs = ["stdc++", "pthread", "ssl", "crypto", "dl", "atomic", "unwind"] -dynamic_rules = add_dynamic_libs(dynamic_libs) -tp_dep_rules = add_system_libs(system_libs,) \ - + add_system_libs(local_libs, lib_dir = "/usr/local/lib") \ - + dynamic_rules - -zookeeper = add_system_libs(["zookeeper_mt"], lib_dir="/usr/local/lib") -folly = add_system_libs( - ['folly'], - lib_dir='/usr/local/lib', - exported_deps=tp_dep_rules,) -folly_bench = add_system_libs( - ['follybenchmark'], - lib_dir='/usr/local/lib', - exported_deps=folly + tp_dep_rules,) -wangle = add_system_libs( - ['wangle'], lib_dir='/usr/local/lib', exported_deps=folly + tp_dep_rules) - -genrule( - name="gen_zk", - out="gen_zk", - bash= - "mkdir -p $OUT && wget http://www-us.apache.org/dist/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz && tar zxf zookeeper-3.4.8.tar.gz && rm -rf zookeeper-3.4.8.tar.gz && cd zookeeper-3.4.8 && cd src/c && ./configure --prefix=$OUT && make && make install && cd $OUT && rm -rf zookeeper-3.4.8*" -) -cxx_library( - name='google-test', - srcs=[ - 'googletest/googletest/src/gtest-all.cc', - 'googletest/googlemock/src/gmock-all.cc', - 'googletest/googlemock/src/gmock_main.cc', - ], - header_namespace='', - exported_headers=subdir_glob([ - ('googletest/googletest/include', '**/*.h'), - ('googletest/googlemock/include', '**/*.h'), - ]), - headers=subdir_glob([ - ('googletest/googletest', 'src/*.h'), - ('googletest/googletest', 'src/*.cc'), - ('googletest/googlemock', 'src/*.h'), - ('googletest/googlemock', 'src/*.cc'), - ]), - exported_deps=dynamic_rules, - visibility=[ - 'PUBLIC', - ],) -- 2.14.1