Skip to content

Commit 2d92299

Browse files
authored
Cleanup integration with googleapis repository (googleapis#60)
Also replace dependency on `api-common-protos` with `googleapis` (since we already depend on it, otherwise we depend on two copies of same thing). It looks like `api-common-protos` is not going anywhere (there is no current realistic plan to switch to `api-common-protos` in foreseeable future, and `gapic-generator-cpp` is the only user of that, while `googleapis` remains our source of truth). In case if it changes, we can put `api-common-protos` back easily.
1 parent 5008c65 commit 2d92299

File tree

7 files changed

+29
-65
lines changed

7 files changed

+29
-65
lines changed

WORKSPACE

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,61 +25,31 @@ load(
2525
)
2626

2727
com_google_gapic_generator_cpp_gax_repositories()
28+
29+
load(
30+
"@com_google_googleapis//:repository_rules.bzl",
31+
"switched_rules_by_language",
32+
)
33+
34+
switched_rules_by_language(
35+
name = "com_google_googleapis_imports",
36+
cc = True,
37+
gapic = True,
38+
grpc = True,
39+
)
40+
2841
com_google_gapic_generator_cpp_repositories()
2942

3043
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
3144

3245
grpc_deps()
3346

34-
# WARNING: The java and go segments below are a hack to get
35-
# C++ operations proto types to build.
36-
# Tracked by https://github.com/googleapis/gapic-generator-cpp/issues/35
37-
38-
##############################################################################
39-
# Java
40-
##############################################################################
41-
4247
#
43-
# gapic-generator
48+
# gapic-generator (contains common definitions for gapic rules, see gapic.bzl
49+
# file in com_google_api_codegen)
4450
#
4551
http_archive(
4652
name = "com_google_api_codegen",
47-
urls = ["https://github.com/googleapis/gapic-generator/archive/025ebdbb3d14609be938900a538418858b0ecfb7.zip"],
4853
strip_prefix = "gapic-generator-025ebdbb3d14609be938900a538418858b0ecfb7",
54+
urls = ["https://github.com/googleapis/gapic-generator/archive/025ebdbb3d14609be938900a538418858b0ecfb7.zip"],
4955
)
50-
51-
#
52-
# java_gapic artifacts runtime dependencies (gax-java)
53-
#
54-
load("@com_google_api_codegen//rules_gapic/java:java_gapic_repositories.bzl", "java_gapic_repositories")
55-
56-
java_gapic_repositories()
57-
58-
load("@com_google_api_gax_java//:repository_rules.bzl", "com_google_api_gax_java_properties")
59-
60-
com_google_api_gax_java_properties(
61-
name = "com_google_api_gax_java_properties",
62-
file = "@com_google_api_gax_java//:dependencies.properties",
63-
)
64-
65-
load("@com_google_api_gax_java//:repositories.bzl", "com_google_api_gax_java_repositories")
66-
67-
com_google_api_gax_java_repositories()
68-
##############################################################################
69-
# Go
70-
##############################################################################
71-
72-
#
73-
# rules_go (support Golang under bazel)
74-
#
75-
http_archive(
76-
name = "io_bazel_rules_go",
77-
strip_prefix = "rules_go-7d17d496a6b32f6a573c6c22e29c58204eddf3d4",
78-
urls = ["https://github.com/bazelbuild/rules_go/archive/7d17d496a6b32f6a573c6c22e29c58204eddf3d4.zip"],
79-
)
80-
81-
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
82-
83-
go_rules_dependencies()
84-
85-
go_register_toolchains()

gax/BUILD.bazel

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ package(default_visibility = ["//visibility:public"])
1616

1717
licenses(["notice"]) # Apache 2.0
1818

19-
# Note: googleapis doesn't define a cc_proto_library for operations_proto,
20-
# so declare one here ourselves.
21-
cc_proto_library(
22-
name = "longrunning_cpp_proto",
23-
deps = ["@com_google_googleapis//google/longrunning:operations_proto"],
24-
)
25-
2619
cc_library(
2720
name = "gax",
2821
srcs = [
@@ -48,7 +41,7 @@ cc_library(
4841
],
4942
deps = [
5043
"@com_github_grpc_grpc//:grpc++",
51-
":longrunning_cpp_proto",
44+
"@com_google_googleapis//google/longrunning:longrunning_cc_proto",
5245
],
5346
)
5447

gax/repositories.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ def com_google_gapic_generator_cpp_gax_repositories():
1818
_maybe(
1919
http_archive,
2020
name = "com_github_grpc_grpc",
21-
strip_prefix = "grpc-cc75d93818410e2b0edd0fa3009a6def9ac403ca",
22-
urls = ["https://github.com/grpc/grpc/archive/cc75d93818410e2b0edd0fa3009a6def9ac403ca.tar.gz"],
21+
strip_prefix = "grpc-1.21.0",
22+
urls = ["https://github.com/grpc/grpc/archive/v1.21.0.tar.gz"],
2323
)
2424

2525
_maybe(
2626
http_archive,
2727
name = "com_google_googleapis",
28-
strip_prefix = "googleapis-1a479920eb4f6c2bc4c8d8acd9280720540709e4",
29-
urls = ["https://github.com/googleapis/googleapis/archive/1a479920eb4f6c2bc4c8d8acd9280720540709e4.tar.gz"],
28+
strip_prefix = "googleapis-c69355435cf6ae824a21f2bba31c69697733d3d2",
29+
urls = ["https://github.com/googleapis/googleapis/archive/c69355435cf6ae824a21f2bba31c69697733d3d2.tar.gz"],
3030
)
3131

3232
def _maybe(repo_rule, name, **kwargs):

generator/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ cc_library(
4040
deps = [
4141
"@absl//absl/base",
4242
"@absl//absl/strings",
43-
"@api_common_protos//google/api:client_cc_proto",
43+
"@com_google_googleapis//google/api:client_cc_proto",
4444
"@com_google_protobuf//:protoc_lib",
4545
],
4646
)
@@ -64,7 +64,7 @@ cc_test(
6464
data = [
6565
"//generator/testdata:library_proto",
6666
"//generator/testdata:library_service_baseline",
67-
"@api_common_protos//google/api:client_proto",
67+
"@com_google_googleapis//google/api:client_proto",
6868
"@com_google_protobuf//:descriptor_proto",
6969
],
7070
deps = [

generator/gapic_generator_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ TEST(GapicGeneratorBaselineTest, StandaloneTest) {
4444
"com_google_gapic_generator_cpp/generator/testdata/"
4545
"library_proto-descriptor-set.proto.bin",
4646
input_dir +
47-
"api_common_protos/google/api/client_proto-descriptor-set.proto.bin",
47+
"com_google_googleapis/google/api/"
48+
"client_proto-descriptor-set.proto.bin",
4849
input_dir +
4950
"com_google_protobuf/descriptor_proto-descriptor-set.proto.bin"};
5051
std::string package = "google.example.library.v1";

generator/testdata/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ proto_library(
66
name = "library_proto",
77
srcs = ["library.proto"],
88
visibility = ["//visibility:public"],
9-
deps = ["@api_common_protos//google/api:client_proto"],
9+
deps = ["@com_google_googleapis//google/api:client_proto"],
1010
)
1111

1212
proto_library_with_info(

repositories.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ def com_google_gapic_generator_cpp_repositories():
5252

5353
_maybe(
5454
http_archive,
55-
name = "api_common_protos",
56-
strip_prefix = "api-common-protos-87185dfffad4afa5a33a8c153f0e1ea53b4f85dc",
57-
urls = ["https://github.com/googleapis/api-common-protos/archive/87185dfffad4afa5a33a8c153f0e1ea53b4f85dc.tar.gz"],
55+
name = "com_google_googleapis",
56+
strip_prefix = "googleapis-c69355435cf6ae824a21f2bba31c69697733d3d2",
57+
urls = ["https://github.com/googleapis/googleapis/archive/c69355435cf6ae824a21f2bba31c69697733d3d2.tar.gz"],
5858
)
5959

6060
_maybe(

0 commit comments

Comments
 (0)