Restrict visibility and add target for C++ benchmark

pull/7744/head
Yannic Bonenberger 4 years ago
parent c5abd97e36
commit ef70abad8a
  1. 9
      WORKSPACE
  2. 24
      benchmarks/BUILD
  3. 15
      benchmarks/cpp/BUILD
  4. 16
      benchmarks/datasets/BUILD

@ -17,6 +17,15 @@ http_archive(
], ],
) )
http_archive(
name = "com_github_google_benchmark",
sha256 = "2a778d821997df7d8646c9c59b8edb9a573a6e04c534c01892a40aa524a7b68c",
strip_prefix = "benchmark-bf585a2789e30585b4e3ce6baf11ef2750b54677",
urls = [
"https://github.com/google/benchmark/archive/bf585a2789e30585b4e3ce6baf11ef2750b54677.zip",
],
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:protobuf_deps.bzl", "protobuf_deps") load("//:protobuf_deps.bzl", "protobuf_deps")

@ -8,12 +8,16 @@ proto_library(
"benchmarks.proto", "benchmarks.proto",
], ],
strip_import_prefix = "/benchmarks", strip_import_prefix = "/benchmarks",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
) )
cc_proto_library( cc_proto_library(
name = "benchmarks_cc_proto", name = "benchmarks_cc_proto",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
deps = [ deps = [
"benchmarks_proto", "benchmarks_proto",
], ],
@ -21,7 +25,9 @@ cc_proto_library(
java_proto_library( java_proto_library(
name = "benchmarks_java_proto", name = "benchmarks_java_proto",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
deps = [ deps = [
"benchmarks_proto", "benchmarks_proto",
], ],
@ -33,12 +39,16 @@ proto_library(
"google_size.proto", "google_size.proto",
], ],
strip_import_prefix = "/benchmarks", strip_import_prefix = "/benchmarks",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
) )
cc_proto_library( cc_proto_library(
name = "google_size_cc_proto", name = "google_size_cc_proto",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
deps = [ deps = [
"google_size_proto", "google_size_proto",
], ],
@ -46,7 +56,9 @@ cc_proto_library(
java_proto_library( java_proto_library(
name = "google_size_java_proto", name = "google_size_java_proto",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
deps = [ deps = [
"google_size_proto", "google_size_proto",
], ],

@ -0,0 +1,15 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
cc_binary(
name = "cpp",
srcs = [
"cpp_benchmark.cc",
],
tags = ["benchmark"],
deps = [
"//:protobuf",
"//benchmarks:benchmarks_cc_proto",
"//benchmarks/datasets:cc_protos",
"@com_github_google_benchmark//:benchmark_main",
],
)

@ -11,12 +11,16 @@ filegroup(
"//benchmarks/datasets/google_message3:datasets", "//benchmarks/datasets/google_message3:datasets",
"//benchmarks/datasets/google_message4:datasets", "//benchmarks/datasets/google_message4:datasets",
], ],
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
) )
proto_library( proto_library(
name = "protos", name = "protos",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
deps = [ deps = [
"//benchmarks/datasets/google_message1/proto2:benchmark_message1_proto2_proto", "//benchmarks/datasets/google_message1/proto2:benchmark_message1_proto2_proto",
"//benchmarks/datasets/google_message1/proto3:benchmark_message1_proto3_proto", "//benchmarks/datasets/google_message1/proto3:benchmark_message1_proto3_proto",
@ -28,7 +32,9 @@ proto_library(
cc_library( cc_library(
name = "cc_protos", name = "cc_protos",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
deps = [ deps = [
"//benchmarks/datasets/google_message1/proto2:benchmark_message1_proto2_cc_proto", "//benchmarks/datasets/google_message1/proto2:benchmark_message1_proto2_cc_proto",
"//benchmarks/datasets/google_message1/proto3:benchmark_message1_proto3_cc_proto", "//benchmarks/datasets/google_message1/proto3:benchmark_message1_proto3_cc_proto",
@ -40,7 +46,9 @@ cc_library(
java_library( java_library(
name = "java_protos", name = "java_protos",
visibility = ["//visibility:public"], visibility = [
"//benchmarks:__subpackages__",
],
exports = [ exports = [
"//benchmarks/datasets/google_message1/proto2:benchmark_message1_proto2_java_proto", "//benchmarks/datasets/google_message1/proto2:benchmark_message1_proto2_java_proto",
"//benchmarks/datasets/google_message1/proto3:benchmark_message1_proto3_java_proto", "//benchmarks/datasets/google_message1/proto3:benchmark_message1_proto3_java_proto",

Loading…
Cancel
Save