1# Copyright 2022 Google LLC. 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"""Android Lint toolchain for Kotlin.""" 16 17load("//:visibility.bzl", "RULES_KOTLIN") 18load("//bazel:stubs.bzl", "lint_actions") 19 20visibility(RULES_KOTLIN) 21 22_ATTRS = dict( 23 _android_lint_baseline_file = attr.label( 24 allow_single_file = True, 25 cfg = "exec", 26 ), 27) 28 29def _set_baselines(): 30 return { 31 # `$foo` is used to set `_foo` 32 "$android_lint_baseline_file": lint_actions.get_android_lint_baseline_file(native.package_name()), 33 } 34 35androidlint_toolchains = struct( 36 attrs = _ATTRS, 37 get_baseline = lambda ctx: getattr(ctx.file, "_android_lint_baseline_file", None), 38 set_baselines = _set_baselines, 39) 40