• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2022 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14"""A custom wrapper for py_proto_library."""
15
16load("@com_google_protobuf//:protobuf.bzl", real_py_proto_library = "py_proto_library")
17
18def py_proto_library(**kwargs):
19    """A py_proto_library that respects the "manual" tag.
20
21    Actually it's a little _too_ respectful: it simply removes those targets
22    from the BUILD graph. This is good enough for our use case. Please do not
23    use this outside upstream Pigweed. (For downstream projects, this is
24    equivalent to just commenting out the BUILD target.)
25
26    See https://issues.pigweed.dev/issues/244743459 and
27    https://stackoverflow.com/q/74323506/1224002 for more context.
28    """
29    if "tags" not in kwargs or "manual" not in kwargs["tags"]:
30        real_py_proto_library(**kwargs)
31