Skip to content
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

chore(bazel): get bazel 8 working #15042

Draft
wants to merge 9 commits into
base: prepare-for-v3.0.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
8.1.1
1 change: 0 additions & 1 deletion .github/workflows/macos-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ jobs:
rapidmigrationassessment
recaptchaenterprise
recommender
resourcesettings
scheduler
secretmanager
securesourcemanager
Expand Down
6 changes: 3 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ bazel_dep(name = "grpc", version = "1.71.0", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "googleapis", version = "0.0.0", repo_name = "com_google_googleapis")
archive_override(
module_name = "googleapis",
integrity = "sha256-WpRQzxrRGHyCorXN/1Pk1YS21FKStfcbUECDrLA619A=",
integrity = "sha256-KnunCHPK1T8u8SUxAAU122G6qmfxADIfA4ZU+fNWXjY=",
patch_strip = 1,
patches = ["//bazel:googleapis.modules.patch"],
strip_prefix = "googleapis-280725e991516d4a0f136268faf5aa6d32d21b54",
strip_prefix = "googleapis-53ca65d540dd1a7cb4746687daa87208dc9ea437",
urls = [
"https://github.com/googleapis/googleapis/archive/280725e991516d4a0f136268faf5aa6d32d21b54.tar.gz",
"https://github.com/googleapis/googleapis/archive/53ca65d540dd1a7cb4746687daa87208dc9ea437.tar.gz",
],
)

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,6 @@ See each library's `README.md` file for more information about:
- [Cloud Resource Manager API](google/cloud/resourcemanager/README.md)
[[quickstart]](google/cloud/resourcemanager/quickstart/README.md)
[[reference]](https://cloud.google.com/cpp/docs/reference/resourcemanager/latest)
- [Resource Settings API](google/cloud/resourcesettings/README.md)
[[quickstart]](google/cloud/resourcesettings/quickstart/README.md)
[[reference]](https://cloud.google.com/cpp/docs/reference/resourcesettings/latest)
- [Retail API](google/cloud/retail/README.md)
[[quickstart]](google/cloud/retail/quickstart/README.md)
[[reference]](https://cloud.google.com/cpp/docs/reference/retail/latest)
Expand Down
10 changes: 5 additions & 5 deletions bazel/gapic.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ def cc_gapic_library(name, service_dirs = [], googleapis_deps = [], additional_d

native.filegroup(
name = "srcs",
srcs = native.glob(sources_glob),
srcs = native.glob(sources_glob, allow_empty = True),
)

native.filegroup(
name = "hdrs",
srcs = native.glob(include = code_glob, exclude = sources_glob),
srcs = native.glob(include = code_glob, exclude = sources_glob, allow_empty = True),
)

native.filegroup(
name = "public_hdrs",
srcs = native.glob([d + "*.h" for d in service_dirs]),
srcs = native.glob([d + "*.h" for d in service_dirs], allow_empty = True),
visibility = ["//:__pkg__"],
)

native.filegroup(
name = "mocks",
srcs = native.glob([d + "mocks/*.h" for d in service_dirs]),
srcs = native.glob([d + "mocks/*.h" for d in service_dirs], allow_empty = True),
visibility = ["//:__pkg__"],
)

Expand Down Expand Up @@ -84,4 +84,4 @@ def cc_gapic_library(name, service_dirs = [], googleapis_deps = [], additional_d
"//:" + name,
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
],
) for sample in native.glob([d + "samples/*_samples.cc" for d in service_dirs])]
) for sample in native.glob([d + "samples/*_samples.cc" for d in service_dirs], allow_empty = True)]
26 changes: 21 additions & 5 deletions bazel/googleapis.modules.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
diff --git a/BUILD.bazel b/BUILD.bazel
index 95e4c12e5..a901fd573 100644
index 026553f5c7..f3c6b6925c 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,3 +1,7 @@
@@ -1,11 +1,13 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache 2.0
+
genrule(
name = "build_gen",
outs = ["build_gen.sh"],
@@ -16,3 +20,15 @@ EOD
- name = "build_gen",
- srcs = glob(
- ["run_build_gen.sh"],
- allow_empty = True,
- ),
- outs = ["build_gen.sh"],
- cmd = """
+ name = "build_gen",
+ outs = ["build_gen.sh"],
+ executable = True,
+ srcs = glob(["run_build_gen.sh"], allow_empty=True),
+ cmd = """
if test -z \"$(SRCS)\"; then
cat <<EOD > $@
#!/bin/sh
@@ -17,5 +19,17 @@ EOD
cp $(SRCS) $@
fi
""",
- executable = True,
)
+
+# This build file overlays on top of the BUILD files for the googleapis repo,
Expand All @@ -26,6 +41,7 @@ index 95e4c12e5..a901fd573 100644
+ ".",
+ ],
+)
+
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 000000000..169133e43
Expand Down
13 changes: 13 additions & 0 deletions bazel/googleapis.workspace.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/BUILD.bazel b/BUILD.bazel
index 95e4c12e5..83838d3f0 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -2,7 +2,7 @@ genrule(
name = "build_gen",
outs = ["build_gen.sh"],
executable = True,
- srcs = glob(["run_build_gen.sh"]),
+ srcs = glob(["run_build_gen.sh"], allow_empty=True),
cmd = """
if test -z \"$(SRCS)\"; then
cat <<EOD > $@
9 changes: 5 additions & 4 deletions bazel/workspace0.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,20 @@ def gl_cpp_workspace0(name = None):
http_archive,
name = "com_google_googleapis",
urls = [
"https://github.com/googleapis/googleapis/archive/280725e991516d4a0f136268faf5aa6d32d21b54.tar.gz",
"https://github.com/googleapis/googleapis/archive/53ca65d540dd1a7cb4746687daa87208dc9ea437.tar.gz",
],
sha256 = "5a9450cf1ad1187c82a2b5cdff53e4d584b6d45292b5f71b504083acb03ad7d0",
strip_prefix = "googleapis-280725e991516d4a0f136268faf5aa6d32d21b54",
sha256 = "2a7ba70873cad53f2ef12531000535db61baaa67f100321f038654f9f3565e36",
strip_prefix = "googleapis-53ca65d540dd1a7cb4746687daa87208dc9ea437",
build_file = Label("//bazel:googleapis.BUILD"),
# Scaffolding for patching googleapis after download. For example:
# patches = ["googleapis.patch"]
# NOTE: This should only be used while developing with a new
# protobuf message. No changes to `patches` should ever be
# committed to the main branch.
patch_tool = "patch",
patch_args = ["-p1"],
patch_args = ["-p1", "-l", "-n"],
patches = [],
# patches = ["//bazel:googleapis.workspace.patch"],
)

