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
* Get the Dockerfile working again
Signed-off-by: Josh Elser <elserj@apache.org>
diff --git a/.gitignore b/.gitignore
index e8dd42d..5f3e387 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,19 @@
# Generated files
src/hbase/utils/version.h
+
+# Tests
+*-test
+
+# Executables
+load-client
+simple-client
+
+# CMake temporary files
+CMakeCache.txt
+CMakeFiles
+*.cmake
+Makefile
+
+# Copied from hbase-common at build-time
+include/hbase/utils/version.h
diff --git a/BUILDING.md b/BUILDING.md
index 4c06776..53eb6d9 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -47,31 +47,11 @@
that will build the docker development environment and when complete will
drop you into a shell on a linux vm with all the tools needed installed.
-# Buck
-From then on we can use [buck](https://buckbuild.com/) to build everything.
-For example:
-```
-buck build //core:core
-buck test --all
-buck build //core:simple-client
-```
-
-That will build the library, then build and test everything, then build
-the simple-client binary. Buck will find all modules used, and compile
-them in parallel, caching the results. Output from buck is in the buck-out
-foulder. Generated binaries are in buck-out/gen logs are in buck-out/logs
-
-
-# Make
-
-If learning buck isn't your thing there is a Makefile wrapper for your
-convenience.
+# CMake
```
-make help
-make check
-make clean
-make all
-make build
+cmake .
+make
+make install
```
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..3afe4d7
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,194 @@
+# 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)
+# Copy the version.h file in before doing anything
+add_custom_target (
+ copy_version_h
+ COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/bin/copy-version.sh"
+)
+add_dependencies(hbaseclient-static copy_version_h)
+add_dependencies(hbaseclient-shared copy_version_h)
+
+# 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/Makefile b/Makefile
deleted file mode 100644
index cd818ca..0000000
--- a/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/Makefile.protos b/Makefile.protos
deleted file mode 100644
index 8712029..0000000
--- a/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/bin/cpplint.sh b/bin/cpplint.sh
index 7a27945..497ab24 100755
--- a/bin/cpplint.sh
+++ b/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 @@
# 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/cmake/BuildTests.cmake b/cmake/BuildTests.cmake
new file mode 100644
index 0000000..7ab2102
--- /dev/null
+++ b/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/cmake/FindFolly.cmake b/cmake/FindFolly.cmake
new file mode 100644
index 0000000..e7854a0
--- /dev/null
+++ b/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/cmake/FindGMock.cmake b/cmake/FindGMock.cmake
new file mode 100644
index 0000000..998fa6d
--- /dev/null
+++ b/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/cmake/FindGflags.cmake b/cmake/FindGflags.cmake
new file mode 100644
index 0000000..59c65df
--- /dev/null
+++ b/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/cmake/FindGlog.cmake b/cmake/FindGlog.cmake
new file mode 100644
index 0000000..a2c541d
--- /dev/null
+++ b/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/cmake/FindKrb5.cmake b/cmake/FindKrb5.cmake
new file mode 100644
index 0000000..e4c6fb8
--- /dev/null
+++ b/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/cmake/FindSasl2.cmake b/cmake/FindSasl2.cmake
new file mode 100644
index 0000000..871385b
--- /dev/null
+++ b/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/cmake/FindWangle.cmake b/cmake/FindWangle.cmake
new file mode 100644
index 0000000..6e69faa
--- /dev/null
+++ b/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/cmake/FindZookeeper.cmake b/cmake/FindZookeeper.cmake
new file mode 100644
index 0000000..a9e9d3d
--- /dev/null
+++ b/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/cmake/ProtobufGen.cmake b/cmake/ProtobufGen.cmake
new file mode 100644
index 0000000..0cc2c2f
--- /dev/null
+++ b/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/docker-files/Dockerfile b/docker-files/Dockerfile
index c8844ac..045f4f5 100644
--- a/docker-files/Dockerfile
+++ b/docker-files/Dockerfile
@@ -15,31 +15,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM pjameson/buck-folly-watchman:20160511
+FROM ubuntu:16.04
ARG CC=/usr/bin/gcc-5
ARG CXX=/usr/bin/g++-5
-ARG CFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -g -fno-omit-frame-pointer -O2 -pthread"
-ARG CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -g -fno-omit-frame-pointer -O2 -pthread"
+ARG CFLAGS="-fPIC -g -fno-omit-frame-pointer -O2 -pthread"
+ARG CXXFLAGS="-fPIC -g -fno-omit-frame-pointer -O2 -pthread"
ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
+RUN apt-get update && \
+ apt-get install -y vim maven inetutils-ping python-pip doxygen graphviz clang-format valgrind \
+ wget libgflags-dev libgoogle-glog-dev dh-autoreconf pkg-config libssl-dev build-essential \
+ libboost-all-dev libevent-dev libdouble-conversion-dev cmake libkrb5-dev git openjdk-8-jdk && \
+ pip install yapf && \
+ apt-get -qq clean && \
+ apt-get -y -qq autoremove && \
+ rm -rf /var/lib/{apt,dpkg,cache,log}/ && \
+ rm -rf /tmp/*
+
RUN wget ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-2.1.26.tar.gz ; \
tar zxf cyrus-sasl-2.1.26.tar.gz ; \
cd cyrus-sasl-2.1.26 ; \
./configure ; \
- make ; \
+ make -j4; \
make install ;\
cp /usr/local/lib/sasl2/* /usr/lib/sasl2/
-RUN apt-get install -y vim maven inetutils-ping python-pip doxygen graphviz clang-format \
- valgrind && \
- pip install yapf && \
- apt-get -qq clean && \
- apt-get -y -qq autoremove && \
- rm -rf /var/lib/{apt,dpkg,cache,log}/ && \
- rm -rf /tmp/*
-
RUN apt-get update && \
apt-get install -y debconf-utils debconf-set-selections && \
echo "krb5-config krb5-config/kerberos_servers string localhost" | debconf-set-selections ; \
@@ -67,7 +69,7 @@
ldconfig && \
./autogen.sh && \
./configure && \
- make && \
+ make -j4 && \
make install && \
make clean && \
rm -rf .git && \
@@ -79,12 +81,12 @@
cd src/c && \
ldconfig && \
./configure && \
- make && \
+ make -j4 && \
make install && \
make clean && \
ldconfig
-# Update folly
+# Update folly. `make check` removed due to a failing test, explicitly installing gtest ourselves
RUN cd /usr/src/ && \
ver=2017.09.04.00 && \
wget https://github.com/facebook/folly/archive/v$ver.tar.gz && \
@@ -96,13 +98,17 @@
tar zxf release-1.8.0.tar.gz && \
rm -f release-1.8.0.tar.gz && \
mv googletest-release-1.8.0 gtest && \
- cd ../ && \
+ cd gtest && \
+ cmake . && \
+ make -j4 && \
+ make install && \
+ cd ../.. && \
ldconfig && \
autoreconf -ivf && \
./configure && \
- make && \
- make check && \
- make install
+ make -j4 && \
+ make install && \
+ make clean
# Update wangle
RUN cd /usr/src/ && \
@@ -113,9 +119,10 @@
cd wangle-$ver/wangle && \
ldconfig && \
cmake . -DBUILD_TESTS=OFF && \
- make && \
+ make -j4 && \
ctest && \
- make install
+ make install && \
+ make clean
RUN echo "enabled=1" >> /etc/default/apport
diff --git a/include/hbase/client/BUCK b/include/hbase/client/BUCK
deleted file mode 100644
index 66d6896..0000000
--- a/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/include/hbase/connection/BUCK b/include/hbase/connection/BUCK
deleted file mode 100644
index 9a0b0cf..0000000
--- a/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/include/hbase/exceptions/BUCK b/include/hbase/exceptions/BUCK
deleted file mode 100644
index ee296ff..0000000
--- a/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/include/hbase/security/BUCK b/include/hbase/security/BUCK
deleted file mode 100644
index 2e7530b..0000000
--- a/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/include/hbase/serde/BUCK b/include/hbase/serde/BUCK
deleted file mode 100644
index ee8ef82..0000000
--- a/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/src/hbase/test-util/mini-cluster.h b/include/hbase/test-util/mini-cluster.h
similarity index 98%
rename from src/hbase/test-util/mini-cluster.h
rename to include/hbase/test-util/mini-cluster.h
index 6b4547c..978ded8 100644
--- a/src/hbase/test-util/mini-cluster.h
+++ b/include/hbase/test-util/mini-cluster.h
@@ -21,6 +21,7 @@
#include <jni.h>
#include <string>
#include <vector>
+#include <mutex>
namespace hbase {
@@ -69,7 +70,7 @@
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/src/hbase/test-util/test-util.h b/include/hbase/test-util/test-util.h
similarity index 100%
rename from src/hbase/test-util/test-util.h
rename to include/hbase/test-util/test-util.h
diff --git a/include/hbase/utils/BUCK b/include/hbase/utils/BUCK
deleted file mode 100644
index d44e908..0000000
--- a/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/src/hbase/client/BUCK b/src/hbase/client/BUCK
deleted file mode 100644
index 1a8f434..0000000
--- a/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/src/hbase/connection/BUCK b/src/hbase/connection/BUCK
deleted file mode 100644
index 1a856fb..0000000
--- a/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/src/hbase/client/load-client.cc b/src/hbase/examples/load-client.cc
similarity index 100%
rename from src/hbase/client/load-client.cc
rename to src/hbase/examples/load-client.cc
diff --git a/src/hbase/client/simple-client.cc b/src/hbase/examples/simple-client.cc
similarity index 100%
rename from src/hbase/client/simple-client.cc
rename to src/hbase/examples/simple-client.cc
diff --git a/src/hbase/exceptions/BUCK b/src/hbase/exceptions/BUCK
deleted file mode 100644
index 00ed344..0000000
--- a/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/src/hbase/if/BUCK b/src/hbase/if/BUCK
deleted file mode 100644
index c8d51f2..0000000
--- a/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/src/hbase/security/BUCK b/src/hbase/security/BUCK
deleted file mode 100644
index c329f30..0000000
--- a/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/src/hbase/serde/BUCK b/src/hbase/serde/BUCK
deleted file mode 100644
index 6b39e0b..0000000
--- a/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/src/hbase/test-util/BUCK b/src/hbase/test-util/BUCK
deleted file mode 100644
index f1aedab..0000000
--- a/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/src/hbase/test-util/mini-cluster.cc b/src/hbase/test-util/mini-cluster.cc
index 1e491a2..98a4e7e 100644
--- a/src/hbase/test-util/mini-cluster.cc
+++ b/src/hbase/test-util/mini-cluster.cc
@@ -80,7 +80,7 @@
void MiniCluster::Setup() {
jmethodID constructor;
- pthread_mutex_lock(&count_mutex_);
+ std::lock_guard<std::mutex> lock(count_mutex_);
if (env_ == NULL) {
env_ = CreateVM(&jvm_);
if (env_ == NULL) {
@@ -176,7 +176,6 @@
exit(-1);
}
}
- pthread_mutex_unlock(&count_mutex_);
}
jobject MiniCluster::htu() {
diff --git a/src/hbase/utils/BUCK b/src/hbase/utils/BUCK
deleted file mode 100644
index ab55d8f..0000000
--- a/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/src/hbase/utils/bytes-util.cc b/src/hbase/utils/bytes-util.cc
index 144b866..5b34aa0 100644
--- a/src/hbase/utils/bytes-util.cc
+++ b/src/hbase/utils/bytes-util.cc
@@ -19,7 +19,6 @@
#include "hbase/utils/bytes-util.h"
-#include <bits/stdc++.h>
#include <boost/predef.h>
#include <glog/logging.h>
diff --git a/src/hbase/client/append-test.cc b/src/test/append-test.cc
similarity index 100%
rename from src/hbase/client/append-test.cc
rename to src/test/append-test.cc
diff --git a/src/hbase/client/async-batch-rpc-retrying-test.cc b/src/test/async-batch-rpc-retrying-test.cc
similarity index 100%
rename from src/hbase/client/async-batch-rpc-retrying-test.cc
rename to src/test/async-batch-rpc-retrying-test.cc
diff --git a/src/hbase/client/async-rpc-retrying-test.cc b/src/test/async-rpc-retrying-test.cc
similarity index 99%
rename from src/hbase/client/async-rpc-retrying-test.cc
rename to src/test/async-rpc-retrying-test.cc
index 6782d05..b590b43 100644
--- a/src/hbase/client/async-rpc-retrying-test.cc
+++ b/src/test/async-rpc-retrying-test.cc
@@ -23,7 +23,6 @@
#include <folly/io/async/EventBase.h>
#include <folly/io/async/ScopedEventBaseThread.h>
#include <gmock/gmock.h>
-#include <google/protobuf/stubs/callback.h>
#include <wangle/concurrent/IOThreadPoolExecutor.h>
#include <chrono>
diff --git a/src/hbase/utils/bytes-util-test.cc b/src/test/bytes-util-test.cc
similarity index 100%
rename from src/hbase/utils/bytes-util-test.cc
rename to src/test/bytes-util-test.cc
diff --git a/src/hbase/client/cell-test.cc b/src/test/cell-test.cc
similarity index 100%
rename from src/hbase/client/cell-test.cc
rename to src/test/cell-test.cc
diff --git a/src/hbase/serde/client-deserializer-test.cc b/src/test/client-deserializer-test.cc
similarity index 100%
rename from src/hbase/serde/client-deserializer-test.cc
rename to src/test/client-deserializer-test.cc
diff --git a/src/hbase/serde/client-serializer-test.cc b/src/test/client-serializer-test.cc
similarity index 100%
rename from src/hbase/serde/client-serializer-test.cc
rename to src/test/client-serializer-test.cc
diff --git a/src/hbase/client/client-test.cc b/src/test/client-test.cc
similarity index 99%
rename from src/hbase/client/client-test.cc
rename to src/test/client-test.cc
index 0773d3d..b1d5180 100644
--- a/src/hbase/client/client-test.cc
+++ b/src/test/client-test.cc
@@ -19,6 +19,7 @@
#include <gtest/gtest.h>
+#include <fstream>
#include "hbase/client/append.h"
#include "hbase/client/cell.h"
#include "hbase/client/client.h"
diff --git a/src/hbase/utils/concurrent-map-test.cc b/src/test/concurrent-map-test.cc
similarity index 100%
rename from src/hbase/utils/concurrent-map-test.cc
rename to src/test/concurrent-map-test.cc
diff --git a/src/hbase/client/configuration-test.cc b/src/test/configuration-test.cc
similarity index 100%
rename from src/hbase/client/configuration-test.cc
rename to src/test/configuration-test.cc
diff --git a/src/hbase/connection/connection-pool-test.cc b/src/test/connection-pool-test.cc
similarity index 100%
rename from src/hbase/connection/connection-pool-test.cc
rename to src/test/connection-pool-test.cc
diff --git a/src/hbase/client/delete-test.cc b/src/test/delete-test.cc
similarity index 100%
rename from src/hbase/client/delete-test.cc
rename to src/test/delete-test.cc
diff --git a/src/hbase/exceptions/exception-test.cc b/src/test/exception-test.cc
similarity index 100%
rename from src/hbase/exceptions/exception-test.cc
rename to src/test/exception-test.cc
diff --git a/src/hbase/client/filter-test.cc b/src/test/filter-test.cc
similarity index 100%
rename from src/hbase/client/filter-test.cc
rename to src/test/filter-test.cc
diff --git a/src/hbase/client/get-test.cc b/src/test/get-test.cc
similarity index 100%
rename from src/hbase/client/get-test.cc
rename to src/test/get-test.cc
diff --git a/src/hbase/client/hbase-configuration-test.cc b/src/test/hbase-configuration-test.cc
similarity index 100%
rename from src/hbase/client/hbase-configuration-test.cc
rename to src/test/hbase-configuration-test.cc
diff --git a/src/hbase/client/increment-test.cc b/src/test/increment-test.cc
similarity index 100%
rename from src/hbase/client/increment-test.cc
rename to src/test/increment-test.cc
diff --git a/src/hbase/client/location-cache-retry-test.cc b/src/test/location-cache-retry-test.cc
similarity index 100%
rename from src/hbase/client/location-cache-retry-test.cc
rename to src/test/location-cache-retry-test.cc
diff --git a/src/hbase/client/location-cache-test.cc b/src/test/location-cache-test.cc
similarity index 100%
rename from src/hbase/client/location-cache-test.cc
rename to src/test/location-cache-test.cc
diff --git a/src/hbase/client/put-test.cc b/src/test/put-test.cc
similarity index 100%
rename from src/hbase/client/put-test.cc
rename to src/test/put-test.cc
diff --git a/src/hbase/serde/region-info-deserializer-test.cc b/src/test/region-info-deserializer-test.cc
similarity index 100%
rename from src/hbase/serde/region-info-deserializer-test.cc
rename to src/test/region-info-deserializer-test.cc
diff --git a/src/hbase/client/request-converter-test.cc b/src/test/request-converter-test.cc
similarity index 100%
rename from src/hbase/client/request-converter-test.cc
rename to src/test/request-converter-test.cc
diff --git a/src/hbase/client/result-test.cc b/src/test/result-test.cc
similarity index 100%
rename from src/hbase/client/result-test.cc
rename to src/test/result-test.cc
diff --git a/src/hbase/connection/rpc-test.cc b/src/test/rpc-test.cc
similarity index 100%
rename from src/hbase/connection/rpc-test.cc
rename to src/test/rpc-test.cc
diff --git a/src/hbase/client/scan-result-cache-test.cc b/src/test/scan-result-cache-test.cc
similarity index 100%
rename from src/hbase/client/scan-result-cache-test.cc
rename to src/test/scan-result-cache-test.cc
diff --git a/src/hbase/client/scan-test.cc b/src/test/scan-test.cc
similarity index 100%
rename from src/hbase/client/scan-test.cc
rename to src/test/scan-test.cc
diff --git a/src/hbase/client/scanner-test.cc b/src/test/scanner-test.cc
similarity index 100%
rename from src/hbase/client/scanner-test.cc
rename to src/test/scanner-test.cc
diff --git a/src/hbase/serde/server-name-test.cc b/src/test/server-name-test.cc
similarity index 100%
rename from src/hbase/serde/server-name-test.cc
rename to src/test/server-name-test.cc
diff --git a/src/hbase/serde/table-name-test.cc b/src/test/table-name-test.cc
similarity index 100%
rename from src/hbase/serde/table-name-test.cc
rename to src/test/table-name-test.cc
diff --git a/src/hbase/client/time-range-test.cc b/src/test/time-range-test.cc
similarity index 100%
rename from src/hbase/client/time-range-test.cc
rename to src/test/time-range-test.cc
diff --git a/src/hbase/utils/user-util-test.cc b/src/test/user-util-test.cc
similarity index 100%
rename from src/hbase/utils/user-util-test.cc
rename to src/test/user-util-test.cc
diff --git a/src/hbase/serde/zk-deserializer-test.cc b/src/test/zk-deserializer-test.cc
similarity index 100%
rename from src/hbase/serde/zk-deserializer-test.cc
rename to src/test/zk-deserializer-test.cc
diff --git a/src/hbase/client/zk-util-test.cc b/src/test/zk-util-test.cc
similarity index 100%
rename from src/hbase/client/zk-util-test.cc
rename to src/test/zk-util-test.cc
diff --git a/third-party/BUCK b/third-party/BUCK
deleted file mode 100644
index 418323b..0000000
--- a/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',
- ],)