Skip to content

Commit

Permalink
Remove references to go_googleapis (#3603)
Browse files Browse the repository at this point in the history
  • Loading branch information
linzhp authored Jul 10, 2023
1 parent 6b3d718 commit 87125ff
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 154,801 deletions.
19 changes: 0 additions & 19 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,32 +118,13 @@ tasks:
- "-@com_google_protobuf//:timestamp_proto"
- "-@com_google_protobuf//:type_proto"
- "-@com_google_protobuf//:wrappers_proto"
- "-@go_googleapis//google/rpc:code_go_proto"
- "-@go_googleapis//google/rpc:code_proto"
- "-@go_googleapis//google/rpc:errdetails_go_proto"
- "-@go_googleapis//google/rpc:errdetails_proto"
- "-@go_googleapis//google/rpc:status_go_proto"
- "-@go_googleapis//google/rpc:status_proto"
- "-@go_googleapis//google/type:color_go_proto"
- "-@gogo_special_proto//github.com/gogo/protobuf/gogoproto:gogoproto"
- "-//go/tools/bazel:bazel_test"
- "-@io_bazel_rules_go//proto:gogofaster_proto"
- "-@io_bazel_rules_go//proto:go_grpc"
- "-@io_bazel_rules_go//proto:go_proto"
- "-@io_bazel_rules_go//proto:go_proto_bootstrap"
- "-@io_bazel_rules_go//proto:go_proto_validate"
- "-@io_bazel_rules_go//proto/wkt:any_go_proto"
- "-@io_bazel_rules_go//proto/wkt:api_go_proto"
- "-@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto"
- "-@io_bazel_rules_go//proto/wkt:descriptor_go_proto"
- "-@io_bazel_rules_go//proto/wkt:duration_go_proto"
- "-@io_bazel_rules_go//proto/wkt:empty_go_proto"
- "-@io_bazel_rules_go//proto/wkt:field_mask_go_proto"
- "-@io_bazel_rules_go//proto/wkt:source_context_go_proto"
- "-@io_bazel_rules_go//proto/wkt:struct_go_proto"
- "-@io_bazel_rules_go//proto/wkt:timestamp_go_proto"
- "-@io_bazel_rules_go//proto/wkt:type_go_proto"
- "-@io_bazel_rules_go//proto/wkt:wrappers_go_proto"
- "-@org_golang_x_crypto//ed25519:ed25519_test"
- "-@org_golang_x_crypto//sha3:sha3_test"
- "-@org_golang_x_sys//windows/registry:registry_test"
Expand Down
1 change: 0 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ bazel_dep(name = "protobuf", version = "3.19.2", repo_name = "com_google_protobu
non_module_dependencies = use_extension("//go/private:extensions.bzl", "non_module_dependencies")
use_repo(
non_module_dependencies,
"go_googleapis",
"io_bazel_rules_nogo",
)

Expand Down
32 changes: 28 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ bazel_skylib_workspace()

http_archive(
name = "bazel_gazelle",
sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
sha256 = "178eba9540a616bda314afa25a91f195758a9fed178eda72e149eb0d20e9b670",
strip_prefix = "bazel-gazelle-9fe0a3ff751647789690293dcbb3c87ea33b7566",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/archive/9fe0a3ff751647789690293dcbb3c87ea33b7566.zip",
],
)

Expand Down Expand Up @@ -119,6 +119,25 @@ go_repository(
version = "v0.6.0",
)

http_archive(
name = "googleapis",
sha256 = "9d1a930e767c93c825398b8f8692eca3fe353b9aaadedfbcf1fca2282c85df88",
strip_prefix = "googleapis-64926d52febbf298cb82a8f472ade4a3969ba922",
urls = [
"https://github.com/googleapis/googleapis/archive/64926d52febbf298cb82a8f472ade4a3969ba922.zip",
],
)

go_repository(
name = "org_golang_google_genproto",
build_extra_args = ["-exclude=vendor"],
build_file_generation = "on",
build_file_proto_mode = "disable_global",
importpath = "google.golang.org/genproto",
sum = "h1:S9GbmC1iCgvbLyAokVCwiO6tVIrU9Y7c5oMx1V/ki/Y=",
version = "v0.0.0-20221024183307-1bc688fe9f3e",
)

# TODO(sluongng): Gazelle v0.25.0 switched to static dependency resolution which cause
# build files generation in external dependencies to wrongly resolve these repositories.
# We should investigate in Gazelle why this happen and fix it.
Expand Down Expand Up @@ -180,8 +199,13 @@ load(

apple_support_dependencies()

# For testing the compatibility with a hermetic cc toolchain. Users should not have to enable it.
load("@googleapis//:repository_rules.bzl", "switched_rules_by_language")

switched_rules_by_language(
name = "com_google_googleapis_imports",
)

# For testing the compatibility with a hermetic cc toolchain. Users should not have to enable it.
http_archive(
name = "hermetic_cc_toolchain",
sha256 = "bd2234acd0837251361be3270d7d3ce599b418be123d902d84762302e31a3014",
Expand Down
8 changes: 0 additions & 8 deletions go/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Go workspace rules
.. _github.com/gogo/protobuf: https://github.com/gogo/protobuf
.. _github.com/golang/protobuf: https://github.com/golang/protobuf/
.. _github.com/google/protobuf: https://github.com/google/protobuf/
.. _github.com/googleapis/googleapis: https://github.com/googleapis/googleapis
.. _github.com/mwitkow/go-proto-validators: https://github.com/mwitkow/go-proto-validators
.. _golang.org/x/net: https://github.com/golang/net/
.. _golang.org/x/sys: https://github.com/golang/sys/
Expand Down Expand Up @@ -107,13 +106,6 @@ It also declares some internal repositories not described here.
| ``go_rules_dependencies`` should provide this, but it doesn't change often, |
| and many things break without it. |
+-------------------------------------------------+-------------------------------------------+
| :value:`go_googleapis` | `github.com/googleapis/googleapis`_ |
+-------------------------------------------------+-------------------------------------------+
| Like :value:`org_golang_google_genproto` but provides ``go_proto_library`` |
| targets instead of ``go_library``. Ideally we should use |
| ``com_google_googleapis``, but Gazelle still resolves imports to this repo. |
| See `#1986`_. |
+-------------------------------------------------+-------------------------------------------+

Proto dependencies
------------------
Expand Down
30 changes: 1 addition & 29 deletions go/private/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ def go_rules_dependencies(force = False):
name = "gogo_special_proto",
)

# go_library targets with pre-generated sources for Well Known Types
# and Google APIs.
# go_library targets with pre-generated sources for Well Known Types.
# Doesn't belong here, but it would be an annoying source of errors if
# this weren't generated with -proto disable_global.
# releaser:upgrade-dep googleapis go-genproto
Expand All @@ -238,33 +237,6 @@ def go_rules_dependencies(force = False):
patch_args = ["-p1"],
)

# go_proto_library targets for gRPC and Google APIs.
# TODO(#1986): migrate to com_google_googleapis. This workspace was added
# before the real workspace supported Bazel. Gazelle resolves dependencies
# here. Gazelle should resolve dependencies to com_google_googleapis
# instead, and we should remove this.
# releaser:upgrade-dep googleapis googleapis
wrapper(
http_archive,
name = "go_googleapis",
# master, as of 2022-12-05
urls = [
"https://mirror.bazel.build/github.com/googleapis/googleapis/archive/83c3605afb5a39952bf0a0809875d41cf2a558ca.zip",
"https://github.com/googleapis/googleapis/archive/83c3605afb5a39952bf0a0809875d41cf2a558ca.zip",
],
sha256 = "ba694861340e792fd31cb77274eacaf6e4ca8bda97707898f41d8bebfd8a4984",
strip_prefix = "googleapis-83c3605afb5a39952bf0a0809875d41cf2a558ca",
patches = [
# releaser:patch-cmd find . -name BUILD.bazel -delete
Label("//third_party:go_googleapis-deletebuild.patch"),
# set gazelle directives; change workspace name
Label("//third_party:go_googleapis-directives.patch"),
# releaser:patch-cmd gazelle -repo_root .
Label("//third_party:go_googleapis-gazelle.patch"),
],
patch_args = ["-E", "-p1"],
)

# releaser:upgrade-dep golang mock
_maybe(
http_archive,
Expand Down
7 changes: 7 additions & 0 deletions tests/bcr/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ local_path_override(
)

bazel_dep(name = "gazelle", version = "0.26.0")
archive_override(
module_name = "gazelle",
strip_prefix = "bazel-gazelle-9fe0a3ff751647789690293dcbb3c87ea33b7566",
urls = [
"https://github.com/bazelbuild/bazel-gazelle/archive/9fe0a3ff751647789690293dcbb3c87ea33b7566.zip",
],
)
bazel_dep(name = "protobuf", version = "3.19.6")

go_sdk = use_extension("@my_rules_go//go:extensions.bzl", "go_sdk")
Expand Down
2 changes: 1 addition & 1 deletion tests/extras/gomock/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go_library(
importpath = "github.com/bazelbuild/rules_go/gomock/client",
visibility = ["//visibility:public"],
deps = [
"@go_googleapis//google/bytestream:bytestream_go_proto",
"@org_golang_google_genproto//googleapis/bytestream",
"@org_golang_google_grpc//:grpc",
],
)
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/googleapis/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ proto_library(
name = "color_service_proto",
srcs = ["color_service.proto"],
deps = [
"@go_googleapis//google/rpc:status_proto",
"@go_googleapis//google/type:color_proto",
"@googleapis//google/rpc:status_proto",
"@googleapis//google/type:color_proto",
],
)

Expand All @@ -17,8 +17,8 @@ go_proto_library(
importpath = "github.com/bazelbuild/rules_go/tests/integration/googleapis/color_service_proto",
proto = ":color_service_proto",
deps = [
"@go_googleapis//google/rpc:status_go_proto",
"@go_googleapis//google/type:color_go_proto",
"@org_golang_google_genproto//googleapis/rpc/status",
"@org_golang_google_genproto//googleapis/type/color",
],
)

Expand All @@ -28,9 +28,9 @@ go_library(
importpath = "github.com/bazelbuild/rules_go/tests/integration/googleapis/color_service",
deps = [
":color_service_go_proto",
"@go_googleapis//google/rpc:code_go_proto",
"@go_googleapis//google/rpc:status_go_proto",
"@go_googleapis//google/type:color_go_proto",
"@org_golang_google_genproto//googleapis/rpc/code",
"@org_golang_google_genproto//googleapis/rpc/status",
"@org_golang_google_genproto//googleapis/type/color",
],
)

Expand All @@ -40,7 +40,7 @@ go_test(
deps = [
":color_service",
":color_service_go_proto",
"@go_googleapis//google/type:color_go_proto",
"@org_golang_google_genproto//googleapis/type/color",
"@org_golang_google_grpc//:go_default_library",
],
)
4 changes: 2 additions & 2 deletions tests/integration/googleapis/README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Functionality related to @go_googleapis
Functionality related to Google APIs
=======================================

color_service_test
------------------

Verifies that a simple gRPC client and server can be built and run. .proto
files are compiled at build time and depend on libraries in ``@go_googleapis``.
files are compiled at build time and depend on libraries in Google APIs.
Loading

0 comments on commit 87125ff

Please sign in to comment.