Skip to content

Commit

Permalink
switch brpc dependency in bzlmod to bcr
Browse files Browse the repository at this point in the history
  • Loading branch information
oathdruid committed Oct 17, 2024
1 parent 48e058b commit e477f40
Show file tree
Hide file tree
Showing 19 changed files with 93 additions and 34 deletions.
3 changes: 0 additions & 3 deletions example/anyflow/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
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++17
2 changes: 1 addition & 1 deletion example/anyflow/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.1
7.3.2
2 changes: 1 addition & 1 deletion example/anyflow/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bazel_dep(name = 'babylon', version = '1.3.2')
bazel_dep(name = 'babylon', version = '1.4.0')
3 changes: 0 additions & 3 deletions example/depend-use-bzlmod/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
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++17
2 changes: 1 addition & 1 deletion example/depend-use-bzlmod/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.1
7.3.2
2 changes: 1 addition & 1 deletion example/depend-use-bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bazel_dep(name = 'babylon', version = '1.3.2')
bazel_dep(name = 'babylon', version = '1.4.0')
6 changes: 2 additions & 4 deletions example/depend-use-bzlmod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
```
# in .bazelrc
# babylon自身发布在独立注册表
common --registry=https://bcr.bazel.build
common --registry=https://baidu.github.io/babylon/registry
# babylon依赖的boost发布在bazelboost项目的注册表,当然如果有其他源可以提供boost的注册表也可以替换
# 只要同样能够提供boost.preprocessor和boost.spirit模块寻址即可
common --registry=https://raw.githubusercontent.com/bazelboost/registry/main
```

- 增加依赖项
```
# in MODULE.bazel
bazel_dep(name = 'babylon', version = '1.3.2')
bazel_dep(name = 'babylon', version = '1.4.0')
```

