1# Copyright (C) 2022 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("//build/bazel/rules/cc:cc_hidl_library.bzl", "cc_hidl_library") 16load("//build/bazel/rules/hidl:hidl_library.bzl", "hidl_library") 17 18INTERFACE_SUFFIX = "_interface" 19 20def hidl_interface( 21 name, 22 srcs = [], 23 deps = [], 24 root = "", 25 min_sdk_version = "", 26 tags = []): 27 "Bazel macro to correspond with the hidl_interface Soong module." 28 29 interface_name = name + INTERFACE_SUFFIX 30 interface_deps = [dep + INTERFACE_SUFFIX for dep in deps] 31 32 hidl_library( 33 name = interface_name, 34 srcs = srcs, 35 deps = interface_deps, 36 fq_name = name, 37 root = root, 38 ) 39 40 native.filegroup( 41 name = name + "_hal", 42 srcs = srcs, 43 ) 44 45 cc_hidl_library( 46 name = name, 47 interface = interface_name, 48 dynamic_deps = deps, 49 min_sdk_version = min_sdk_version, 50 tags = tags, 51 ) 52