From 08603f5fb0f4825b7297a7f60d7534a571e5fc0d Mon Sep 17 00:00:00 2001 From: Yinxiu Jia <48558845+kenneth-jia@users.noreply.github.com> Date: Mon, 11 Apr 2022 14:58:56 +0800 Subject: [PATCH] Improve for Bazel deps --- BUILD => BUILD.bazel | 2 +- customrules/{BUILD => BUILD.bazel} | 0 examples/{BUILD => BUILD.bazel} | 10 ++++++++++ tests/{BUILD => BUILD.bazel} | 6 ++++++ tools/{BUILD => BUILD.bazel} | 6 +++--- 5 files changed, 20 insertions(+), 4 deletions(-) rename BUILD => BUILD.bazel (81%) rename customrules/{BUILD => BUILD.bazel} (100%) rename examples/{BUILD => BUILD.bazel} (82%) rename tests/{BUILD => BUILD.bazel} (90%) rename tools/{BUILD => BUILD.bazel} (69%) diff --git a/BUILD b/BUILD.bazel similarity index 81% rename from BUILD rename to BUILD.bazel index e26b83f60..5e4db2020 100644 --- a/BUILD +++ b/BUILD.bazel @@ -5,7 +5,7 @@ cc_library( includes = ["include"], - linkopts = ["-lpthread", "-lrdkafka"], + linkopts = ["-lpthread"], visibility = ["//visibility:public"], ) diff --git a/customrules/BUILD b/customrules/BUILD.bazel similarity index 100% rename from customrules/BUILD rename to customrules/BUILD.bazel diff --git a/examples/BUILD b/examples/BUILD.bazel similarity index 82% rename from examples/BUILD rename to examples/BUILD.bazel index be0f731ce..19e6dc412 100644 --- a/examples/BUILD +++ b/examples/BUILD.bazel @@ -3,6 +3,8 @@ cc_binary( srcs = ["kafka_sync_producer.cc"], + linkopts = ["-lrdkafka"], + deps = ["//:modern-cpp-kafka-api"], ) @@ -11,6 +13,8 @@ cc_binary( srcs = ["kafka_async_producer_copy_payload.cc"], + linkopts = ["-lrdkafka"], + deps = ["//:modern-cpp-kafka-api"], ) @@ -19,6 +23,8 @@ cc_binary( srcs = ["kafka_async_producer_not_copy_payload.cc"], + linkopts = ["-lrdkafka"], + deps = ["//:modern-cpp-kafka-api"], ) @@ -27,6 +33,8 @@ cc_binary( srcs = ["kafka_auto_commit_consumer.cc"], + linkopts = ["-lrdkafka"], + deps = ["//:modern-cpp-kafka-api"], ) @@ -35,6 +43,8 @@ cc_binary( srcs = ["kafka_manual_commit_consumer.cc"], + linkopts = ["-lrdkafka"], + deps = ["//:modern-cpp-kafka-api"], ) diff --git a/tests/BUILD b/tests/BUILD.bazel similarity index 90% rename from tests/BUILD rename to tests/BUILD.bazel index f23e6528f..5e1ccfaf2 100644 --- a/tests/BUILD +++ b/tests/BUILD.bazel @@ -8,6 +8,8 @@ cc_test( "@gtest//:gtest_main", "@rapidjson//:rapidjson"], + linkopts = ["-lrdkafka"], + timeout = "short", tags = ["unit"], @@ -23,6 +25,8 @@ cc_test( "@gtest//:gtest", "@gtest//:gtest_main"], + linkopts = ["-lrdkafka"], + timeout = "long", shard_count = 8, @@ -38,6 +42,8 @@ cc_test( "@gtest//:gtest", "@gtest//:gtest_main"], + linkopts = ["-lrdkafka"], + timeout = "long", shard_count = 1, diff --git a/tools/BUILD b/tools/BUILD.bazel similarity index 69% rename from tools/BUILD rename to tools/BUILD.bazel index 3398993bc..c798b2882 100644 --- a/tools/BUILD +++ b/tools/BUILD.bazel @@ -3,7 +3,7 @@ cc_binary( srcs = ["KafkaTopics.cc"], - linkopts = ["-lboost_program_options"], + linkopts = ["-lboost_program_options", "-lrdkafka"], deps = ["//:modern-cpp-kafka-api"], ) @@ -13,7 +13,7 @@ cc_binary( srcs = ["KafkaConsoleConsumer.cc"], - linkopts = ["-lboost_program_options"], + linkopts = ["-lboost_program_options", "-lrdkafka"], deps = ["//:modern-cpp-kafka-api"], ) @@ -23,7 +23,7 @@ cc_binary( srcs = ["KafkaConsoleProducer.cc"], - linkopts = ["-lboost_program_options"], + linkopts = ["-lboost_program_options", "-lrdkafka"], deps = ["//:modern-cpp-kafka-api"], )