Skip to content

Commit

Permalink
Update rules_go and gazelle (#802)
Browse files Browse the repository at this point in the history
* Update rules_go and gazelle

This requires/allows the following changes:
- rerun Gazelle to regenerate the build files
- fix marshal_jsonpb_test to assert correct behavior when
  EnumsAsInts == false
- remove `repositories.bzl` (replaced by @go_googleapis)

Also, enforce up-to-date build files in the CI check.

Note: this version of the commit includes an out-of-date BUILD file to
test the CI check.

* Update Gopkg.toml and Gopkg.lock

* Update generated proto code

The generated code changed with the updated dependencies.

* Fix node_test

Enum values inside maps are now supported.
  • Loading branch information
drigz authored and achew22 committed Nov 13, 2018
1 parent aa4f5a4 commit a7c0cd0
Show file tree
Hide file tree
Showing 32 changed files with 420 additions and 430 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ jobs:
- checkout
- run: 'bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:buildifier_check ||
(echo "Bazel files not formatted, please run \`bazel run :buildifier\`"; exit 1)'
- run: bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:gazelle_diff
- run: 'test -z "$(bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:gazelle_diff)" ||
(echo "Bazel files out-of-date, please run \`bazel run :gazelle_diff\`"; exit 1)'
bazel_test:
docker:
- image: l.gcr.io/google/bazel:latest
Expand Down
26 changes: 18 additions & 8 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,30 @@ required = [

[[constraint]]
# Also defined in bazelbuild/rules_go
# https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L75
version = "1.1.0"
# https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L52
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
name = "github.com/golang/protobuf"

[[constraint]]
# Also defined in bazelbuild/rules_go
# https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L110
revision = "640f4622ab692b87c2f3a94265e6f579fe38263d"
# https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L96
revision = "4dfa2610cdf3b287375bbba5b8f2a14d3b01d8de"
name = "golang.org/x/net"

[[constraint]]
# Also defined in bazelbuild/rules_go
# https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L123
version = "1.10.3"
# https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L123
version = "1.15.0"
name = "google.golang.org/grpc"

[[constraint]]
# Also defined in bazelbuild/rules_go
# https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L138
# https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L160
revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998"
name = "github.com/golang/glog"

[[override]]
# Also defined in bazelbuild/rules_go
# https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L117
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
# https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L117
version = "0.3.0"
name = "golang.org/x/text"
22 changes: 13 additions & 9 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ workspace(name = "grpc_ecosystem_grpc_gateway")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# master as of 2018-11-09. This should be updated when a new release is tagged.
http_archive(
name = "io_bazel_rules_go",
sha256 = "8b68d0630d63d95dacc0016c3bb4b76154fe34fca93efd65d1c366de3fcb4294",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.12.1/rules_go-0.12.1.tar.gz",
sha256 = "c23db3b50b8822e153bc5accfea75baeecedb481a162391c4f3b9aec451e34b4",
strip_prefix = "rules_go-109c520465fcb418f2c4be967f3744d959ad66d3",
urls = [
"https://github.com/bazelbuild/rules_go/archive/109c520465fcb418f2c4be967f3744d959ad66d3.tar.gz",
],
)

# master as of 2018-11-09. This should be updated when a new release is tagged.
http_archive(
name = "bazel_gazelle",
sha256 = "d03625db67e9fb0905bbd206fa97e32ae9da894fe234a493e7517fd25faec914",
url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.10.1/bazel-gazelle-0.10.1.tar.gz",
sha256 = "a3af4a61d7b2f2c5386761f94a21f474871a32f0e94b13f08824248c4df25229",
strip_prefix = "bazel-gazelle-7b1e3c6eb5447c6647955fc93c012635f274f0f0",
urls = [
"https://github.com/bazelbuild/bazel-gazelle/archive/7b1e3c6eb5447c6647955fc93c012635f274f0f0.tar.gz",
],
)

http_archive(
Expand All @@ -21,12 +29,10 @@ http_archive(
url = "https://github.com/bazelbuild/buildtools/archive/e90e7cc6ef3e6d08d4ca8a982935c3eed638e058.tar.gz",
)

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

gazelle_dependencies()

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

# Also define in Gopkg.toml
Expand Down Expand Up @@ -64,8 +70,6 @@ go_repository(
importpath = "gopkg.in/yaml.v2",
)

repositories()

go_rules_dependencies()

go_register_toolchains()
Expand Down
8 changes: 4 additions & 4 deletions codegenerator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ go_library(
importpath = "github.com/grpc-ecosystem/grpc-gateway/codegenerator",
deps = [
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library",
"@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
],
)

go_test(
name = "go_default_xtest",
name = "go_default_test",
srcs = ["parse_req_test.go"],
embed = [":go_default_library"],
deps = [
":go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library",
"@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
],
)
3 changes: 1 addition & 2 deletions examples/browser/a_bit_of_everything_service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ describe('ABitOfEverythingService', function() {
],
repeated_string_value: ["a", "b", "c"],
oneof_string: "x",
// TODO(yugui) Support enum by name
map_value: { a: 1, b: 2 },
map_value: { a: "ONE", b: 2 },
mapped_string_value: { a: "x", b: "y" },
mapped_nested_value: {
a: { name: "x", amount: 1 },
Expand Down
19 changes: 19 additions & 0 deletions examples/clients/responsebody/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = [
"api_client.go",
"api_response.go",
"configuration.go",
"examplepb_response_body_message.go",
"examplepb_response_body_message_response.go",
"examplepb_response_body_out.go",
"examplepb_response_body_out_response.go",
"examplepb_response_body_req.go",
"response_body_service_api.go",
],
importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/responsebody",
visibility = ["//visibility:public"],
deps = ["@com_github_go_resty_resty//:go_default_library"],
)
8 changes: 4 additions & 4 deletions examples/integration/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "go_default_xtest",
name = "go_default_test",
srcs = [
"client_test.go",
"integration_test.go",
Expand All @@ -19,10 +19,10 @@ go_test(
"//examples/server:go_default_library",
"//runtime:go_default_library",
"@com_github_golang_glog//:go_default_library",
"@com_github_golang_protobuf//jsonpb:go_default_library",
"@com_github_golang_protobuf//jsonpb:go_default_library_gen",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//ptypes/empty:go_default_library",
"@org_golang_google_genproto//googleapis/rpc/status:go_default_library",
"@go_googleapis//google/rpc:status_go_proto",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@org_golang_google_grpc//codes:go_default_library",
],
)
19 changes: 13 additions & 6 deletions examples/proto/examplepb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ proto_library(
"//examples/proto/sub:sub_proto",
"//examples/proto/sub2:sub2_proto",
"//protoc-gen-swagger/options:options_proto",
"@com_github_googleapis_googleapis//google/api:api_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
"@go_googleapis//google/api:annotations_proto",
],
)

Expand All @@ -48,18 +48,25 @@ go_proto_library(
"//examples/proto/sub:go_default_library",
"//examples/proto/sub2:go_default_library",
"//protoc-gen-swagger/options:go_default_library",
"@com_github_golang_protobuf//ptypes/duration:go_default_library",
"@com_github_golang_protobuf//ptypes/empty:go_default_library",
"@com_github_golang_protobuf//ptypes/timestamp:go_default_library",
"@com_github_golang_protobuf//ptypes/wrappers:go_default_library",
"@com_github_googleapis_googleapis//google/api:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
],
)

go_library(
name = "go_default_library",
srcs = ["unannotated_echo_service.pb.gw.go"],
embed = [":examplepb_go_proto"],
importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb",
deps = [
"//runtime:go_default_library",
"//utilities:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//grpclog:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@org_golang_x_net//context:go_default_library",
],
)

protoc_gen_swagger(
Expand Down
Loading

0 comments on commit a7c0cd0

Please sign in to comment.