1//
2// Copyright (C) 2017 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
16package {
17    // See: http://go/android-license-faq
18    // A large-scale-change added 'default_applicable_licenses' to import
19    // all of the 'license_kinds' from "frameworks_native_license"
20    // to get the below license kinds:
21    //   SPDX-license-identifier-Apache-2.0
22    default_applicable_licenses: ["frameworks_native_license"],
23}
24
25cc_defaults {
26    name: "dumpstate_cflag_defaults",
27    cflags: [
28        "-Wall",
29        "-Werror",
30        "-Wno-missing-field-initializers",
31        "-Wno-unused-variable",
32        "-Wunused-parameter",
33    ],
34}
35
36cc_library_shared {
37    name: "libdumpstateutil",
38    defaults: ["dumpstate_cflag_defaults"],
39    vendor_available: true,
40    vndk: {
41        enabled: true,
42    },
43    srcs: [
44        "DumpstateInternal.cpp",
45        "DumpstateUtil.cpp",
46    ],
47    shared_libs: [
48        "libbase",
49        "liblog",
50    ],
51    export_include_dirs: ["."],
52    export_shared_lib_headers: [
53        "libbase",
54    ],
55}
56
57cc_library_shared {
58    name: "libdumpstateaidl",
59    defaults: ["dumpstate_cflag_defaults"],
60    shared_libs: [
61        "libbinder",
62        "libutils",
63    ],
64    aidl: {
65        local_include_dirs: ["binder"],
66        export_aidl_headers: true,
67    },
68    srcs: [
69        ":dumpstate_aidl",
70    ],
71    export_include_dirs: ["binder"],
72}
73
74filegroup {
75    name: "dumpstate_aidl",
76    srcs: [
77        "binder/android/os/IDumpstateListener.aidl",
78        "binder/android/os/IDumpstate.aidl",
79    ],
80    path: "binder",
81}
82
83cc_defaults {
84    name: "dumpstate_defaults",
85    defaults: ["dumpstate_cflag_defaults"],
86    shared_libs: [
87        "android.hardware.dumpstate@1.0",
88        "android.hardware.dumpstate@1.1",
89        "libziparchive",
90        "libbase",
91        "libbinder",
92        "libcrypto",
93        "libcutils",
94        "libdebuggerd_client",
95        "libdumpstateaidl",
96        "libdumpstateutil",
97        "libdumputils",
98        "libhardware_legacy",
99        "libhidlbase",
100        "liblog",
101        "libutils",
102        "libbinderdebug",
103    ],
104    srcs: [
105        "DumpstateService.cpp",
106    ],
107    static_libs: [
108        "libincidentcompanion",
109        "libdumpsys",
110        "libserviceutils",
111    ],
112}
113
114cc_binary {
115    name: "dumpstate",
116    defaults: ["dumpstate_defaults"],
117    srcs: [
118        "DumpPool.cpp",
119        "TaskQueue.cpp",
120        "dumpstate.cpp",
121        "main.cpp",
122    ],
123    required: [
124        "atrace",
125        "dmabuf_dump",
126        "ip",
127        "iptables",
128        "librank",
129        "logcat",
130        "lpdump",
131        "lpdumpd",
132        "procrank",
133        "screencap",
134        "showmap",
135        "ss",
136        "storaged",
137        "toolbox",
138        "toybox",
139        "vdc",
140    ],
141    init_rc: ["dumpstate.rc"],
142}
143
144cc_test {
145    name: "dumpstate_test",
146    defaults: ["dumpstate_defaults"],
147    srcs: [
148        "DumpPool.cpp",
149        "TaskQueue.cpp",
150        "dumpstate.cpp",
151        "tests/dumpstate_test.cpp",
152    ],
153    static_libs: ["libgmock"],
154    test_config: "dumpstate_test.xml",
155    data: [
156        ":dumpstate_test_fixture",
157        "tests/testdata/**/*",
158    ],
159    test_suites: ["device-tests"],
160}
161
162cc_test {
163    name: "dumpstate_smoke_test",
164    defaults: ["dumpstate_defaults"],
165    srcs: [
166        "DumpPool.cpp",
167        "TaskQueue.cpp",
168        "dumpstate.cpp",
169        "tests/dumpstate_smoke_test.cpp",
170    ],
171    static_libs: ["libgmock"],
172    test_config: "dumpstate_smoke_test.xml",
173    test_suites: ["device-tests"],
174}
175
176
177// =======================#
178// dumpstate_test_fixture #
179// =======================#
180cc_test {
181
182    name: "dumpstate_test_fixture",
183    test_suites: ["device-tests"],
184    cflags: [
185        "-Wall",
186        "-Werror",
187        "-Wno-missing-field-initializers",
188        "-Wno-unused-variable",
189        "-Wunused-parameter",
190    ],
191    srcs: ["tests/dumpstate_test_fixture.cpp"],
192    data: ["tests/testdata/**/*"],
193}
194