Skip to content

Commit 4b2d8fe

Browse files
committed
Switch to new_go_repository.
- Updates targets for go-related code. - Removes old custom BUILD files. - deps.bzl file cleanup. - Remove dangling third_part trunk. - Simplify travis to test //... - Apply buildifier. Support proto_library rules in external workspaces. - Fixes up the code to shift the execdir into the external workspace, then adjust all other paths relative to that. - Add prefix attribute to proto_compile rule. This fixes several bugs bug related to improper propogation of the go_prefix. - Fix descriptor_set path (was previously not offset). - Don't offset adjust import paths. Bump to v0.7.0.
1 parent e3cb432 commit 4b2d8fe

File tree

41 files changed

+293
-938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+293
-938
lines changed

.travis.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ script:
3131
--spawn_strategy=standalone \
3232
--genrule_strategy=standalone \
3333
--local_resources=400,1,1.0 \
34-
examples/helloworld/cpp/... \
35-
examples/helloworld/go/... \
36-
examples/helloworld/java/... \
37-
examples/helloworld/closure/... \
38-
examples/wkt/... \
39-
tests/... \
34+
//examples/helloworld/closure/... \
35+
//examples/helloworld/cpp/... \
36+
//examples/helloworld/go/... \
37+
//examples/helloworld/grpc_gateway/... \
38+
//examples/helloworld/java/... \
39+
//examples/wkt/... \
40+
//tests/... \
4041
$FLAGS
4142
4243
notifications:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
buildify_all:
1+
fmt:
22
buildifier WORKSPACE
33
find bzl/build_file/ -name '*.BUILD' | xargs buildifier
44
find third_party/ -name BUILD | xargs buildifier

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ language-specific `*_proto_repositories` rule(s):
9090
git_repository(
9191
name = "org_pubref_rules_protobuf",
9292
remote = "https://github.com/pubref/rules_protobuf",
93-
tag = "v0.6.4",
93+
tag = "v0.7.0",
9494
)
9595

9696
load("@org_pubref_rules_protobuf//java:rules.bzl", "java_proto_repositories")

WORKSPACE

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ closure_repositories()
3434

3535
git_repository(
3636
name = "io_bazel_rules_dotnet",
37-
commit = "b23e796dd0be27f35867590309d79ffe278d4eeb",
38-
remote = "https://github.com/pcj/rules_dotnet.git",
37+
commit = "9283e4596fbadd7fed237b5c462dfd687c15d301",
38+
remote = "https://github.com/bazelbuild/rules_dotnet.git",
3939
)
4040

4141
load("@io_bazel_rules_dotnet//dotnet:csharp.bzl", "csharp_repositories")
@@ -46,11 +46,6 @@ csharp_repositories(use_local_mono = False)
4646
# node_proto_library support requires rules_node
4747
# ================================================================
4848

