1// Copyright (C) 2020 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: "carpowerpolicyserver_defaults",
21    cflags: [
22        "-Wall",
23        "-Wno-missing-field-initializers",
24        "-Werror",
25        "-Wno-unused-variable",
26        "-Wunused-parameter",
27    ],
28    shared_libs: [
29        "android.frameworks.automotive.powerpolicy-V1-cpp",
30        "android.frameworks.automotive.powerpolicy.internal-cpp",
31        "android.hardware.automotive.vehicle@2.0",
32        "libbase",
33        "libbinder",
34        "libhidlbase",
35        "liblog",
36        "libtinyxml2",
37        "libutils",
38    ],
39    static_libs: [
40        "libsysfsmonitor",
41    ],
42}
43
44cc_library {
45    name: "lib_carpowerpolicyserver",
46    srcs: [
47        "src/CarPowerPolicyServer.cpp",
48        "src/PolicyManager.cpp",
49        "src/PowerComponentHandler.cpp",
50        "src/SilentModeHandler.cpp",
51    ],
52    defaults: [
53        "carpowerpolicyserver_defaults",
54    ],
55    export_include_dirs: [
56        "src",
57    ],
58}
59
60filegroup {
61    name: "powerpolicyxmlfiles",
62    srcs: [
63        "tests/data/*.xml",
64    ],
65}
66
67cc_test {
68    name: "carpowerpolicyserver_test",
69    defaults: [
70        "carpowerpolicyserver_defaults",
71    ],
72    test_suites: ["general-tests"],
73    srcs: [
74        "tests/CarPowerPolicyServerTest.cpp",
75        "tests/PolicyManagerTest.cpp",
76        "tests/PowerComponentHandlerTest.cpp",
77        "tests/SilentModeHandlerTest.cpp",
78    ],
79    static_libs: [
80        "libgmock",
81        "libgtest",
82        "lib_carpowerpolicyserver",
83    ],
84    data: [":powerpolicyxmlfiles"],
85}
86
87cc_binary {
88    name: "carpowerpolicyd",
89    defaults: [
90        "carpowerpolicyserver_defaults",
91    ],
92    srcs: [
93        "src/main.cpp",
94    ],
95    static_libs: [
96        "lib_carpowerpolicyserver",
97    ],
98    init_rc: ["carpowerpolicyd.rc"],
99    vintf_fragments: ["carpowerpolicyd.xml"],
100}
101