github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/tools/bazel-rules/gogo.bzl (about)

     1  load("@io_bazel_rules_go//go:def.bzl", "go_repository")
     2  
     3  
     4  _BUILD_FILE = """
     5  proto_library(
     6      name = "gogoproto",
     7      srcs = ["gogo.proto"],
     8      deps = [
     9          "@com_google_protobuf//:descriptor_proto",
    10      ],
    11      visibility = ["//visibility:public"],
    12  )
    13  """
    14  
    15  def _go_repository_impl(ctx):
    16    ctx.file("BUILD.bazel", content="")
    17    ctx.file("github.com/gogo/protobuf/gogoproto/BUILD.bazel", content=_BUILD_FILE)
    18    ctx.template("github.com/gogo/protobuf/gogoproto/gogo.proto", ctx.attr._proto)
    19  
    20  _gogo_proto_repository = repository_rule(
    21      implementation = _go_repository_impl,
    22      attrs = {
    23          "_proto": attr.label(default="//vendor/github.com/gogo/protobuf/gogoproto:gogo.proto"),
    24      },
    25  )
    26  
    27  def gogo_dependencies():
    28    go_repository(
    29        name = "com_github_gogo_protobuf",
    30        importpath = "github.com/gogo/protobuf",
    31        urls = ["https://codeload.github.com/ianthehat/protobuf/zip/2adc21fd136931e0388e278825291678e1d98309"],
    32        strip_prefix = "protobuf-2adc21fd136931e0388e278825291678e1d98309",
    33        type = "zip",
    34        build_file_proto_mode="disable",
    35    )
    36    _gogo_proto_repository(name = "internal_gogo_proto_repository")