load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@grpc_ecosystem_grpc_gateway//protoc-gen-swagger:defs.bzl", "protoc_gen_swagger") package(default_visibility = ["//visibility:public"]) # TODO(yannic): Add examples/tests that use import_prefix/strip_import_prefix. # gazelle:exclude a_bit_of_everything.pb.gw.go # gazelle:exclude echo_service.pb.gw.go # gazelle:exclude flow_combination.pb.gw.go # gazelle:exclude generated_input.proto # gazelle:exclude non_standard_names.pb.gw.go # gazelle:exclude response_body_service.pb.gw.go # gazelle:exclude stream.pb.gw.go # gazelle:exclude use_go_template.pb.gw.go # gazelle:exclude wrappers.pb.gw.go genrule( name = "generated_proto", srcs = ["generated_input.proto"], outs = ["generated_output.proto"], cmd = "cp $< $@", # A simple copy simulates a generated proto file. ) proto_library( name = "examplepb_proto", srcs = [ "a_bit_of_everything.proto", "echo_service.proto", "flow_combination.proto", "generated_output.proto", "non_standard_names.proto", "response_body_service.proto", "stream.proto", "unannotated_echo_service.proto", "use_go_template.proto", "wrappers.proto", ], deps = [ "//examples/internal/proto/pathenum:pathenum_proto", "//examples/internal/proto/sub:sub_proto", "//examples/internal/proto/sub2:sub2_proto", "//protoc-gen-swagger/options:options_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:empty_proto", "@com_google_protobuf//:field_mask_proto", "@com_google_protobuf//:timestamp_proto", "@com_google_protobuf//:wrappers_proto", "@go_googleapis//google/api:annotations_proto", ], ) go_proto_library( name = "examplepb_go_proto", compilers = [ "@io_bazel_rules_go//proto:go_grpc", "//protoc-gen-grpc-gateway:go_gen_grpc_gateway", # keep ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb", proto = ":examplepb_proto", deps = [ "//examples/internal/proto/pathenum:go_default_library", "//examples/internal/proto/sub:go_default_library", "//examples/internal/proto/sub2:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", # keep "@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/internal/proto/examplepb", deps = [ "//runtime:go_default_library", "//utilities:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@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", ], ) protoc_gen_swagger( name = "examplepb_protoc_gen_swagger", proto = ":examplepb_proto", ) protoc_gen_swagger( name = "examplepb_protoc_gen_swagger_merged", proto = ":examplepb_proto", single_output = True, # Outputs a single swagger.json file. )