# Load protobuf.
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions ci/cloudbuild/builds/bazel-oldest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mapfile -t args < <(bazel::common_args)
args+=(
# Test without bzlmod as WORKSPACE is still supported in bazel 7 LTS.
--noenable_bzlmod
--enable_workspace
# Only run the unit tests, no need to waste time running everything.
--test_tag_filters=-integration-test
)
Expand Down
2 changes: 2 additions & 0 deletions ci/cloudbuild/builds/quickstart-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ readonly SED_ARGS=(
-e '/^rpc$/d'
# TODO:(#14896) Skip gkeconnect as it transitions from grpc to REST transport.
-e '/^gkeconnect/d'
# TODO:(#15015) Remove the next line when resourcesettings is removed from vcpkg
-e '/^resourcesettings/d'
)
mapfile -t features < <(
env -C "${vcpkg_dir}" ./vcpkg search google-cloud-cpp |
Expand Down
7 changes: 0 additions & 7 deletions ci/etc/expected_install_directories
Original file line number Diff line number Diff line change
Expand Up @@ -996,11 +996,6 @@
./include/google/cloud/resourcemanager/v3
./include/google/cloud/resourcemanager/v3/internal
./include/google/cloud/resourcemanager/v3/mocks
./include/google/cloud/resourcesettings
./include/google/cloud/resourcesettings/mocks
./include/google/cloud/resourcesettings/v1
./include/google/cloud/resourcesettings/v1/internal
./include/google/cloud/resourcesettings/v1/mocks
./include/google/cloud/retail
./include/google/cloud/retail/mocks
./include/google/cloud/retail/v2
Expand Down Expand Up @@ -1471,8 +1466,6 @@
./lib64/cmake/google_cloud_cpp_redis_mocks
./lib64/cmake/google_cloud_cpp_resourcemanager
./lib64/cmake/google_cloud_cpp_resourcemanager_mocks
./lib64/cmake/google_cloud_cpp_resourcesettings
./lib64/cmake/google_cloud_cpp_resourcesettings_mocks
./lib64/cmake/google_cloud_cpp_retail
./lib64/cmake/google_cloud_cpp_retail_mocks
./lib64/cmake/google_cloud_cpp_run
Expand Down
1 change: 1 addition & 0 deletions ci/gha/builds/lib/bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function bazel::msvc_args() {
'--per_file_copt=.*\.upbdefs\.c@-wd4090'
# TODO(#14462) - gRPC is not compatible with (at least) MSVC 2019 + bzlmod.
'--noenable_bzlmod'
'--enable_workspace'
)
printf "%s\n" "${args[@]}"
}
Expand Down
1 change: 1 addition & 0 deletions ci/verify_current_targets/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build --experimental_convenience_symlinks=ignore

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

