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    srcs: [
41        "DumpstateInternal.cpp",
42        "DumpstateUtil.cpp",
43    ],
44    shared_libs: [
45        "libbase",
46        "liblog",
47    ],
48    export_include_dirs: ["."],
49    export_shared_lib_headers: [
50        "libbase",
51    ],
52}
53
54cc_library_shared {
55    name: "libdumpstateaidl",
56    defaults: ["dumpstate_cflag_defaults"],
57    shared_libs: [
58        "libbinder",
59        "libutils",
60    ],
61    aidl: {
62        local_include_dirs: ["binder"],
63        export_aidl_headers: true,
64    },
65    srcs: [
66        ":dumpstate_aidl",
67    ],
68    export_include_dirs: ["binder"],
69}
70
71filegroup {
72    name: "dumpstate_aidl",
73    srcs: [
74        "binder/android/os/IDumpstateListener.aidl",
75        "binder/android/os/IDumpstate.aidl",
76    ],
77    path: "binder",
78}
79
80cc_defaults {
81    name: "dumpstate_defaults",
82    defaults: [
83        "aconfig_lib_cc_static_link.defaults",
84        "dumpstate_cflag_defaults",
85    ],
86    shared_libs: [
87        "android.hardware.dumpstate@1.0",
88        "android.hardware.dumpstate@1.1",
89        "android.hardware.dumpstate-V1-ndk",
90        "libziparchive",
91        "libbase",
92        "libbinder",
93        "libbinder_ndk",
94        "libcrypto",
95        "libcutils",
96        "libdebuggerd_client",
97        "libdumpstateaidl",
98        "libdumpstateutil",
99        "libdumputils",
100        "libhardware_legacy",
101        "libhidlbase",
102        "liblog",
103        "libutils",
104        "libvintf",
105        "libbinderdebug",
106        "packagemanager_aidl-cpp",
107        "server_configurable_flags",
108        "device_policy_aconfig_flags_c_lib",
109    ],
110    srcs: [
111        "DumpstateService.cpp",
112    ],
113    static_libs: [
114        "libincidentcompanion",
115        "libdumpsys",
116        "libserviceutils",
117        "android.tracing.flags_c_lib",
118    ],
119}
120
121cc_binary {
122    name: "dumpstate",
123    defaults: ["dumpstate_defaults"],
124    srcs: [
125        "DumpPool.cpp",
126        "TaskQueue.cpp",
127        "dumpstate.cpp",
128        "main.cpp",
129    ],
130    required: [
131        "atrace",
132        "bugreport_procdump",
133        "dmabuf_dump",
134        "ip",
135        "iptables",
136        "librank",
137        "logcat",
138        "lpdump",
139        "lpdumpd",
140        "procrank",
141        "screencap",
142        "showmap",
143        "ss",
144        "storaged",
145        "toolbox",
146        "toybox",
147        "vdc",
148    ],
149    init_rc: ["dumpstate.rc"],
150}
151
152cc_test {
153    name: "dumpstate_test",
154    defaults: ["dumpstate_defaults"],
155    srcs: [
156        "DumpPool.cpp",
157        "TaskQueue.cpp",
158        "dumpstate.cpp",
159        "tests/dumpstate_test.cpp",
160    ],
161    static_libs: [
162        "libc++fs",
163        "libgmock",
164    ],
165    test_config: "dumpstate_test.xml",
166    data: [
167        ":dumpstate_test_fixture",
168        "tests/testdata/**/*",
169    ],
170    test_suites: ["device-tests"],
171}
172
173cc_test {
174    name: "dumpstate_smoke_test",
175    defaults: ["dumpstate_defaults"],
176    srcs: [
177        "DumpPool.cpp",
178        "TaskQueue.cpp",
179        "dumpstate.cpp",
180        "tests/dumpstate_smoke_test.cpp",
181    ],
182    static_libs: ["libgmock"],
183    test_config: "dumpstate_smoke_test.xml",
184    test_suites: ["device-tests"],
185}
186
187// =======================#
188// dumpstate_test_fixture #
189// =======================#
190cc_test {
191
192    name: "dumpstate_test_fixture",
193    test_suites: ["device-tests"],
194    cflags: [
195        "-Wall",
196        "-Werror",
197        "-Wno-missing-field-initializers",
198        "-Wno-unused-variable",
199        "-Wunused-parameter",
200    ],
201    srcs: ["tests/dumpstate_test_fixture.cpp"],
202    data: ["tests/testdata/**/*"],
203}
204