1# Copyright 2022 Google LLC 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# 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, 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"""Rules and macros for collecting package metdata providers.""" 15 16TraceInfo = provider( 17 doc = """Provides a target (as a string) to assist in debugging dependency issues.""", 18 fields = { 19 "trace": "String: a target to trace dependency edges to.", 20 }, 21) 22 23def _trace_impl(ctx): 24 return TraceInfo(trace = ctx.build_setting_value) 25 26trace = rule( 27 doc = """Used to allow the specification of a target to trace while collecting license dependencies.""", 28 implementation = _trace_impl, 29 build_setting = config.string(flag = True), 30) 31