1// Copyright (C) 2021 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
15package {
16    default_team: "trendy_team_automotive",
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_defaults {
21    name: "cartelemetryd_defaults",
22    cflags: [
23        "-Werror",
24        "-Wall",
25        "-Wno-unused-parameter",
26    ],
27    shared_libs: [
28        "android.automotive.telemetry.internal-V2-ndk",
29        "android.frameworks.automotive.telemetry-V2-ndk",
30        "libbase",
31        "libbinder_ndk",
32        "liblog",
33        "libutils",
34    ],
35    header_libs: [
36        "libgtest_prod_headers", // for FRIEND_TEST
37    ],
38    product_variables: {
39        debuggable: {
40            cflags: [
41                "-DCARTELEMETRYD_DEBUG=true",
42            ],
43        },
44    },
45}
46
47cc_library {
48    name: "android.automotive.telemetryd@1.0-impl",
49    defaults: [
50        "cartelemetryd_defaults",
51    ],
52    srcs: [
53        "src/CarTelemetryImpl.cpp",
54        "src/CarTelemetryInternalImpl.cpp",
55        "src/LooperWrapper.cpp",
56        "src/RingBuffer.cpp",
57        "src/TelemetryServer.cpp",
58    ],
59    // Allow dependents to use the header files.
60    export_include_dirs: [
61        "src",
62    ],
63}
64
65cc_test {
66    name: "cartelemetryd_impl_test",
67    defaults: [
68        "cartelemetryd_defaults",
69    ],
70    test_suites: ["general-tests"],
71    srcs: [
72        "tests/TelemetryServerTest.cpp",
73    ],
74    // Statically link only in tests, for portability reason.
75    static_libs: [
76        "android.automotive.telemetryd@1.0-impl",
77        "android.automotive.telemetry.internal-V2-ndk",
78        "android.frameworks.automotive.telemetry-V2-ndk",
79        "libgmock",
80        "libgtest",
81    ],
82}
83
84cc_binary {
85    name: "android.automotive.telemetryd@1.0",
86    defaults: [
87        "cartelemetryd_defaults",
88    ],
89    srcs: [
90        "src/main.cpp",
91    ],
92    init_rc: ["android.automotive.telemetryd@1.0.rc"],
93    vintf_fragments: ["android.automotive.telemetryd@1.0.xml"],
94    shared_libs: [
95        "android.automotive.telemetryd@1.0-impl",
96    ],
97}
98