# TODO(#13311) - remove once gRPC works with Bazel v7 or when gRPC stops using
# `apple_rules`.
Expand Down
2 changes: 1 addition & 1 deletion ci/verify_current_targets/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
8.1.1
1 change: 1 addition & 0 deletions ci/verify_deprecated_targets/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build --experimental_convenience_symlinks=ignore

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

# TODO(#13311) - remove once gRPC works with Bazel v7 or when gRPC stops using
# `apple_rules`.
Expand Down
2 changes: 1 addition & 1 deletion ci/verify_deprecated_targets/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
8.1.1
1 change: 0 additions & 1 deletion cmake/GoogleCloudCppFeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ set(GOOGLE_CLOUD_CPP_GA_LIBRARIES
"recommender"
"redis"
"resourcemanager"
"resourcesettings"
"retail"
"run"
"scheduler"
Expand Down
4 changes: 2 additions & 2 deletions cmake/GoogleapisConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256
mark_as_advanced(GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256)

set(_GOOGLE_CLOUD_CPP_GOOGLEAPIS_COMMIT_SHA
"280725e991516d4a0f136268faf5aa6d32d21b54")
"53ca65d540dd1a7cb4746687daa87208dc9ea437")
set(_GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256
"5a9450cf1ad1187c82a2b5cdff53e4d584b6d45292b5f71b504083acb03ad7d0")
"2a7ba70873cad53f2ef12531000535db61baaa67f100321f038654f9f3565e36")

