• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        root_interface_file = "",
26        min_sdk_version = "",
27        tags = []):
28    "Bazel macro to correspond with the hidl_interface Soong module."
29
30    interface_name = name + INTERFACE_SUFFIX
31    interface_deps = [dep + INTERFACE_SUFFIX for dep in deps]
32
33    hidl_library(
34        name = interface_name,
35        srcs = srcs,
36        deps = interface_deps,
37        fq_name = name,
38        root = root,
39        root_interface_file = root_interface_file,
40    )
41
42    cc_hidl_library(
43        name = name,
44        interface = interface_name,
45        dynamic_deps = deps,
46        min_sdk_version = min_sdk_version,
47        tags = tags,
48    )
49