Skip to content

Commit 121c47c

Browse files
committed
Upgrade to rules_go 0.17.0
Also fixes #873
1 parent 6806a84 commit 121c47c

File tree

3 files changed

+11
-24
lines changed

3 files changed

+11
-24
lines changed

BUILD

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,9 @@ buildifier(
1212

1313
# gazelle:exclude third_party
1414
# gazelle:exclude vendor
15+
# gazelle:prefix github.com/grpc-ecosystem/grpc-gateway
1516

16-
gazelle(
17-
name = "gazelle_diff",
18-
mode = "diff",
19-
prefix = "github.com/grpc-ecosystem/grpc-gateway",
20-
)
21-
22-
gazelle(
23-
name = "gazelle_fix",
24-
mode = "fix",
25-
prefix = "github.com/grpc-ecosystem/grpc-gateway",
26-
)
17+
gazelle(name = "gazelle")
2718

2819
package_group(
2920
name = "generators",

WORKSPACE

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
55

66
http_archive(
77
name = "io_bazel_rules_go",
8-
sha256 = "7be7dc01f1e0afdba6c8eb2b43d2fa01c743be1b9273ab1eaf6c233df078d705",
9-
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.16.5/rules_go-0.16.5.tar.gz"],
8+
sha256 = "492c3ac68ed9dcf527a07e6a1b2dcbf199c6bf8b35517951467ac32e421c06c1",
9+
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.0/rules_go-0.17.0.tar.gz"],
1010
)
1111

1212
http_archive(
@@ -15,7 +15,7 @@ http_archive(
1515
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"],
1616
)
1717

18-
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
18+
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
1919

2020
go_rules_dependencies()
2121

@@ -25,12 +25,6 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
2525

2626
gazelle_dependencies()
2727

28-
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
29-
30-
go_rules_dependencies()
31-
32-
go_register_toolchains()
33-
3428
load("@bazel_gazelle//:deps.bzl", "go_repository")
3529

3630
# Also define in Gopkg.toml

protoc-gen-swagger/defs.bzl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action
3838
sibling = proto,
3939
)
4040

41-
inputs = direct_proto_srcs + transitive_proto_srcs + [protoc_gen_swagger]
41+
inputs = direct_proto_srcs + transitive_proto_srcs
42+
tools = [protoc_gen_swagger]
4243

4344
options = ["logtostderr=true", "allow_repeated_fields_in_body=true"]
4445
if grpc_api_configuration:
@@ -50,12 +51,13 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action
5051
args = actions.args()
5152
args.add("--plugin=%s" % protoc_gen_swagger.path)
5253
args.add("--swagger_out=%s:%s" % (",".join(options), ctx.bin_dir.path))
53-
args.add(["-I%s" % include for include in includes])
54+
args.add_all(["-I%s" % include for include in includes])
5455
args.add(proto.path)
5556

5657
actions.run(
5758
executable = protoc,
5859
inputs = inputs,
60+
tools = tools,
5961
outputs = [swagger_file],
6062
arguments = [args],
6163
)
@@ -68,7 +70,7 @@ def _proto_gen_swagger_impl(ctx):
6870
proto = ctx.attr.proto.proto
6971
grpc_api_configuration = ctx.file.grpc_api_configuration
7072

71-
return struct(
73+
return [DefaultInfo(
7274
files = depset(
7375
_run_proto_gen_swagger(
7476
ctx,
@@ -80,7 +82,7 @@ def _proto_gen_swagger_impl(ctx):
8082
grpc_api_configuration = grpc_api_configuration,
8183
),
8284
),
83-
)
85+
)]
8486

8587
protoc_gen_swagger = rule(
8688
attrs = {

0 commit comments

Comments
 (0)