1//
2// Copyright (C) 2019 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.
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19cc_library_static {
20    name: "libpwrstatsutil",
21    defaults: ["pwrstatsutil_defaults"],
22    export_include_dirs: ["."],
23    srcs: [
24        "pwrstats_util.cpp",
25        "PowerStatsCollector.cpp",
26        "dataproviders/PowerEntityResidencyDataProvider.cpp",
27        "dataproviders/RailEnergyDataProvider.cpp",
28        "dataproviders/DataProviderHelper.cpp",
29        "pwrstatsutil.proto",
30    ],
31    proto: {
32        export_proto_headers: true,
33        type: "full",
34    },
35    shared_libs: [
36        "libhidlbase",
37        "android.hardware.power.stats@1.0",
38    ],
39}
40
41// Useful defaults for pwrstats_util
42cc_defaults {
43    name: "pwrstatsutil_defaults",
44    vendor: true,
45    cflags: [
46        "-Wall",
47
48        // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
49        "-Werror=pointer-to-int-cast",
50        "-Werror=int-to-pointer-cast",
51        "-Werror=type-limits",
52        "-Werror",
53        "-Wno-unused-parameter",
54    ],
55    tidy: true,
56    tidy_checks: [
57        "android-*",
58        "cert-*",
59        "clang-analyzer-security*",
60        "google-*",
61        "misc-*",
62        "performance-*",
63    ],
64    tidy_flags: [
65        "-warnings-as-errors="
66        + "android-*"
67        + ",clang-analyzer-security*"
68        + ",cert-*"
69        + ",google-*"
70        + ",performance-*"
71        + ",misc-*"
72        + ",-cert-oop54-cpp" // in powerstats_util.pb.h
73        + ",-bugprone-unhandled-self-assignment" // in powerstats_util.pb.h
74        + ",-google-global-names-in-headers" // in PowerStatsCollector.h
75    ],
76    shared_libs: [
77        "libbase",
78        "libutils",
79        "liblog",
80        "libprotobuf-cpp-full"
81    ],
82}
83