-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add bazel third_party support #1996
Conversation
docs/cn/bazel_support.md
Outdated
@@ -0,0 +1,14 @@ | |||
## bRPC 作为Bazel第三方依赖 | |||
1. bRPC 依赖于一些开源库, 但这些库并没有提供bazel支持, 所以需要你手动将一部分依赖加入到你的构建项目中. | |||
2. 将 /example/bazel_1_3_release/build_for_brpc 该文件移动到你的项目根目录下, 将 /example/bazel_1_3_release/build_for_brpc/WORKSPACE_eample 内容添加到你的WORKSPACE中. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eample -> example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eample -> example
🥲 fixed.
docs/en/bazel_support.md
Outdated
@@ -0,0 +1,14 @@ | |||
## bRPC as a Bazel third-party dependency | |||
1. bRPC relies on a number of open source libraries that do not provide bazel support, so you will need to manually add some of these dependencies to your build project. | |||
2. Move the file /example/bazel_1_3_release/build_for_brpc to the root of your project, and add the contents of /example/bazel_1_3_release/build_for_brpc/WORKSPACE_eample to your WORKSPACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eample -> example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eample -> example
fixed.
) | ||
|
||
|
||
BAZEL_SKYLIB_VERSION = "1.1.1" # 2021-09-27T17:33:49Z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated with line 23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated with line 23
fixed.
|
||
BAZEL_SKYLIB_VERSION = "1.1.1" # 2021-09-27T17:33:49Z | ||
|
||
BAZEL_SKYLIB_SHA256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated with line 25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated with line 25
fixed.
|
||
|
||
http_archive( | ||
name = "bazel_skylib", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated with line 29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contributor
fixed.
#include <bthread/execution_queue.h> | ||
|
||
int main () { | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may call some bthread function here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may call some bthread function here
should we need a test? the BUILD add a empty test here.
docs/cn/bazel_support.md
Outdated
@@ -0,0 +1,14 @@ | |||
## bRPC 作为Bazel第三方依赖 | |||
1. bRPC 依赖于一些开源库, 但这些库并没有提供bazel支持, 所以需要你手动将一部分依赖加入到你的构建项目中. | |||
2. 将 /example/bazel_1_3_release/build_for_brpc 该文件移动到你的项目根目录下, 将 /example/bazel_1_3_release/build_for_brpc/WORKSPACE_eample 内容添加到你的WORKSPACE中. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may change the directory name from bazel_1_3_release
to build_with_bazel
since there is an existing directory named build_with_old_bazel
And you can follow the directory structure of build_with_old_bazel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
CI is failed |
maybe it is the test failed. |
cbf2b2a
to
538ff1d
Compare
docs/cn/bazel_support.md
Outdated
@@ -0,0 +1,14 @@ | |||
## bRPC 作为Bazel第三方依赖 | |||
1. bRPC 依赖于一些开源库, 但这些库并没有提供bazel支持, 所以需要你手动将一部分依赖加入到你的构建项目中. | |||
2. 将 /example/build_with_bazel/build_for_brpc 该文件移动到你的项目根目录下, 将 /example/build_with_bazel/build_for_brpc/WORKSPACE_example 内容添加到你的WORKSPACE中. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build_for_brpc/WORKSPACE_example
this path does not exist now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed and add a test for it. test is successfull run.
docs/cn/bazel_support.md
Outdated
@@ -0,0 +1,14 @@ | |||
## bRPC 作为Bazel第三方依赖 | |||
1. bRPC 依赖于一些开源库, 但这些库并没有提供bazel支持, 所以需要你手动将一部分依赖加入到你的构建项目中. | |||
2. 将 /example/build_with_bazel/build_for_brpc 该文件移动到你的项目根目录下, 将 /example/build_with_bazel/build_for_brpc/WORKSPACE 内容添加到你的WORKSPACE中. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove /build_for_brpc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
/build_for_brpc
fixed.
example/BUILD.bazel
Outdated
) | ||
|
||
config_setting( | ||
name = "have_rdma", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面有个 //bazel/config:brpc_with_rdma
看能直接复用吗?
LGTM |
Does it support MacOS? |
I do not have Mac laptop, you can try it? |
Ok, I will try it later. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could brpc_workspace
be applied to BRPC WORKSPACE?
native.new_local_repository( | ||
name = "openssl", | ||
path = "/usr", | ||
build_file = "//:openssl.BUILD", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//:openssl.BUILD
actually links to openssl on the system. While openssl in BRPC WORKSPACE is compiled by foreign_rules.
It's better to keep the same with that in BRPC WORKSPACE
So brpc_workspace.bzl is different from the original WORKSPACE
file. Could brpc_workspace
be used by WORKSPACE
in BRPC as well to maintain a consistent WORKSPACE
?
@Huixxi Have you test successful in cd example/build_with_bazel
bazel build "..."
./bazel-bin/test Try this? |
name = "openssl", | ||
path = "/usr", | ||
http_archive( | ||
name = "openssl", # 2021-12-14T15:45:01Z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example/build_with_bazel/openssl.BUILD
does not build but links to system installed openssl.
Here is the real build:
https://github.com/apache/incubator-brpc/blob/fae30e6a9a84ef8c2e0bfe1ce23afa5611a1ffab/bazel/third_party/openssl/openssl.BUILD#L132
3109a27
to
d353752
Compare
Hi, What's the status on it? Could you update the latest code? |
In fact, this is ok. I have tried some other methods, but none of them seem very elegant. So I thinks it can be merged. 😢 |
Any chance to support protobuf 3.21.9 Simply change the protobuf version got this error message ERROR: brpc/example/BUILD.bazel:40:14: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: error loading package '@com_google_protobuf//': cannot load '@com_google_protobuf//:compiler_config_setting.bzl': no such file |
|
What problem does this PR solve?
Issue Number: #1992 #1918
Problem Summary: bRPC as thirdparty deps is not easy.
What is changed and the side effects?
Changed: I add a example about 1.3 release how to add bRPC to your project and some about this docs.
I have test in my docker debian9 server. bazel version = 4.2.2
and i have test link @apache_brpc:bthread, bvar, butil, brpc all of them are successful.
Side effects:
Performance effects(性能影响): null
Breaking backward compatibility(向后兼容性): null
Check List: