| 1 |
# Copyright 2021 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 |
|
| 15 |
""" |
| 16 |
Proto Semantics |
| 17 |
""" |
| 18 |
|
| 19 |
semantics = struct( |
| 20 |
PROTO_TOOLCHAIN = "@rules_proto//proto:toolchain_type", |
| 21 |
# This constant is used in ProtoCompileActionBuilder to generate an error message that's |
| 22 |
# displayed when a strict proto deps violation occurs. |
| 23 |
# |
| 24 |
# %s is replaced with the label of the proto_library rule that's currently being built. |
| 25 |
# %%s is replaced with the literal "%s", which is passed to the proto-compiler, which replaces |
| 26 |
# it with the .proto file that violates strict proto deps. |
| 27 |
STRICT_DEPS_FLAG_TEMPLATE = ( |
| 28 |
"--direct_dependencies_violation_msg=" + |
| 29 |
"%%s is imported, but %s doesn't directly depend on a proto_library that 'srcs' it." |
| 30 |
), |
| 31 |
allowlist_different_package = None, |
| 32 |
) |