Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
#
# Default build options. These are applied first and unconditionally.
#
common --registry=https://bcr.bazel.build
common --registry=https://baidu.github.io/babylon/registry
common --registry=https://raw.githubusercontent.com/bazelboost/registry/main

build --cxxopt="-std=c++11"
build --cxxopt="-std=c++17"
# Use gnu11 for asm keyword.
build --conlyopt="-std=gnu11"
build --conlyopt="-std=gnu17"

# Enable position independent code (this is the default on macOS and Windows)
# (Workaround for https://github.com/bazelbuild/rules_foreign_cc/issues/421)
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.2
7.1.2
52 changes: 6 additions & 46 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: install dependences
run: |
sudo apt-get update
sudo apt-get install libibverbs-dev
- name: compile
run: |
export CC=gcc && export CXX=g++
bazel build -j ${{env.proc_num}} -c opt --copt -DHAVE_ZLIB=1 //...
- run: bazel test --verbose_failures -- //... -//example/...

gcc-compile-with-boringssl:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: install dependences
run: |
sudo apt-get update
sudo apt-get install libibverbs-dev
- name: compile-with-boringssl
run: |
bazel build -j 12 -c opt --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true --copt -DHAVE_ZLIB=1 //...
- run: bazel test --verbose_failures --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true -- //... -//example/...

gcc-compile-with-make-all-options:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -99,14 +86,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: install dependences
run: |
sudo apt-get update
sudo apt-get install libibverbs-dev
- name: compile
run: |
export CC=gcc && export CXX=g++
bazel build -j 12 -c opt --define with_mesalink=false --define with_glog=true --define with_thrift=true --copt -DHAVE_ZLIB=1 //...
- run: bazel test --verbose_failures --define with_mesalink=false --define with_glog=true --define with_thrift=true -- //... -//example/...

clang-compile-with-make:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -140,26 +120,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: install dependences
run: |
sudo apt-get update
sudo apt-get install libibverbs-dev
- name: compile
run: |
export CC=clang && export CXX=clang++
bazel build -j ${{env.proc_num}} -c opt --copt -DHAVE_ZLIB=1 //...
- run: bazel build --verbose_failures --action_env=CC=clang-12 -- //... -//example/...

clang-compile-with-boringssl:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: install dependences
run: |
sudo apt-get update
sudo apt-get install libibverbs-dev
- name: compile
run: |
bazel build -j ${{env.proc_num}} -c opt --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true --copt -DHAVE_ZLIB=1 //...
- run: bazel build --verbose_failures --action_env=CC=clang-12 --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true -- //... -//example/...

clang-compile-with-make-all-options:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -193,14 +160,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: install dependences
run: |
sudo apt-get update
sudo apt-get install libibverbs-dev
- name: compile
run: |
export CC=clang && export CXX=clang++
bazel build -j ${{env.proc_num}} -c opt --define with_mesalink=false --define with_glog=true --define with_thrift=true --copt -DHAVE_ZLIB=1 //...
- run: bazel build --verbose_failures --action_env=CC=clang-12 --define with_mesalink=false --define with_glog=true --define with_thrift=true -- //... -//example/...

clang-unittest:
runs-on: ubuntu-20.04
Expand Down
6 changes: 3 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ LINKOPTS = [
"-pthread",
"-ldl",
] + select({
"@bazel_tools//tools/osx:darwin": [
"@bazel_tools//tools/osx:darwin_x86_64": [
"-framework CoreFoundation",
"-framework CoreGraphics",
"-framework CoreData",
Expand Down Expand Up @@ -218,7 +218,7 @@ BUTIL_SRCS = [
"src/butil/recordio.cc",
"src/butil/popen.cpp",
] + select({
"@bazel_tools//tools/osx:darwin": [
"@bazel_tools//tools/osx:darwin_x86_64": [
"src/butil/time/time_mac.cc",
"src/butil/mac/scoped_mach_port.cc",
],
Expand Down Expand Up @@ -333,7 +333,7 @@ cc_library(
"//bazel/config:brpc_with_glog": ["@com_github_google_glog//:glog"],
"//conditions:default": [],
}) + select({
"@bazel_tools//tools/osx:darwin": [":macos_lib"],
"@bazel_tools//tools/osx:darwin_x86_64": [":macos_lib"],
"//conditions:default": [],
}) + select({
"//bazel/config:brpc_with_boringssl": ["@boringssl//:ssl", "@boringssl//:crypto"],
Expand Down
26 changes: 26 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module(
name = 'brpc',
version = '1.9.0',
compatibility_level = 1,
)

# https://bcr.bazel.build
bazel_dep(name = 'abseil-cpp', version = '20210324.2', repo_name = 'com_google_absl')
bazel_dep(name = 'bazel_skylib', version = '1.0.3')
bazel_dep(name = 'boringssl', version = '0.0.0-20211025-d4f1ab9')
bazel_dep(name = 'protobuf', version = '3.19.6', repo_name = 'com_google_protobuf')
bazel_dep(name = 'gflags', version = '2.2.2', repo_name = 'com_github_gflags_gflags')
bazel_dep(name = 'glog', version = '0.5.0', repo_name = 'com_github_google_glog')
bazel_dep(name = 'platforms', version = '0.0.4')
bazel_dep(name = 'rules_cc', version = '0.0.1')
bazel_dep(name = 'rules_proto', version = '4.0.0')
bazel_dep(name = 'zlib', version = '1.2.13', repo_name = 'com_github_madler_zlib')

# https://baidu.github.io/babylon/registry
# https://raw.githubusercontent.com/bazelboost/registry/main
bazel_dep(name = 'leveldb', version = '1.23', repo_name = 'com_github_google_leveldb')
bazel_dep(name = 'openssl', version = '3.3.1')
bazel_dep(name = 'thrift', version = '0.20.0', repo_name = 'org_apache_thrift')

# test only
bazel_dep(name = 'googletest', version = '1.14.0.bcr.1', repo_name = 'com_google_googletest', dev_dependency = True)
15 changes: 15 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

#
# Tools Dependencies
#
# Hedron's Compile Commands Extractor for Bazel
# https://github.com/hedronvision/bazel-compile-commands-extractor
http_archive(
name = "hedron_compile_commands",
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/3dddf205a1f5cde20faf2444c1757abe0564ff4c.tar.gz",
strip_prefix = "bazel-compile-commands-extractor-3dddf205a1f5cde20faf2444c1757abe0564ff4c",
sha256 = "3cd0e49f0f4a6d406c1d74b53b7616f5e24f5fd319eafc1bf8eee6e14124d115",
)
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
hedron_compile_commands_setup()
6 changes: 2 additions & 4 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ COPTS = [
"-Wno-unused-parameter",
"-fno-omit-frame-pointer",
"-DGFLAGS_NS=google",
"-Dprivate=public",
"-Dprotected=public",
"--include test/sstream_workaround.h",
"-fno-access-control",
"-DBAZEL_TEST=1",
"-DBVAR_NOT_LINK_DEFAULT_VARIABLES",
"-DUNIT_TEST",
Expand Down Expand Up @@ -142,7 +140,7 @@ TEST_BUTIL_SOURCES = [
"bounded_queue_unittest.cc",
"butil_unittest_main.cpp",
] + select({
"@bazel_tools//tools/osx:darwin": [],
"@bazel_tools//tools/osx:darwin_x86_64": [],
"//conditions:default": [
"test_file_util_linux.cc",
"proc_maps_linux_unittest.cc",
Expand Down
3 changes: 2 additions & 1 deletion test/thread_key_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ void* ThreadLocalForEachFunc(void* arg) {
auto counter = static_cast<ThreadLocal<butil::atomic<int>>*>(arg);
auto local_counter = counter->get();
EXPECT_NE(nullptr, local_counter);
local_counter->store(0, butil::memory_order_relaxed);
while (!g_stopped) {
local_counter->fetch_add(1, butil::memory_order_relaxed);
g_counter.fetch_add(1, butil::memory_order_relaxed);
Expand Down Expand Up @@ -497,4 +498,4 @@ TEST(ThreadLocalTest, thread_key_performance) {
}

}
} // namespace butil
} // namespace butil