@@ -108,25 +108,6 @@ rules_proto_toolchains()
108108# Go
109109##############################################################################
110110
111- # This must be above the download of gRPC (in C++ section) and rules_gapic because both repositories depend on rules_go
112- # and we would rather manage our version of rules_go explicitly rather than depend on the version those bring in transitively.
113- _io_bazel_rules_go_version = "0.33.0"
114-
115- http_archive (
116- name = "io_bazel_rules_go" ,
117- sha256 = "685052b498b6ddfe562ca7a97736741d87916fe536623afb7da2824c0211c369" ,
118- urls = [
119- "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip" .format (_io_bazel_rules_go_version ),
120- "https://github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip" .format (_io_bazel_rules_go_version ),
121- ],
122- )
123-
124- load ("@io_bazel_rules_go//go:deps.bzl" , "go_register_toolchains" , "go_rules_dependencies" )
125-
126- go_rules_dependencies ()
127-
128- go_register_toolchains (version = "1.16" )
129-
130111# rules_gapic also depends on rules_go, so it must come after our own dependency on rules_go.
131112# It must also come before gapic-generator-go so as to ensure that it does not bring in an old
132113# version of rules_gapic.
@@ -141,9 +122,20 @@ http_archive(
141122 urls = ["https://github.com/googleapis/rules_gapic/archive/v%s.tar.gz" % _rules_gapic_version ],
142123)
143124
144- load ("@rules_gapic//:repositories.bzl" , "rules_gapic_repositories" )
125+ # This must be above the download of gRPC (in C++ section) and
126+ # rules_gapic_repositories because both depend on rules_go and we need to manage
127+ # our version of rules_go explicitly rather than depend on the version those
128+ # bring in transitively.
129+ _io_bazel_rules_go_version = "0.34.0"
145130
146- rules_gapic_repositories ()
131+ http_archive (
132+ name = "io_bazel_rules_go" ,
133+ sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366" ,
134+ urls = [
135+ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip" .format (_io_bazel_rules_go_version ),
136+ "https://github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip" .format (_io_bazel_rules_go_version ),
137+ ],
138+ )
147139
148140# Gazelle dependency version should match gazelle dependency expected by gRPC
149141_bazel_gazelle_version = "0.24.0"
@@ -157,6 +149,16 @@ http_archive(
157149 ],
158150)
159151
152+ # This overrides the package name @go_googleapis to point at this package,
153+ # @com_google_googleapis, which has the latest versions of all protos and is the
154+ # source of truth for those protos. This prevents rules_go from loading its own,
155+ # conflicting copy of googleapis under this package name, which would create
156+ # package collisions during compilation.
157+ local_repository (
158+ name = "go_googleapis" ,
159+ path = "." ,
160+ )
161+
160162# Until this project is migrated to consume the new subdirectory of generated
161163# types e.g. longrunningpb, we must define our own version of longrunning here.
162164load ("@bazel_gazelle//:deps.bzl" , "go_repository" )
@@ -168,13 +170,10 @@ go_repository(
168170 version = "v0.1.1" ,
169171)
170172
171- _gapic_generator_go_version = "0.33.6 "
173+ _gapic_generator_go_version = "0.34.0 "
172174
173175http_archive (
174176 name = "com_googleapis_gapic_generator_go" ,
175- repo_mapping = {
176- "@go_googleapis" : "@com_google_googleapis" ,
177- },
178177 strip_prefix = "gapic-generator-go-%s" % _gapic_generator_go_version ,
179178 urls = ["https://github.com/googleapis/gapic-generator-go/archive/v%s.tar.gz" % _gapic_generator_go_version ],
180179)
@@ -183,14 +182,23 @@ load("@com_googleapis_gapic_generator_go//:repositories.bzl", "com_googleapis_ga
183182
184183com_googleapis_gapic_generator_go_repositories ()
185184
186- # Gazelle dependencies should go after gapic-generator-go dependencies to make sure that
187- # gazelle does not override some of the critical dependencies of the gapic-generator-go.
188- # At the same time gazelle repository itself must be imported before gapic-generator-go,
189- # because gapic-generator-go depends on go_repository rule, which is defined in gazelle repo.
185+ # rules_go and gazelle dependencies are loaded after gapic-generator-go
186+ # dependencies to ensure that they do not override any of the go_repository
187+ # dependencies of gapic-generator-go.
188+ load ("@io_bazel_rules_go//go:deps.bzl" , "go_register_toolchains" , "go_rules_dependencies" )
189+
190+ go_register_toolchains (version = "1.18.6" )
191+
192+ go_rules_dependencies ()
193+
190194load ("@bazel_gazelle//:deps.bzl" , "gazelle_dependencies" )
191195
192196gazelle_dependencies ()
193197
198+ load ("@rules_gapic//:repositories.bzl" , "rules_gapic_repositories" )
199+
200+ rules_gapic_repositories ()
201+
194202##############################################################################
195203# C++
196204##############################################################################
0 commit comments