xref: /aosp_15_r20/hardware/interfaces/automotive/vehicle/aidl/impl/current/proto/Android.bp (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "hardware_interfaces_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: ["hardware_interfaces_license"],
24}
25
26filegroup {
27    name: "VehicleHalProtoFiles",
28    srcs: ["**/*.proto"],
29    visibility: ["//hardware/interfaces/automotive/vehicle:__subpackages__"],
30}
31
32genrule {
33    name: "VehicleProtoStub_h",
34    tools: [
35        "aprotoc",
36        "protoc-gen-grpc-cpp-plugin",
37    ],
38    cmd: "$(location aprotoc) -Ihardware/interfaces/automotive/vehicle/aidl/impl/current/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
39    srcs: [
40        ":VehicleHalProtoFiles",
41    ],
42    out: [
43        "android/hardware/automotive/vehicle/DumpOptions.pb.h",
44        "android/hardware/automotive/vehicle/DumpResult.pb.h",
45        "android/hardware/automotive/vehicle/StatusCode.pb.h",
46        "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.h",
47        "android/hardware/automotive/vehicle/VehiclePropConfig.pb.h",
48        "android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.h",
49        "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.h",
50        "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.h",
51        "android/hardware/automotive/vehicle/VehiclePropValue.pb.h",
52        "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.h",
53        "android/hardware/automotive/vehicle/SubscribeOptions.pb.h",
54        "android/hardware/automotive/vehicle/SubscribeRequest.pb.h",
55        "android/hardware/automotive/vehicle/UnsubscribeRequest.pb.h",
56    ],
57}
58
59genrule {
60    name: "VehicleProtoStub_cc",
61    tools: [
62        "aprotoc",
63        "protoc-gen-grpc-cpp-plugin",
64    ],
65    cmd: "$(location aprotoc) -Ihardware/interfaces/automotive/vehicle/aidl/impl/current/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
66    srcs: [
67        ":VehicleHalProtoFiles",
68    ],
69    out: [
70        "android/hardware/automotive/vehicle/DumpOptions.pb.cc",
71        "android/hardware/automotive/vehicle/DumpResult.pb.cc",
72        "android/hardware/automotive/vehicle/StatusCode.pb.cc",
73        "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.cc",
74        "android/hardware/automotive/vehicle/VehiclePropConfig.pb.cc",
75        "android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.cc",
76        "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.cc",
77        "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.cc",
78        "android/hardware/automotive/vehicle/VehiclePropValue.pb.cc",
79        "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.cc",
80        "android/hardware/automotive/vehicle/SubscribeOptions.pb.cc",
81        "android/hardware/automotive/vehicle/SubscribeRequest.pb.cc",
82        "android/hardware/automotive/vehicle/UnsubscribeRequest.pb.cc",
83    ],
84}
85
86cc_library_static {
87    name: "VehicleHalProtos",
88    vendor: true,
89    host_supported: true,
90    include_dirs: [
91        "external/protobuf/src",
92    ],
93    generated_headers: [
94        "VehicleProtoStub_h",
95    ],
96    export_generated_headers: [
97        "VehicleProtoStub_h",
98    ],
99    generated_sources: [
100        "VehicleProtoStub_cc",
101    ],
102    shared_libs: [
103        "libgrpc++_unsecure",
104    ],
105    cflags: [
106        "-Wno-unused-parameter",
107    ],
108}
109
110rust_protobuf {
111    name: "libvehicle_hal_property_protos",
112    crate_name: "vehicle_hal_property_protos",
113    protos: [":VehicleHalProtoFiles"],
114    source_stem: "vehicle_hal_property_protos",
115    host_supported: true,
116    vendor_available: true,
117    product_available: true,
118    apex_available: [
119        "//apex_available:platform",
120        "//apex_available:anyapex",
121    ],
122    exported_include_dirs: ["."],
123    proto_flags: [
124        "-I external/protobuf/src",
125    ],
126    min_sdk_version: "35",
127}
128