Skip to content

Commit

Permalink
Update pulsar (#1824)
Browse files Browse the repository at this point in the history
* Update pulsar

* Fix

* Fix

* Fix
  • Loading branch information
yongtang authored Aug 4, 2023
1 parent 2f72c82 commit 59e8d21
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 27 deletions.
11 changes: 3 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -742,15 +742,10 @@ http_archive(
http_archive(
name = "pulsar",
build_file = "//third_party:pulsar.BUILD",
patch_cmds = [
"cp pulsar-common/src/main/proto/PulsarApi.proto pulsar-client-cpp/lib",
"sed -i.bak 's/define PULSAR_DEFINES_H_/define PULSAR_DEFINES_H_\\'$'\\n''#if defined(_MSC_VER)\\'$'\\n''#include <Windows.h>\\'$'\\n''#undef ERROR\\'$'\\n''#endif/g' pulsar-client-cpp/include/pulsar/defines.h",
"sed -i.bak 's/define LIB_ACKGROUPINGTRACKER_H_/define LIB_ACKGROUPINGTRACKER_H_\\'$'\\n''#include <pulsar\\/defines.h>/g' pulsar-client-cpp/lib/AckGroupingTracker.h",
],
sha256 = "08f19ca6d6353751ff0661403b16b71425bf7ada3d8835a38e426ae303b0e385",
strip_prefix = "pulsar-2.6.1",
sha256 = "be97723dbba43045506f877cbc7600d2efe74264eace980933ae42b387069bc3",
strip_prefix = "pulsar-client-cpp-3.3.0",
urls = [
"https://github.com/apache/pulsar/archive/v2.6.1.tar.gz",
"https://github.com/apache/pulsar-client-cpp/archive/refs/tags/v3.3.0.tar.gz",
],
)

Expand Down
61 changes: 42 additions & 19 deletions third_party/pulsar.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports_files(["LICENSE"])

proto_library(
name = "PulsarApi_proto",
srcs = ["pulsar-client-cpp/lib/PulsarApi.proto"],
srcs = ["proto/PulsarApi.proto"],
)

cc_proto_library(
Expand All @@ -17,20 +17,34 @@ cc_proto_library(

cc_library(
name = "pulsar",
srcs = glob([
"pulsar-client-cpp/include/pulsar/*.h",
"pulsar-client-cpp/lib/*.h",
"pulsar-client-cpp/lib/*.cc",
"pulsar-client-cpp/lib/auth/**/*.h",
"pulsar-client-cpp/lib/auth/**/*.cc",
# lz4 is imported in another package, so we just add the header here
"pulsar-client-cpp/lib/lz4/*.h",
"pulsar-client-cpp/lib/checksum/*.h",
"pulsar-client-cpp/lib/checksum/*.hpp",
"pulsar-client-cpp/lib/checksum/*.cc",
"pulsar-client-cpp/lib/stats/*.h",
"pulsar-client-cpp/lib/stats/*.cc",
]),
srcs = glob(
[
"include/pulsar/*.h",
"lib/*.h",
"lib/*.cc",
"lib/auth/**/*.h",
"lib/auth/**/*.cc",
"lib/lz4/*.h",
"lib/lz4/*.cc",
"lib/checksum/*.h",
"lib/checksum/*.hpp",
"lib/checksum/*.cc",
"lib/stats/*.h",
"lib/stats/*.cc",
],
exclude = [
"lib/checksum/crc32c_sse42.cc",
],
) + select({
"@platforms//cpu:x86_64": [
"lib/checksum/crc32c_sse42.cc",
],
"//conditions:default": [],
}),
hdrs = [
# declare header from above genrule
"include/pulsar/Version.h",
],
copts = select({
"@platforms//cpu:x86_64": [
"-msse4.2",
Expand All @@ -39,14 +53,13 @@ cc_library(
"//conditions:default": [],
}),
defines = [
"_PULSAR_VERSION_=\\\"2.6.1\\\"",
"WIN32_LEAN_AND_MEAN",
"PULSAR_STATIC",
],
includes = [
"pulsar-client-cpp",
"pulsar-client-cpp/include",
"pulsar-client-cpp/lib",
"include",
"lib",
"proto",
],
visibility = ["//visibility:public"],
deps = [
Expand All @@ -63,3 +76,13 @@ cc_library(
"//conditions:default": [],
}),
)

genrule(
name = "Version_h",
srcs = ["templates/Version.h.in"],
outs = ["include/pulsar/Version.h"],
cmd = ("sed " +
"-e 's/@PULSAR_CLIENT_VERSION_MACRO@/3003000/g' " +
"-e 's/@PULSAR_CLIENT_VERSION@/3.3.0/g' " +
"$< >$@"),
)

0 comments on commit 59e8d21

Please sign in to comment.