...

Text file src/github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb/BUILD.bazel

Documentation: github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb

     1load("@rules_proto//proto:defs.bzl", "proto_library")
     2load("@io_bazel_rules_go//go:def.bzl", "go_library")
     3load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
     4load("@grpc_ecosystem_grpc_gateway//protoc-gen-openapiv2:defs.bzl", "protoc_gen_openapiv2")
     5
     6package(default_visibility = ["//visibility:public"])
     7
     8# TODO(yannic): Add examples/tests that use import_prefix/strip_import_prefix.
     9
    10# gazelle:exclude a_bit_of_everything.pb.gw.go
    11# gazelle:exclude a_bit_of_everything_grpc.pb.go
    12# gazelle:exclude echo_service.pb.gw.go
    13# gazelle:exclude echo_service_grpc.pb.go
    14# gazelle:exclude flow_combination.pb.gw.go
    15# gazelle:exclude flow_combination_grpc.pb.go
    16# gazelle:exclude generate_unbound_methods.pb.gw.go
    17# gazelle:exclude generate_unbound_methods_grpc.pb.go
    18# gazelle:exclude generated_input.proto
    19# gazelle:exclude non_standard_names.pb.gw.go
    20# gazelle:exclude non_standard_names_grpc.pb.go
    21# gazelle:exclude response_body_service.pb.gw.go
    22# gazelle:exclude response_body_service_grpc.pb.go
    23# gazelle:exclude stream.pb.gw.go
    24# gazelle:exclude stream_grpc.pb.go
    25# gazelle:exclude use_go_template.pb.gw.go
    26# gazelle:exclude use_go_template_grpc.pb.go
    27# gazelle:exclude ignore_comment.pb.gw.go
    28# gazelle:exclude remove_internal_comment.pb.gw.go
    29# gazelle:exclude ignore_comment_grpc.pb.go
    30# gazelle:exclude wrappers.pb.gw.go
    31# gazelle:exclude wrappers_grpc.pb.go
    32# gazelle:exclude unannotated_echo_service.pb.gw.go
    33# gazelle:exclude unannotated_echo_service_grpc.pb.go
    34# gazelle:exclude visibility_rule_echo_service.pb.gw.go
    35# gazelle:exclude visibility_rule_echo_service_grpc.pb.go
    36# gazelle:exclude openapi_merge_a.proto
    37# gazelle:exclude openapi_merge_b.proto
    38# gazelle:go_grpc_compilers //:go_apiv2, //:go_grpc, //protoc-gen-grpc-gateway:go_gen_grpc_gateway
    39
    40genrule(
    41    name = "generated_proto",
    42    srcs = ["generated_input.proto"],
    43    outs = ["generated_output.proto"],
    44    cmd = "cp $< $@",  # A simple copy simulates a generated proto file.
    45)
    46
    47proto_library(
    48    name = "examplepb_proto",
    49    srcs = [
    50        "a_bit_of_everything.proto",
    51        "echo_service.proto",
    52        "flow_combination.proto",
    53        "generate_unbound_methods.proto",
    54        "generated_output.proto",
    55        "ignore_comment.proto",
    56        "non_standard_names.proto",
    57        "remove_internal_comment.proto",
    58        "response_body_service.proto",
    59        "stream.proto",
    60        "unannotated_echo_service.proto",
    61        "use_go_template.proto",
    62        "visibility_rule_echo_service.proto",
    63        "wrappers.proto",
    64    ],
    65    deps = [
    66        "//examples/internal/proto/oneofenum:oneofenum_proto",
    67        "//examples/internal/proto/pathenum:pathenum_proto",
    68        "//examples/internal/proto/sub:sub_proto",
    69        "//examples/internal/proto/sub2:sub2_proto",
    70        "//protoc-gen-openapiv2/options:options_proto",
    71        "@com_google_protobuf//:duration_proto",
    72        "@com_google_protobuf//:empty_proto",
    73        "@com_google_protobuf//:field_mask_proto",
    74        "@com_google_protobuf//:struct_proto",
    75        "@com_google_protobuf//:timestamp_proto",
    76        "@com_google_protobuf//:wrappers_proto",
    77        "@googleapis//google/api:annotations_proto",
    78        "@googleapis//google/api:field_behavior_proto",
    79        "@googleapis//google/api:httpbody_proto",
    80        "@googleapis//google/api:visibility_proto",
    81        "@googleapis//google/rpc:status_proto",
    82    ],
    83)
    84
    85#keep
    86proto_library(
    87    name = "openapi_merge_proto",
    88    srcs = [
    89        "openapi_merge_a.proto",
    90        "openapi_merge_b.proto",
    91    ],
    92    deps = [
    93        "@com_google_protobuf//:api_proto",
    94        "@googleapis//google/api:annotations_proto",
    95        "@googleapis//google/api:field_behavior_proto",
    96        "@googleapis//google/rpc:status_proto",
    97    ],
    98)
    99
   100go_proto_library(
   101    name = "examplepb_go_proto",
   102    compilers = [
   103        "//:go_apiv2",
   104        "//:go_grpc",
   105        "//protoc-gen-grpc-gateway:go_gen_grpc_gateway",
   106    ],
   107    importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb",
   108    proto = ":examplepb_proto",
   109    deps = [
   110        "//examples/internal/proto/oneofenum",
   111        "//examples/internal/proto/pathenum",
   112        "//examples/internal/proto/sub",
   113        "//examples/internal/proto/sub2",
   114        "//protoc-gen-openapiv2/options",
   115        "@com_github_golang_protobuf//descriptor:go_default_library_gen",  # keep
   116        "@org_golang_google_genproto_googleapis_api//annotations",
   117        "@org_golang_google_genproto_googleapis_api//httpbody",
   118        "@org_golang_google_genproto_googleapis_api//visibility",
   119        "@org_golang_google_genproto_googleapis_rpc//status",
   120    ],
   121)
   122
   123go_library(
   124    name = "examplepb",
   125    srcs = [
   126        "openapi_merge_a.pb.go",
   127        "openapi_merge_a.pb.gw.go",
   128        "openapi_merge_a_grpc.pb.go",
   129        "openapi_merge_b.pb.go",
   130        "openapi_merge_b.pb.gw.go",
   131        "openapi_merge_b_grpc.pb.go",
   132    ],
   133    embed = [":examplepb_go_proto"],
   134    importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb",
   135    deps = [
   136        "//runtime",
   137        "//utilities",
   138        "@org_golang_google_genproto_googleapis_api//annotations",
   139        "@org_golang_google_grpc//:go_default_library",
   140        "@org_golang_google_grpc//codes",
   141        "@org_golang_google_grpc//grpclog",
   142        "@org_golang_google_grpc//metadata",
   143        "@org_golang_google_grpc//status",
   144        "@org_golang_google_protobuf//proto",
   145        "@org_golang_google_protobuf//reflect/protoreflect",
   146        "@org_golang_google_protobuf//runtime/protoimpl",
   147    ],
   148)
   149
   150protoc_gen_openapiv2(
   151    name = "examplepb_protoc_gen_openapiv2",
   152    proto = ":examplepb_proto",
   153)
   154
   155protoc_gen_openapiv2(
   156    name = "examplepb_protoc_gen_openapiv2_merged",
   157    proto = ":examplepb_proto",
   158    single_output = True,  # Outputs a single swagger.json file.
   159)
   160
   161protoc_gen_openapiv2(
   162    name = "examplepb_openapi_merge",
   163    proto = ":openapi_merge_proto",
   164    single_output = True,  # Outputs a single swagger.json file.
   165)
   166
   167alias(
   168    name = "go_default_library",
   169    actual = ":examplepb",
   170    visibility = ["//examples:__subpackages__"],
   171)

View as plain text