1# Copyright (C) 2023 The Android Open Source Project 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 15load("@rules_kotlin//toolchains/kotlin_jvm:kt_jvm_toolchains.bzl", "kt_jvm_toolchain", "kt_jvm_toolchains") 16load("//build/bazel/rules/java:versions.bzl", "java_versions") 17 18kt_jvm_version_select_dict = { 19 "//build/bazel/rules/java:host_" + setting: [java_versions.kt_jvm_version_from_normalized_java_version(version)] 20 for version, setting in java_versions.VERSION_TO_CONFIG_SETTING.items() 21} | { 22 "//conditions:default": [java_versions.kt_jvm_version_from_normalized_java_version(java_versions.get_version())], 23} 24 25kt_jvm_toolchain( 26 name = "kt_jvm_toolchain_linux_jdk", 27 android_java8_apis_desugared = False, 28 kotlinc_cli_flags = ["-jvm-target"] + select(kt_jvm_version_select_dict), 29 kotlinc_ide_flags = ["-jvm-target"] + select(kt_jvm_version_select_dict), 30 visibility = ["//visibility:public"], 31) 32 33toolchain( 34 name = "kt_jvm_toolchain_linux", 35 exec_compatible_with = [ 36 "@platforms//os:linux", 37 ], 38 toolchain = ":kt_jvm_toolchain_linux_jdk", 39 toolchain_type = kt_jvm_toolchains.type, 40 visibility = ["//visibility:public"], 41) 42