Avoid recursive call to `Insert` in the flat case.
[google-protobuf.git] / bazel / proto_library.bzl
blob336623067d4e6a0d1e818f1cb4713470295fa991
1 # Protocol Buffers - Google's data interchange format
2 # Copyright 2008 Google Inc.  All rights reserved.
4 # Use of this source code is governed by a BSD-style
5 # license that can be found in the LICENSE file or at
6 # https://developers.google.com/open-source/licenses/bsd
7 """
8 Macro of proto_library rule.
9 """
11 load("@proto_bazel_features//:features.bzl", "bazel_features")
12 load("//bazel/private:bazel_proto_library_rule.bzl", _proto_library = "proto_library")
14 def proto_library(**kwattrs):
15     # This condition causes Starlark rules to be used only on Bazel >=7.0.0
16     if bazel_features.proto.starlark_proto_info:
17         _proto_library(**kwattrs)
18     else:
19         # On older Bazel versions keep using native rules, so that mismatch in ProtoInfo doesn't happen
20         native.proto_library(**kwattrs)