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