49-
# local_repository(
50-
# name = "org_pubref_rules_node",
51-
# path = "/Users/pcj/github/rules_node",
52-
# )
53-
5449
git_repository(
5550
name = "org_pubref_rules_node",
5651
commit = "d93a80ac4920c52da8adccbca66a3118a27018fd", # Oct 2, 2016
@@ -66,35 +61,99 @@ node_repositories()
6661
# ================================================================
6762

6863
load("//protobuf:rules.bzl", "proto_repositories")
64+
6965
proto_repositories()
7066

7167
load("//cpp:rules.bzl", "cpp_proto_repositories")
68+
7269
cpp_proto_repositories()
7370

7471
load("//csharp:rules.bzl", "csharp_proto_repositories")
72+
7573
csharp_proto_repositories()
7674

7775
load("//java:rules.bzl", "java_proto_repositories", "nano_proto_repositories")
76+
7877
java_proto_repositories()
78+
7979
nano_proto_repositories()
8080

8181
load("//go:rules.bzl", "go_proto_repositories")
82+
8283
go_proto_repositories()
8384

8485
load("//gogo:rules.bzl", "gogo_proto_repositories")
86+
8587
gogo_proto_repositories()
8688

8789
load("//grpc_gateway:rules.bzl", "grpc_gateway_proto_repositories")
90+
8891
grpc_gateway_proto_repositories()
8992

9093
load("//node:rules.bzl", "node_proto_repositories")
94+
9195
node_proto_repositories()
9296

9397
load("//objc:rules.bzl", "objc_proto_repositories")
98+
9499
objc_proto_repositories()
95100

96101
load("//python:rules.bzl", "py_proto_repositories")
102+
97103
py_proto_repositories()
98104

99105
load("//ruby:rules.bzl", "ruby_proto_repositories")
106+
100107
ruby_proto_repositories()
108+
109+
# ================================================================
110+
# This is for testing
111+
# ================================================================
112+
113+
local_repository(
114+
name = "org_pubref_rules_protobuf",
115+
path = ".",
116+
)
117+
118+
GOOGLEAPIS_BUILD_FILE = """
119+
package(default_visibility = ["//visibility:public"])
120+
121+
load("@io_bazel_rules_go//go:def.bzl", "go_prefix")
122+
go_prefix("github.com/googleapis/googleapis")
123+
124+
load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cc_proto_library")
125+
load("@org_pubref_rules_protobuf//java:rules.bzl", "java_proto_library")
126+
load("@org_pubref_rules_protobuf//go:rules.bzl", "go_proto_library")
127+
128+
cc_proto_library(
129+
name = "cc_label_proto",
130+
protos = [
131+
"google/api/label.proto",
132+
],
133+
verbose = 0,
134+
)
135+
java_proto_library(
136+
name = "java_label_proto",
137+
protos = [
138+
"google/api/label.proto",
139+
],
140+
# Neither seem to be necessary, for either 3 langs
141+
#imports = ["../../external/com_github_google_protobuf/src", "."],
142+
#inputs = ["@com_github_google_protobuf//:well_known_protos"],
143+
verbose = 0,
144+
)
145+
go_proto_library(
146+
name = "go_label_proto",
147+
protos = [
148+
"google/api/label.proto",
149+
],
150+
verbose = 0,
151+
)
152+
"""
153+
154+
new_git_repository(
155+
name = "com_github_googleapis_googleapis",
156+
build_file_content = GOOGLEAPIS_BUILD_FILE,
157+
commit = "60c2f9c8d012db35a65539e30fb6364c36f2e96b",
158+
remote = "https://github.com/googleapis/googleapis.git",
159+
)

cpp/deps.bzl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# ****************************************************************
2-
# List of external dependencies
3-
# ****************************************************************
4-
51
DEPS = {
62

73
# Grpc repo is required by multiple languages but we put it here.

csharp/deps.bzl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# ****************************************************************
2-
# List of external dependencies
3-
# ****************************************************************
4-
51
PROTOBUF_BUILD_FILE = """
62
load("@io_bazel_rules_dotnet//dotnet:csharp.bzl", "dll_import")
73
dll_import(
@@ -48,4 +44,9 @@ DEPS = {
4844
"build_file_content": GRPC_BUILD_FILE,
4945
},
5046

47+
"protoc_gen_grpc_csharp": {
48+
"rule": "bind",
49+
"actual": "@com_github_grpc_grpc//:grpc_csharp_plugin",
50+
},
51+
5152
}

csharp/rules.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def csharp_proto_repositories(
77
omit_cpp_repositories = False,
88
lang_deps = DEPS,
99
lang_requires = [
10+
"protoc_gen_grpc_csharp",
1011
"nuget_google_protobuf",
1112
"nuget_grpc",
1213
], **kwargs):

examples/helloworld/closure/BUILD

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ load("//closure:rules.bzl", "closure_proto_library")
77
closure_proto_library(
88
name = "protolib",
99
protos = [
10-
"//examples/proto:protos",
1110
"//examples/helloworld/proto:protos",
11+
"//examples/proto:protos",
1212
],
1313
verbose = 0,
1414
)
@@ -19,23 +19,22 @@ closure_js_library(
1919
"greeter.js",
2020
#"protolib.pb",
2121
],
22-
2322
deps = [
2423
"protolib",
25-
"@io_bazel_rules_closure//closure/protobuf:jspb",
2624
"@io_bazel_rules_closure//closure/library",
25+
"@io_bazel_rules_closure//closure/protobuf:jspb",
2726
],
2827
)
2928

3029
closure_js_test(
3130
name = "greeter_test",
3231
srcs = ["greeter_test.js"],
33-
pedantic = True,
3432
compilation_level = "SIMPLE",
33+
pedantic = True,
3534
deps = [
3635
"greeter",
3736
"protolib",
38-
"@io_bazel_rules_closure//closure/protobuf:jspb",
3937
"@io_bazel_rules_closure//closure/library:testing",
38+
"@io_bazel_rules_closure//closure/protobuf:jspb",
4039
],
4140
)

examples/helloworld/go/client/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ load(
55
"//go:rules.bzl",
66
GO_GRPC_COMPILE_DEPS = "GRPC_COMPILE_DEPS",
77
)
8-
#load("//gogo:rules.bzl", GOGO_GRPC_COMPILE_DEPS = "GRPC_COMPILE_DEPS")
98

109
go_binary(
1110
name = "client",
1211
srcs = ["main.go"],
1312
deps = ["//examples/helloworld/proto:go"] + GO_GRPC_COMPILE_DEPS,
1413
)
1514

15+
#load("//gogo:rules.bzl", GOGO_GRPC_COMPILE_DEPS = "GRPC_COMPILE_DEPS")
16+
#
1617
# To enable this, uncomment and change the importpath to 'gogo' in
1718
# main.go.
1819
#

examples/helloworld/grpc_gateway/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ go_test(
3939
":gateway",
4040
"//examples/helloworld/go/server:greeter",
4141
"//examples/helloworld/proto:go",
42-
"@com_github_golang_protobuf//:jsonpb",
42+
"@com_github_golang_protobuf//jsonpb:go_default_library",
4343
] + GRPC_GATEWAY_DEPS,
4444
)

0 commit comments

Comments
 (0)