set(DOXYGEN_ALIASES
"googleapis_link{2}=\"[\\1](https://github.com/googleapis/googleapis/blob/${_GOOGLE_CLOUD_CPP_GOOGLEAPIS_COMMIT_SHA}/\\2)\""
Expand Down
1 change: 1 addition & 0 deletions external/googleapis/protodeps/networkconnectivity.deps
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
@com_google_googleapis//google/api:launch_stage_proto
@com_google_googleapis//google/api:resource_proto
@com_google_googleapis//google/longrunning:operations_proto
@com_google_googleapis//google/rpc:error_details_proto
@com_google_googleapis//google/rpc:status_proto
1 change: 1 addition & 0 deletions external/googleapis/protodeps/parallelstore.deps
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
@com_google_googleapis//google/api:launch_stage_proto
@com_google_googleapis//google/api:resource_proto
@com_google_googleapis//google/longrunning:operations_proto
@com_google_googleapis//google/rpc:code_proto
@com_google_googleapis//google/rpc:status_proto
6 changes: 0 additions & 6 deletions external/googleapis/protodeps/resourcesettings.deps

This file was deleted.

1 change: 1 addition & 0 deletions external/googleapis/protolists/aiplatform.list
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
@com_google_googleapis//google/cloud/aiplatform/v1:notebook_runtime.proto
@com_google_googleapis//google/cloud/aiplatform/v1:notebook_runtime_template_ref.proto
@com_google_googleapis//google/cloud/aiplatform/v1:notebook_service.proto
@com_google_googleapis//google/cloud/aiplatform/v1:notebook_software_config.proto
@com_google_googleapis//google/cloud/aiplatform/v1:openapi.proto
@com_google_googleapis//google/cloud/aiplatform/v1:operation.proto
@com_google_googleapis//google/cloud/aiplatform/v1:persistent_resource.proto
Expand Down
1 change: 1 addition & 0 deletions external/googleapis/protolists/bigquerycontrol.list
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@com_google_googleapis//google/cloud/bigquery/v2:job_status.proto
@com_google_googleapis//google/cloud/bigquery/v2:json_extension.proto
@com_google_googleapis//google/cloud/bigquery/v2:location_metadata.proto
@com_google_googleapis//google/cloud/bigquery/v2:managed_table_type.proto
@com_google_googleapis//google/cloud/bigquery/v2:map_target_type.proto
@com_google_googleapis//google/cloud/bigquery/v2:model.proto
@com_google_googleapis//google/cloud/bigquery/v2:model_reference.proto
Expand Down
1 change: 1 addition & 0 deletions external/googleapis/protolists/managedkafka.list
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@com_google_googleapis//google/cloud/managedkafka/v1:managed_kafka.proto
@com_google_googleapis//google/cloud/managedkafka/v1:managed_kafka_connect.proto
@com_google_googleapis//google/cloud/managedkafka/v1:resources.proto
1 change: 1 addition & 0 deletions external/googleapis/protolists/netapp.list
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@com_google_googleapis//google/cloud/netapp/v1:cloud_netapp_service.proto
@com_google_googleapis//google/cloud/netapp/v1:common.proto
@com_google_googleapis//google/cloud/netapp/v1:kms.proto
@com_google_googleapis//google/cloud/netapp/v1:quota_rule.proto
@com_google_googleapis//google/cloud/netapp/v1:replication.proto
@com_google_googleapis//google/cloud/netapp/v1:snapshot.proto
@com_google_googleapis//google/cloud/netapp/v1:storage_pool.proto
Expand Down
1 change: 1 addition & 0 deletions external/googleapis/protolists/networkconnectivity.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@com_google_googleapis//google/cloud/networkconnectivity/v1:common.proto
@com_google_googleapis//google/cloud/networkconnectivity/v1:cross_network_automation.proto
@com_google_googleapis//google/cloud/networkconnectivity/v1:hub.proto
@com_google_googleapis//google/cloud/networkconnectivity/v1:policy_based_routing.proto
1 change: 0 additions & 1 deletion external/googleapis/protolists/resourcesettings.list

This file was deleted.

4 changes: 4 additions & 0 deletions external/googleapis/protolists/securitycenter.list
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
@com_google_googleapis//google/cloud/securitycenter/v2:connection.proto
@com_google_googleapis//google/cloud/securitycenter/v2:contact_details.proto
@com_google_googleapis//google/cloud/securitycenter/v2:container.proto
@com_google_googleapis//google/cloud/securitycenter/v2:data_access_event.proto
@com_google_googleapis//google/cloud/securitycenter/v2:data_flow_event.proto
@com_google_googleapis//google/cloud/securitycenter/v2:data_retention_deletion_event.proto
@com_google_googleapis//google/cloud/securitycenter/v2:database.proto
@com_google_googleapis//google/cloud/securitycenter/v2:disk.proto
@com_google_googleapis//google/cloud/securitycenter/v2:exfiltration.proto
@com_google_googleapis//google/cloud/securitycenter/v2:external_system.proto
@com_google_googleapis//google/cloud/securitycenter/v2:file.proto
Expand Down
1 change: 0 additions & 1 deletion external/googleapis/update_libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ declare -A -r LIBRARIES=(
"@com_google_googleapis//google/cloud/redis/v1:redis_cc_grpc"
)"
["resourcemanager"]="@com_google_googleapis//google/cloud/resourcemanager/v3:resourcemanager_cc_grpc"
["resourcesettings"]="@com_google_googleapis//google/cloud/resourcesettings/v1:resourcesettings_cc_grpc"
["retail"]="@com_google_googleapis//google/cloud/retail/v2:retail_cc_grpc"
["run"]="@com_google_googleapis//google/cloud/run/v2:run_cc_grpc"
["scheduler"]="@com_google_googleapis//google/cloud/scheduler/v1:scheduler_cc_grpc"
Expand Down
9 changes: 0 additions & 9 deletions generator/generator_config.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -3224,15 +3224,6 @@ service {
retryable_status_codes: ["kUnavailable"]
}

# Resource Settings
service {
service_proto_path: "google/cloud/resourcesettings/v1/resource_settings.proto"
product_path: "google/cloud/resourcesettings/v1"
forwarding_product_path: "google/cloud/resourcesettings"
initial_copyright_year: "2022"
retryable_status_codes: ["kUnavailable"]
}

# Retail
service {
service_proto_path: "google/cloud/retail/v2/analytics_service.proto"
Expand Down
11 changes: 7 additions & 4 deletions generator/integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ cc_grpc_library(

filegroup(
name = "golden_srcs",
srcs = glob([
"golden/v1/internal/*_sources.cc",
"golden/v1/internal/streaming.cc",
]),
srcs = glob(
[
"golden/v1/internal/*_sources.cc",
"golden/v1/internal/streaming.cc",
],
allow_empty = True,
),
)

filegroup(
Expand Down
1 change: 1 addition & 0 deletions google/cloud/accessapproval/quickstart/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ build --experimental_convenience_symlinks=ignore

#Our quickstarts do not yet support bzlmod
build --noenable_bzlmod
build --enable_workspace
2 changes: 1 addition & 1 deletion google/cloud/accessapproval/quickstart/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
8.1.1
1 change: 1 addition & 0 deletions google/cloud/accesscontextmanager/quickstart/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ build --experimental_convenience_symlinks=ignore

#Our quickstarts do not yet support bzlmod
build --noenable_bzlmod
build --enable_workspace
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
8.1.1
1 change: 1 addition & 0 deletions google/cloud/advisorynotifications/quickstart/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ build --experimental_convenience_symlinks=ignore

#Our quickstarts do not yet support bzlmod
build --noenable_bzlmod
build --enable_workspace
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
8.1.1
1 change: 1 addition & 0 deletions google/cloud/aiplatform/quickstart/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ build --experimental_convenience_symlinks=ignore

#Our quickstarts do not yet support bzlmod
build --noenable_bzlmod
build --enable_workspace
2 changes: 1 addition & 1 deletion google/cloud/aiplatform/quickstart/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
8.1.1
Loading