Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zd-double committed Feb 11, 2017
2 parents f25dbed + 029d73c commit 97f7d26
Show file tree
Hide file tree
Showing 55 changed files with 1,741 additions and 163 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ depends.mk
src/sofa/pbrpc/*.pb.h
src/sofa/pbrpc/*.pb.cc

# bazel
bazel-app
bazel-bin
bazel-genfiles
bazel-out
bazel-sofa-pbrpc
bazel-testlogs
16 changes: 15 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
language: cpp
compiler: gcc
env:
- PROTOBUF_VERSION=2.6.0
global:
- secure: "dRimnJVfqg6IPK758/R+CDeArbtV4yT387ZgJvJLCnKPKC7CZmtVz4xNH+ZQqFzRCDJBBCkpp/0p7Cq5u4f22d4TaAaGf3gK/2okvyNPCg0DUPvVP2LWzfP5pZSwX4/os5axWUGW6//8HDFWK37lQbuLNx+95m93CJP+3StNKzY="
matrix:
- PROTOBUF_VERSION=2.6.0
before_install:
- echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
install:
- echo | sudo apt-add-repository ppa:boost-latest/ppa
- sudo apt-get update
Expand All @@ -16,3 +21,12 @@ install:
script:
- make -j4 && make install
- make -C unit-test -j4 && cd unit-test && ./run_test.sh
addons:
coverity_scan:
project:
name: "baidu/sofa-pbrpc"
description: "Build submitted via Travis CI"
notification_email: shichengyi@baidu.com
build_command_prepend: "make clean"
build_command: "make -j 4"
branch_pattern: master
79 changes: 79 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
load("@protobuf//:protobuf.bzl", "cc_proto_library")

RELATIVE_WELL_KNOWN_PROTOS = [
"sofa/pbrpc/builtin_service.proto",
"sofa/pbrpc/rpc_meta.proto",
"sofa/pbrpc/rpc_option.proto"
]

WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]

filegroup(
name = "well_known_protos",
srcs = WELL_KNOWN_PROTOS,
visibility = ["//visibility:public"],
)

cc_proto_library(
name = "cc_protos",
srcs = WELL_KNOWN_PROTOS,
include = "src/",
default_runtime = "@protobuf//:protobuf",
protoc = "@protobuf//:protoc",
deps = ["@protobuf//:cc_wkt_protos"],
visibility = ["//visibility:public"]
)

cc_library(
name = "rapidjson",
hdrs = glob(["src/rapidjson/*.h", "src/rapidjson/internal/*.h"]),
srcs = [],
visibility = ["//main:__pkg__"],
)

cc_library(
name = "sofa-pbrpc",
hdrs = glob([
"src/sofa/pbrpc/*.h",
"src/sofa/pbrpc/smart_ptr/*.hpp",
"src/sofa/pbrpc/smart_ptr/detail/*.hpp"
]),
srcs = glob(["src/sofa/pbrpc/*.cc"]),
deps = [
":cc_protos",
":rapidjson",
"@protobuf//:protobuf",
"@protobuf//:protoc_lib",
"@snappy//:snappy",
"@zlib//:zlib",
"@gtest//:gtest",
"@boost//:boost"
],
copts = [
"-Iexternal/googletest/include",
],
visibility = ["//visibility:public"],
)

cc_library(
name = "sofa-pbrpc-client-lib",
hdrs = ["src/sofa/pbrpc/http-agent/http_agent.h"],
srcs = ["src/sofa/pbrpc/http-agent/http_agent.cc"],
deps = [
":sofa-pbrpc",
],
visibility = ["//main:__pkg__"],
)

cc_binary(
name = "sofa-pbrpc-client",
srcs = [
"src/sofa/pbrpc/http-agent/sofa_pbrpc_client.cc",
],
deps = [
":sofa-pbrpc-client-lib",
],
visibility = ["//main:__pkg__"],
)

exports_files(["src/sofa/pbrpc/buffer.cc"], ["//unit-test:__pkg__"])
3 changes: 1 addition & 2 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ Currently, sofa-pbrpc only support x86_64 platform, Linux OS, and GCC.
The default install directory is './output'.
To change it, modify the 'PREFIX' variable in file './Makefile'.

For any build problem, please contact <qinzuoyan01@baidu.com> or
<qinzuoyan@gmail.com>.
For any build problem, please contact <opensearch@baidu.com>.

5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ else
endif
endif

ifndef CXX
CXX=g++
endif

#-----------------------------------------------

CXX=g++
INCPATH=-Isrc -I$(BOOST_HEADER_DIR) -I$(PROTOBUF_DIR)/include -I$(SNAPPY_DIR)/include -I$(ZLIB_DIR)/include
CXXFLAGS += $(OPT) -pipe -W -Wall -fPIC -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -DHAVE_SNAPPY $(INCPATH)

Expand Down
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ Dependings
----------
The lib depends on boost-1.53.0 (only need header), protobuf-2.4.1, snappy and zlib:
boost - http://www.boost.org/
protobuf - http://code.google.com/p/protobuf/
snappy - http://code.google.com/p/snappy/
protobuf - https://github.com/google/protobuf
snappy - https://github.com/google/snappy
zlib - http://zlib.net/

ATTENTION: boost header is only needed when compiling the lib, but no need for user code.

Extrally, './unit-test' and './sample/mock_sample' also depends on gtest:
gtest - http://code.google.com/p/googletest/
gtest - https://github.com/google/googletest

Build
-----
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
sofa-pbrpc
==========
[![Build Status](https://travis-ci.org/baidu/sofa-pbrpc.svg)](https://travis-ci.org/baidu/sofa-pbrpc)
[![Join the chat at https://gitter.im/sofa-pbrpc/rpc](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sofa-pbrpc/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/10957/badge.svg)](https://scan.coverity.com/projects/baidu-sofa-pbrpc)

A light-weight RPC implementation of Google's protobuf RPC framework.

Expand Down Expand Up @@ -44,13 +46,16 @@ Extrally, './unit-test' and './sample/mock_sample' also depends on gtest:
The default install directory is './output'.<br>
To change it, modify the 'PREFIX' variable in file './Makefile'.

For more details, please refer to the wiki.
For more details, please refer to the wiki [Build Guide](https://github.com/baidu/sofa-pbrpc/wiki/%E6%9E%84%E5%BB%BA%E6%8C%87%E5%BC%95).

### Sample
For sample code, please refer to './sample' and the wiki.
For sample code, please refer to ['./sample'](https://github.com/baidu/sofa-pbrpc/tree/master/sample) and the wiki [Quick Start](https://github.com/baidu/sofa-pbrpc/wiki/%E5%BF%AB%E9%80%9F%E4%BD%BF%E7%94%A8).

### Profiling
For Profiling feature, please refer to the wiki [Profiling](https://github.com/baidu/sofa-pbrpc/wiki/Profiling%E5%8A%9F%E8%83%BD).

### Performance
For performace details, please refer to the wiki.
For performace details, please refer to the wiki [Performance](https://github.com/baidu/sofa-pbrpc/wiki/%E6%80%A7%E8%83%BD).

### Implementation
For implementation details, please refer to the wiki and file [doc/sofa-pbrpc-document.md](doc/sofa-pbrpc-document.md).
Expand Down
37 changes: 37 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
git_repository(
name = "protobuf",
remote = "https://github.com/google/protobuf",
tag = "v3.1.0"
)

new_git_repository(
name = "snappy",
remote = "https://github.com/google/snappy",
commit = "32d6d7d8a2ef328a2ee1dd40f072e21f4983ebda", # latest master
build_file = "bazel/snappy.BUILD"
)

new_git_repository(
name = "gtest",
remote = "https://github.com/google/googletest.git",
tag = "release-1.8.0",
build_file = "bazel/gtest.BUILD",
)

new_http_archive(
name = "boost",
url = "https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2/download",
type = "tar.bz2",
strip_prefix = "boost_1_61_0/",
build_file = "bazel/boost.BUILD",
sha256 = "a547bd06c2fd9a71ba1d169d9cf0339da7ebf4753849a8f7d6fdb8feee99b640",
)

new_http_archive(
name = "zlib",
url = "https://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz/download",
type = "tar.gz",
build_file = "bazel/zlib.BUILD",
strip_prefix = "zlib-1.2.8/",
sha256 = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
)
12 changes: 12 additions & 0 deletions bazel/boost.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cc_library(
name = "boost",
srcs = [],
hdrs = glob([
"boost/**/*.h",
"boost/**/*.hpp",
"boost/**/*.ipp",
"boost/**/*.cc",
]),
includes = ["."],
visibility = ["//visibility:public"]
)
15 changes: 15 additions & 0 deletions bazel/gtest.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cc_library(
name = "gtest",
hdrs = glob([
"googletest/include/**/*.h",
"googletest/src/*.h"
]),
srcs = glob(
["googletest/src/*.cc"],
exclude = ["googletest/src/gtest-all.cc"]
),
includes = ["googletest/include", "googletest"],
copts = ["-Iexternal/googletest/include"],
linkopts = ["-pthread"],
visibility = ["//visibility:public"],
)
43 changes: 43 additions & 0 deletions bazel/snappy.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
genrule(
name = "snappy_stubs_public_h",
srcs = [
"snappy-stubs-public.h.in",
],
outs = [
"snappy-stubs-public.h",
],
cmd = "sed 's/@ac_cv_have_stdint_h@/1/g' $(<) | " +
"sed 's/@ac_cv_have_stddef_h@/1/g' | " +
"sed 's/@ac_cv_have_sys_uio_h@/1/g' | " +
"sed 's/@SNAPPY_MAJOR@/1/g' | " +
"sed 's/@SNAPPY_MINOR@/1/g' | " +
"sed 's/@SNAPPY_PATCHLEVEL@/3/g' >$(@)",
)


