1# Copyright 2024 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"""All providers for rule-based bazel toolchain config.""" 15 16load( 17 "//cc/toolchains/impl:nested_args.bzl", 18 "NESTED_ARGS_ATTRS", 19 "args_wrapper_macro", 20 "nested_args_provider_from_ctx", 21) 22load( 23 ":cc_toolchain_info.bzl", 24 "NestedArgsInfo", 25) 26 27visibility("public") 28 29_cc_nested_args = rule( 30 implementation = lambda ctx: [nested_args_provider_from_ctx(ctx)], 31 attrs = NESTED_ARGS_ATTRS, 32 provides = [NestedArgsInfo], 33 doc = """Declares a list of arguments bound to a set of actions. 34 35Roughly equivalent to ctx.actions.args() 36 37Examples: 38 cc_nested_args( 39 name = "warnings_as_errors", 40 args = ["-Werror"], 41 ) 42""", 43) 44 45cc_nested_args = lambda **kwargs: args_wrapper_macro(rule = _cc_nested_args, **kwargs) 46