Skip to content

Commit

Permalink
Upgrade to rules_go 0.17.0
Browse files Browse the repository at this point in the history
Also fixes #873
  • Loading branch information
achew22 committed Feb 23, 2019
1 parent 6806a84 commit 121c47c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
13 changes: 2 additions & 11 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,9 @@ buildifier(

# gazelle:exclude third_party
# gazelle:exclude vendor
# gazelle:prefix github.com/grpc-ecosystem/grpc-gateway

gazelle(
name = "gazelle_diff",
mode = "diff",
prefix = "github.com/grpc-ecosystem/grpc-gateway",
)

gazelle(
name = "gazelle_fix",
mode = "fix",
prefix = "github.com/grpc-ecosystem/grpc-gateway",
)
gazelle(name = "gazelle")

package_group(
name = "generators",
Expand Down
12 changes: 3 additions & 9 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

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

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

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

go_rules_dependencies()

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

gazelle_dependencies()

load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains()

load("@bazel_gazelle//:deps.bzl", "go_repository")

# Also define in Gopkg.toml
Expand Down
10 changes: 6 additions & 4 deletions protoc-gen-swagger/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action
sibling = proto,
)

inputs = direct_proto_srcs + transitive_proto_srcs + [protoc_gen_swagger]
inputs = direct_proto_srcs + transitive_proto_srcs
tools = [protoc_gen_swagger]

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

actions.run(
executable = protoc,
inputs = inputs,
tools = tools,
outputs = [swagger_file],
arguments = [args],
)
Expand All @@ -68,7 +70,7 @@ def _proto_gen_swagger_impl(ctx):
proto = ctx.attr.proto.proto
grpc_api_configuration = ctx.file.grpc_api_configuration

return struct(
return [DefaultInfo(
files = depset(
_run_proto_gen_swagger(
ctx,
Expand All @@ -80,7 +82,7 @@ def _proto_gen_swagger_impl(ctx):
grpc_api_configuration = grpc_api_configuration,
),
),
)
)]

protoc_gen_swagger = rule(
attrs = {
Expand Down

0 comments on commit 121c47c

Please sign in to comment.