1# Copyright 2022 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"""Providers for Python rules.""" 15 16load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") 17load(":util.bzl", "define_bazel_6_provider") 18 19def _PyCcLinkParamsInfo_init(cc_info): 20 return { 21 "cc_info": CcInfo(linking_context = cc_info.linking_context), 22 } 23 24# buildifier: disable=name-conventions 25PyCcLinkParamsInfo, _unused_raw_py_cc_link_params_provider_ctor = define_bazel_6_provider( 26 doc = ("Python-wrapper to forward {obj}`CcInfo.linking_context`. This is to " + 27 "allow Python targets to propagate C++ linking information, but " + 28 "without the Python target appearing to be a valid C++ rule dependency"), 29 init = _PyCcLinkParamsInfo_init, 30 fields = { 31 "cc_info": """ 32:type: CcInfo 33 34Linking information; it has only {obj}`CcInfo.linking_context` set. 35""", 36 }, 37) 38