Skip to content

Commit

Permalink
feat: first attempt bzlmod support
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Jun 14, 2024
1 parent 3294aa8 commit ec43200
Show file tree
Hide file tree
Showing 77 changed files with 282 additions and 252 deletions.
2 changes: 2 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ cmake-build-debug/
cmake-build-coverage/
cmake-build-release/
.build/
external/
examples/
5 changes: 1 addition & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ build --experimental_convenience_symlinks=ignore
# frustrating when they fail and don't give any output. So, remove the limit.
build --experimental_ui_max_stdouterr_bytes=-1

# TODO(#11485) - enable bzlmod once it works
common --noenable_bzlmod

# TODO(#13311) - remove once gRPC works with Bazel v7 or when gRPC stops using
# `apple_rules`.
common:macos --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1
Expand All @@ -52,7 +49,7 @@ common:macos --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1
test --test_env=GTEST_SHUFFLE --test_env=GTEST_RANDOM_SEED

# By default, build the library with OpenTelemetry
build --@io_opentelemetry_cpp//api:with_abseil
build --@opentelemetry-cpp//api:with_abseil
build --//:enable_opentelemetry

# Don't show warnings when building external dependencies. This still shows
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.0
7.2.0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cmake-out/
/bazel-*
/google/cloud/*/quickstart/bazel-*
!bazel-*.cfg
*.bazel.lock

# Used by some IDEs and LSP plugins
compile_commands.json
Expand Down
30 changes: 30 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module(
name = "google-cloud-cpp",
version = "2.25.0",
)

bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "abseil-cpp", version = "20240116.2")
bazel_dep(name = "curl", version = "8.7.1")
bazel_dep(name = "libpfm", version = "4.11.0")
bazel_dep(name = "opentelemetry-cpp", version = "1.14.2")
bazel_dep(name = "crc32c", version = "1.1.0")
bazel_dep(name = "grpc", version = "1.63.1")
bazel_dep(name = "boringssl", version = "0.0.0-20240530-2db0eb3")
bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5")
bazel_dep(name = "protobuf", version = "27.1.bcr.1")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "rules_apple", version = "3.5.1")
bazel_dep(name = "apple_support", version = "1.15.1")
bazel_dep(name = "nlohmann_json", version = "3.11.3")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_proto", version = "6.0.0.bcr.1")
bazel_dep(name = "google_benchmark", version = "1.8.4")

switched_rules = use_extension("@googleapis//:extensions.bzl", "switched_rules")
switched_rules.use_languages(
cc = True,
grpc = True,
)
use_repo(switched_rules, "com_google_googleapis_imports")
Empty file added WORKSPACE.bzlmod
Empty file.
4 changes: 2 additions & 2 deletions bazel/crc32c.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ cc_test(
srcs = crc32c_test_sources,
deps = [
":crc32c",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)

Expand Down
2 changes: 1 addition & 1 deletion docfx/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ cc_library(
":docfx",
":docfx_testing",
"@com_github_zeux_pugixml//:pugixml",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
) for test in unit_tests]

Expand Down
2 changes: 1 addition & 1 deletion examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ cc_test(
"//:spanner",
"//google/cloud/testing_util:google_cloud_cpp_testing_grpc_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"@com_github_curl_curl//:curl",
"@curl",
],
)
32 changes: 16 additions & 16 deletions generator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ cc_library(
"//:common",
"//google/cloud:google_cloud_cpp_rest_internal",
"@com_github_jbeder_yaml_cpp//:yaml-cpp",
"@com_github_nlohmann_json//:nlohmann_json",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_googleapis//:googleapis_system_includes",
"@com_google_googleapis//google/api:client_cc_proto",
"@com_google_googleapis//google/api:field_info_cc_proto",
"@com_google_googleapis//google/api:routing_cc_proto",
"@com_google_googleapis//google/cloud:extended_operations_cc_proto",
"@com_google_googleapis//google/longrunning:longrunning_cc_proto",
"@com_google_protobuf//:protoc_lib",
"@nlohmann_json//:nlohmann_json",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/strings:str_format",
"@googleapis//:googleapis_system_includes",
"@googleapis//google/api:client_cc_proto",
"@googleapis//google/api:field_info_cc_proto",
"@googleapis//google/api:routing_cc_proto",
"@googleapis//google/cloud:extended_operations_cc_proto",
"@googleapis//google/longrunning:longrunning_cc_proto",
"@protobuf//:protoc_lib",
],
)

Expand All @@ -61,8 +61,8 @@ cc_library(
":google_cloud_cpp_generator",
"//:common",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"@com_google_googleapis//google/longrunning:longrunning_cc_proto",
"@com_google_googletest//:gtest",
"@googleapis//google/longrunning:longrunning_cc_proto",
"@googletest//:gtest",
],
)

Expand All @@ -77,7 +77,7 @@ cc_library(
deps = [
":google_cloud_cpp_generator",
":google_cloud_cpp_generator_testing",
"@com_google_googletest//:gtest",
"@googletest//:gtest",
],
) for test in google_cloud_cpp_generator_unit_tests]

Expand Down Expand Up @@ -115,8 +115,8 @@ cc_binary(
deps = [
":generator_config_cc_proto",
":google_cloud_cpp_generator",
"@com_google_absl//absl/flags:commandlineflag",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@abseil-cpp//absl/flags:commandlineflag",
"@abseil-cpp//absl/flags:flag",
"@abseil-cpp//absl/flags:parse",
],
)
40 changes: 20 additions & 20 deletions generator/integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ proto_library(
"test_request_id.proto",
],
deps = [
"@com_google_googleapis//google/api:annotations_proto",
"@com_google_googleapis//google/api:client_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:field_info_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_googleapis//google/api:routing_proto",
"@com_google_googleapis//google/iam/v1:iam_policy_proto",
"@com_google_googleapis//google/iam/v1:policy_proto",
"@com_google_googleapis//google/longrunning:operations_proto",
"@com_google_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
"@googleapis//google/api:annotations_proto",
"@googleapis//google/api:client_proto",
"@googleapis//google/api:field_behavior_proto",
"@googleapis//google/api:field_info_proto",
"@googleapis//google/api:resource_proto",
"@googleapis//google/api:routing_proto",
"@googleapis//google/iam/v1:iam_policy_proto",
"@googleapis//google/iam/v1:policy_proto",
"@googleapis//google/longrunning:operations_proto",
"@googleapis//google/rpc:status_proto",
"@protobuf//:any_proto",
"@protobuf//:duration_proto",
"@protobuf//:empty_proto",
"@protobuf//:field_mask_proto",
"@protobuf//:struct_proto",
"@protobuf//:timestamp_proto",
],
)

Expand Down Expand Up @@ -105,8 +105,8 @@ cc_library(
"//:grpc_utils",
"//google/cloud:google_cloud_cpp_rest_internal",
"//google/cloud:google_cloud_cpp_rest_protobuf_internal",
"@com_google_absl//absl/strings",
"@com_google_googleapis//google/longrunning:longrunning_cc_grpc",
"@abseil-cpp//absl/strings",
"@googleapis//google/longrunning:longrunning_cc_grpc",
],
)

Expand All @@ -131,7 +131,7 @@ filegroup(
"//google/cloud/testing_util:google_cloud_cpp_testing_grpc_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_rest_private",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
) for test in glob(["tests/*.cc"])]

Expand All @@ -157,6 +157,6 @@ filegroup(
tags = ["benchmark"],
deps = [
":google_cloud_cpp_generator_golden",
"@com_google_benchmark//:benchmark_main",
"@google_benchmark//:benchmark_main",
],
) for benchmark in glob(["benchmarks/*.cc"])]
72 changes: 36 additions & 36 deletions google/cloud/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ config_setting(
name = "enable_opentelemetry_valid",
flag_values = {
"//:enable_opentelemetry": "true",
"@io_opentelemetry_cpp//api:with_abseil": "true",
"@opentelemetry-cpp//api:with_abseil": "true",
},
)

Expand Down Expand Up @@ -112,17 +112,17 @@ to your build command, or set this value in your `.bazelrc` file(s).
"//:__pkg__",
],
deps = [
"@com_google_absl//absl/base",
"@com_google_absl//absl/functional:function_ref",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/time",
"@com_google_absl//absl/types:optional",
"@com_google_absl//absl/types:span",
"@com_google_absl//absl/types:variant",
"@abseil-cpp//absl/base",
"@abseil-cpp//absl/functional:function_ref",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/strings:str_format",
"@abseil-cpp//absl/time",
"@abseil-cpp//absl/types:optional",
"@abseil-cpp//absl/types:span",
"@abseil-cpp//absl/types:variant",
] + select({
":enable_opentelemetry_valid": [
"@io_opentelemetry_cpp//api",
"@opentelemetry-cpp//api",
],
"//conditions:default": [],
}) + select({
Expand Down Expand Up @@ -156,7 +156,7 @@ cc_library(
":google_cloud_cpp_common",
":google_cloud_cpp_mocks",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
) for test in google_cloud_cpp_common_unit_tests]

Expand Down Expand Up @@ -191,14 +191,14 @@ cc_library(
],
deps = [
":google_cloud_cpp_common",
"@com_github_grpc_grpc//:grpc++",
"@com_google_absl//absl/functional:function_ref",
"@com_google_absl//absl/time",
"@com_google_googleapis//:googleapis_system_includes",
"@com_google_googleapis//google/iam/credentials/v1:credentials_cc_grpc",
"@com_google_googleapis//google/longrunning:longrunning_cc_grpc",
"@com_google_googleapis//google/rpc:error_details_cc_proto",
"@com_google_googleapis//google/rpc:status_cc_proto",
"@grpc//:grpc++",
"@abseil-cpp//absl/functional:function_ref",
"@abseil-cpp//absl/time",
"@googleapis//:googleapis_system_includes",
"@googleapis//google/iam/credentials/v1:credentials_cc_grpc",
"@googleapis//google/longrunning:longrunning_cc_grpc",
"@googleapis//google/rpc:error_details_cc_proto",
"@googleapis//google/rpc:status_cc_proto",
],
)

Expand All @@ -223,9 +223,9 @@ cc_library(
":google_cloud_cpp_mocks",
"//google/cloud/testing_util:google_cloud_cpp_testing_grpc_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"@com_google_googleapis//google/bigtable/admin/v2:admin_cc_grpc",
"@com_google_googleapis//google/bigtable/v2:bigtable_cc_grpc",
"@com_google_googletest//:gtest_main",
"@googletest//google/bigtable/admin/v2:admin_cc_grpc",
"@googletest//google/bigtable/v2:bigtable_cc_grpc",
"@googletest//:gtest_main",
],
) for test in google_cloud_cpp_grpc_utils_unit_tests]

Expand All @@ -240,9 +240,9 @@ cc_library(
":google_cloud_cpp_grpc_utils",
"//google/cloud/testing_util:google_cloud_cpp_testing_grpc_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"@com_google_googleapis//google/bigtable/admin/v2:admin_cc_grpc",
"@com_google_googleapis//google/bigtable/v2:bigtable_cc_grpc",
"@com_google_googletest//:gtest_main",
"@googletest//google/bigtable/admin/v2:admin_cc_grpc",
"@googletest//google/bigtable/v2:bigtable_cc_grpc",
"@googletest//:gtest_main",
],
) for test in google_cloud_cpp_grpc_utils_integration_tests]

Expand Down Expand Up @@ -299,10 +299,10 @@ cc_library(
visibility = ["//:__subpackages__"],
deps = [
":google_cloud_cpp_common",
"@com_github_curl_curl//:curl",
"@com_github_nlohmann_json//:nlohmann_json",
"@com_google_absl//absl/functional:function_ref",
"@com_google_absl//absl/types:span",
"@curl",
"@nlohmann_json//:json",
"@abseil-cpp//absl/functional:function_ref",
"@abseil-cpp//absl/types:span",
] + select({
"@platforms//os:windows": [],
"//conditions:default": [
Expand All @@ -319,7 +319,7 @@ cc_library(
":google_cloud_cpp_rest_internal",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_rest_private",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
) for test in google_cloud_cpp_rest_internal_unit_tests]

Expand All @@ -332,7 +332,7 @@ cc_library(
deps = [
":google_cloud_cpp_rest_internal",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
) for test in google_cloud_cpp_rest_internal_emulator_integration_tests]

Expand All @@ -345,7 +345,7 @@ cc_library(
deps = [
":google_cloud_cpp_rest_internal",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
) for test in google_cloud_cpp_rest_internal_production_integration_tests]

Expand Down Expand Up @@ -379,9 +379,9 @@ cc_library(
"//google/cloud/testing_util:google_cloud_cpp_testing_grpc_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_rest_private",
"@com_google_googleapis//google/bigtable/admin/v2:admin_cc_grpc",
"@com_google_googleapis//google/iam/admin/v1:admin_cc_grpc",
"@com_google_googletest//:gtest_main",
"@googletest//google/bigtable/admin/v2:admin_cc_grpc",
"@googletest//google/iam/admin/v1:admin_cc_grpc",
"@googletest//:gtest_main",
],
) for test in google_cloud_cpp_rest_protobuf_internal_unit_tests]

Expand All @@ -403,7 +403,7 @@ cc_library(
":google_cloud_cpp_universe_domain",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
"//google/cloud/testing_util:google_cloud_cpp_testing_rest_private",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
) for test in google_cloud_cpp_universe_domain_unit_tests]

Expand Down
2 changes: 1 addition & 1 deletion google/cloud/accessapproval/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ service_dirs = [
]

googleapis_deps = [
"@com_google_googleapis//google/cloud/accessapproval/v1:accessapproval_cc_grpc",
"@googleapis//google/cloud/accessapproval/v1:accessapproval_cc_grpc",
]

cc_gapic_library(
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/accesscontextmanager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ service_dirs = [
]

googleapis_deps = [
"@com_google_googleapis//google/identity/accesscontextmanager/v1:accesscontextmanager_cc_grpc",
"@googleapis//google/identity/accesscontextmanager/v1:accesscontextmanager_cc_grpc",
]

cc_gapic_library(
Expand Down
Loading

0 comments on commit ec43200

Please sign in to comment.