...

Text file src/github.com/bazelbuild/rules_go/proto/gogo.bzl

Documentation: github.com/bazelbuild/rules_go/proto

     1# Copyright 2017 The Bazel Authors. All rights reserved.
     2#
     3# Licensed under the Apache License, Version 2.0 (the "License");
     4# you may not use this file except in compliance with the License.
     5# You may obtain a copy of the License at
     6#
     7#    http://www.apache.org/licenses/LICENSE-2.0
     8#
     9# Unless required by applicable law or agreed to in writing, software
    10# distributed under the License is distributed on an "AS IS" BASIS,
    11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12# See the License for the specific language governing permissions and
    13# limitations under the License.
    14
    15def _gogo_special_proto_impl(ctx):
    16    ctx.file("WORKSPACE", 'workspace(name = "{}")'.format(ctx.name))
    17    ctx.file("BUILD.bazel", "")
    18    ctx.symlink(
    19        ctx.path(Label("@com_github_gogo_protobuf//gogoproto:gogo.proto")),
    20        "github.com/gogo/protobuf/gogoproto/gogo.proto",
    21    )
    22    ctx.file("github.com/gogo/protobuf/gogoproto/BUILD.bazel", """
    23load("@rules_proto//proto:defs.bzl", "proto_library")
    24
    25proto_library(
    26    name = "gogoproto",
    27    srcs = [":gogo.proto"],
    28    tags = ["manual"],
    29    visibility = ["//visibility:public"],
    30    deps = [
    31        "@com_google_protobuf//:descriptor_proto",
    32    ],
    33)
    34  """)
    35
    36gogo_special_proto = repository_rule(
    37    _gogo_special_proto_impl,
    38    attrs = {
    39        "proto": attr.label(allow_single_file = True),
    40    },
    41)

View as plain text