cc_library(
name = "snappy",
srcs = [
"snappy.cc",
"snappy-c.cc",
"snappy-sinksource.cc",
"snappy-stubs-internal.cc",
],
hdrs = [
":snappy_stubs_public_h",
"snappy.h",
"snappy-c.h",
"snappy-internal.h",
"snappy-sinksource.h",
"snappy-stubs-internal.h",
"snappy-stubs-public.h.in",
],
copts = [
"-Wno-non-virtual-dtor",
"-Wno-unused-variable",
"-Wno-implicit-fallthrough",
"-Wno-unused-function",
],
includes = ["."],
visibility = ["//visibility:public"],
)
39 changes: 39 additions & 0 deletions bazel/zlib.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cc_library(
name = "zlib",
srcs = [
"adler32.c",
"compress.c",
"crc32.c",
"deflate.c",
"gzclose.c",
"gzlib.c",
"gzread.c",
"gzwrite.c",
"infback.c",
"inffast.c",
"inflate.c",
"inftrees.c",
"trees.c",
"uncompr.c",
"zutil.c",
],
hdrs = [
"crc32.h",
"deflate.h",
"gzguts.h",
"inffast.h",
"inffixed.h",
"inflate.h",
"inftrees.h",
"trees.h",
"zconf.h",
"zlib.h",
"zutil.h",
],
copts = [
"-Wno-unused-variable",
"-Wno-implicit-function-declaration",
"-Wno-shift-negative-value",
],
visibility = ["//visibility:public"]
)
Loading

0 comments on commit 97f7d26

Please sign in to comment.