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 15"""An empty toolchain that does nothing.""" 16 17def _empty_toolchain_impl(_ctx): 18 return platform_common.ToolchainInfo() 19 20_empty_toolchain = rule( 21 implementation = _empty_toolchain_impl, 22) 23 24def empty_toolchain( 25 name, 26 toolchain_type, 27 **kwargs): 28 """Defines an empty toolchain. 29 30 Args: 31 name: name of the toolchain 32 toolchain_type: type of the toolchain 33 **kwargs: additional kwargs passed to the toolchain target 34 """ 35 36 private_kwargs = kwargs | dict( 37 visibility = ["//visibility:private"], 38 ) 39 40 _empty_toolchain( 41 name = name + "_internal", 42 **private_kwargs 43 ) 44 45 native.toolchain( 46 name = name, 47 toolchain = name + "_internal", 48 toolchain_type = toolchain_type, 49 **kwargs 50 ) 51