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 15visibility([ 16 "//external/guava/...", 17 "//external/kotlinx.coroutines/...", 18 "//external/robolectric-shadows/...", 19 "//external/robolectric/...", 20]) 21 22def _host_for_device_impl(ctx): 23 return [java_common.merge([d[JavaInfo] for d in ctx.attr.exports])] 24 25java_host_for_device = rule( 26 doc = """Rule to provide java libraries built with a host classpath in a device configuration. 27This is rarely necessary and restricted to a few allowed projects. 28""", 29 implementation = _host_for_device_impl, 30 attrs = { 31 # This attribute must have a specific name to let the DexArchiveAspect propagate 32 # through it. 33 "exports": attr.label_list( 34 cfg = "exec", 35 providers = [JavaInfo], 36 doc = "List of targets whose contents will be visible to targets that depend on this target.", 37 ), 38 }, 39 provides = [JavaInfo], 40) 41