- 添加依赖的子模块到编译目标,全部可用子模块可以参照[模块功能文档](../../README.md#模块功能文档),或者[BUILD](../../BUILD)文件,也可以直接添加All in One依赖目标`@babylon`
Expand Down
4 changes: 2 additions & 2 deletions example/depend-use-cmake-fetch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set(BUILD_DEPS ON)
include(FetchContent)
FetchContent_Declare(
babylon
URL "https://github.com/baidu/babylon/archive/refs/tags/v1.3.2.tar.gz"
URL_HASH SHA256=11b13bd89879e9f563dfc438a60f7d03724e2a476e750088c356b2eb6b73597e
URL "https://github.com/baidu/babylon/archive/refs/tags/v1.4.0.tar.gz"
URL_HASH SHA256=12722ca7ddd698dca118a522a220b12f870178fcad98b78f0f6604cd0903d292
)
FetchContent_MakeAvailable(babylon)

Expand Down
4 changes: 2 additions & 2 deletions example/depend-use-cmake-fetch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ set(BUILD_DEPS ON)
include(FetchContent)
FetchContent_Declare(
babylon
URL "https://github.com/baidu/babylon/archive/refs/tags/v1.3.2.tar.gz"
URL_HASH SHA256=11b13bd89879e9f563dfc438a60f7d03724e2a476e750088c356b2eb6b73597e
URL "https://github.com/baidu/babylon/archive/refs/tags/v1.4.0.tar.gz"
URL_HASH SHA256=12722ca7ddd698dca118a522a220b12f870178fcad98b78f0f6604cd0903d292
)
FetchContent_MakeAvailable(babylon)
```
Expand Down
6 changes: 3 additions & 3 deletions example/depend-use-cmake-find/build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh
set -ex

URL=https://github.com/baidu/babylon/archive/refs/tags/v1.3.2.tar.gz
NAME=babylon-1.3.2
SHA256=11b13bd89879e9f563dfc438a60f7d03724e2a476e750088c356b2eb6b73597e
URL=https://github.com/baidu/babylon/archive/refs/tags/v1.4.0.tar.gz
NAME=babylon-1.4.0
SHA256=12722ca7ddd698dca118a522a220b12f870178fcad98b78f0f6604cd0903d292
if ! echo "$SHA256 $NAME.tar.gz" | sha256sum -c; then
wget $URL --continue -O $NAME.tar.gz
fi
Expand Down
6 changes: 3 additions & 3 deletions example/depend-use-cmake-subdir/build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh
set -ex

URL=https://github.com/baidu/babylon/archive/refs/tags/v1.3.2.tar.gz
NAME=babylon-1.3.2
SHA256=11b13bd89879e9f563dfc438a60f7d03724e2a476e750088c356b2eb6b73597e
URL=https://github.com/baidu/babylon/archive/refs/tags/v1.4.0.tar.gz
NAME=babylon-1.4.0
SHA256=12722ca7ddd698dca118a522a220b12f870178fcad98b78f0f6604cd0903d292
if ! echo "$SHA256 $NAME.tar.gz" | sha256sum -c; then
wget $URL --continue -O $NAME.tar.gz
fi
Expand Down
5 changes: 1 addition & 4 deletions example/use-anyflow-with-brpc/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
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++17
common --registry=file:///home/oathdruid/src/babylon/registry
2 changes: 1 addition & 1 deletion example/use-anyflow-with-brpc/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.1
7.3.2
4 changes: 2 additions & 2 deletions example/use-anyflow-with-brpc/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bazel_dep(name = 'babylon', version = '1.3.2')
bazel_dep(name = 'brpc', version = '1.9.0')
bazel_dep(name = 'babylon', version = '1.4.0')
bazel_dep(name = 'brpc', version = '1.10.0.bcr.1')
bazel_dep(name = 'yaml-cpp', version = '0.8.0')
3 changes: 1 addition & 2 deletions example/use-arena-with-brpc/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
common --registry=https://bcr.bazel.build
common --registry=https://baidu.github.io/babylon/registry
common --registry=https://raw.githubusercontent.com/bazelboost/registry/main

build --compilation_mode=opt --copt=-O3 --cxxopt=-std=c++17
build --compilation_mode=opt --copt=-O3
2 changes: 1 addition & 1 deletion example/use-arena-with-brpc/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.1
7.3.2
31 changes: 31 additions & 0 deletions registry/modules/brpc/1.10.0.bcr.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module(
name = 'brpc',
version = '1.10.0.bcr.1',
compatibility_level = 1,
)

# --registry=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')

# --registry=https://baidu.github.io/babylon/registry
bazel_dep(name = 'leveldb', version = '1.23', repo_name = 'com_github_google_leveldb')
bazel_dep(name = 'openssl', version = '3.3.2')
bazel_dep(name = 'thrift', version = '0.21.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)
bazel_dep(name = 'hedron_compile_commands', dev_dependency = True)
git_override(
module_name = 'hedron_compile_commands',
remote = 'https://github.com/hedronvision/bazel-compile-commands-extractor.git',
commit = '1e08f8e0507b6b6b1f4416a9a22cf5c28beaba93', # Jun 28, 2024
)
31 changes: 31 additions & 0 deletions registry/modules/brpc/1.10.0.bcr.1/patches/osx-darwin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/BUILD.bazel b/BUILD.bazel
index b2a453e0..795e392e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -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",
@@ -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",
],
@@ -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"],
9 changes: 9 additions & 0 deletions registry/modules/brpc/1.10.0.bcr.1/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"url": "https://github.com/apache/brpc/archive/refs/tags/1.10.0.tar.gz",
"strip_prefix": "brpc-1.10.0",
"integrity": "sha256-/k6xC0yhpZ4PcQhlUrLYiXr9Zt+TtTwYrYP2qTcXzC0=",
"patch_strip": 1,
"patches": {
"osx-darwin.patch": "sha256-HhiWH/lqS3TLLzHDJ5aPrEM9m6qXuUncIKRv5ii8zC4="
}
}

0 comments on commit e477f40

Please sign in to comment.