xref: /base/hiviewdfx/hidumper/services/BUILD.gn (revision 00600bfb)
1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("../hidumper.gni")
15
16config("interface_include") {
17  include_dirs = [
18    "${hidumper_interface}/innerkits/include",
19    "${hidumper_interface}/native/innerkits/include/",
20  ]
21}
22
23config("service_config") {
24  include_dirs = [ "native/include" ]
25}
26
27config("zidl_config") {
28  include_dirs = [ "zidl/include" ]
29}
30
31config("zidl_cpu_config") {
32  include_dirs = [
33    "zidl/include",
34    "${hidumper_frameworks_path}/include",
35  ]
36}
37
38config("dump_cpu_config") {
39  visibility = [ "*:*" ]
40
41  include_dirs = [
42    "native/include",
43    "${hidumper_frameworks_path}/include",
44    "${hidumper_interface}/innerkits/include",
45    "zidl/include",
46    "${hidumper_utils_path}/native/include",
47    "${hidumper_frameworks_path}",
48  ]
49}
50
51ohos_source_set("zidl_client") {
52  sources = [
53    "zidl/src/dump_broker_cpu_proxy.cpp",
54    "zidl/src/dump_broker_proxy.cpp",
55  ]
56
57  configs = [
58    "${hidumper_utils_path}:utils_config",
59    ":interface_include",
60    "${hidumper_service_path}:zidl_cpu_config",
61  ]
62
63  deps = [ "${hidumper_utils_path}:utils" ]
64
65  external_deps = [
66    "c_utils:utils",
67    "hilog:libhilog",
68    "ipc:ipc_core",
69    "safwk:system_ability_fwk",
70    "samgr:samgr_proxy",
71  ]
72
73  subsystem_name = "${hidumper_subsystem_name}"
74
75  part_name = "${hidumper_part_name}"
76}
77
78ohos_source_set("zidl_service") {
79  sources = [ "zidl/src/dump_broker_stub.cpp" ]
80
81  configs = [
82    "${hidumper_utils_path}:utils_config",
83    ":interface_include",
84    "${hidumper_service_path}:zidl_config",
85  ]
86
87  deps = [ "${hidumper_utils_path}:utils" ]
88
89  external_deps = [
90    "c_utils:utils",
91    "hilog:libhilog",
92    "ipc:ipc_core",
93    "safwk:system_ability_fwk",
94    "samgr:samgr_proxy",
95  ]
96
97  subsystem_name = "${hidumper_subsystem_name}"
98
99  part_name = "${hidumper_part_name}"
100}
101
102ohos_source_set("zidl_cpu_service") {
103  sources = [ "zidl/src/dump_broker_cpu_stub.cpp" ]
104
105  configs = [
106    "${hidumper_utils_path}:utils_config",
107    ":interface_include",
108    ":service_config",
109    "${hidumper_service_path}:zidl_cpu_config",
110  ]
111
112  deps = [ "${hidumper_utils_path}:utils" ]
113
114  external_deps = [
115    "c_utils:utils",
116    "hilog:libhilog",
117    "ipc:ipc_core",
118    "safwk:system_ability_fwk",
119    "samgr:samgr_proxy",
120  ]
121
122  subsystem_name = "${hidumper_subsystem_name}"
123
124  part_name = "${hidumper_part_name}"
125}
126
127ohos_shared_library("hidumper_client") {
128  branch_protector_ret = "pac_ret"
129  sources = [
130    "native/src/dump_cpu_data.cpp",
131    "native/src/dump_manager_client.cpp",
132    "native/src/dump_manager_cpu_client.cpp",
133    "native/src/dump_on_demand_load.cpp",
134  ]
135
136  configs = [
137    "${hidumper_utils_path}:utils_config",
138    ":interface_include",
139    "${hidumper_frameworks_path}:hidumper_include",
140    "${hidumper_service_path}:service_config",
141    "${hidumper_service_path}:zidl_config",
142  ]
143
144  deps = [
145    "${hidumper_service_path}:zidl_client",
146    "${hidumper_utils_path}:utils",
147  ]
148
149  external_deps = [
150    "c_utils:utils",
151    "hilog:libhilog",
152    "ipc:ipc_core",
153    "samgr:samgr_proxy",
154  ]
155  version_script = "hidumper.map"
156  subsystem_name = "${hidumper_subsystem_name}"
157
158  part_name = "${hidumper_part_name}"
159}
160
161ohos_source_set("hidumperservice_source") {
162  sources = [
163    "native/src/dump_common_utils.cpp",
164    "native/src/dump_cpu_data.cpp",
165    "native/src/dump_log_manager.cpp",
166    "native/src/dump_manager_cpu_client.cpp",
167    "native/src/dump_manager_service.cpp",
168    "native/src/dump_on_demand_load.cpp",
169    "native/src/raw_param.cpp",
170    "zidl/src/dump_broker_cpu_proxy.cpp",
171  ]
172
173  configs = [
174    "${hidumper_utils_path}:utils_config",
175    ":interface_include",
176    "${hidumper_frameworks_path}:hidumper_include",
177    "${hidumper_service_path}:service_config",
178    "${hidumper_service_path}:zidl_config",
179  ]
180
181  deps = [
182    "${hidumper_frameworks_path}:dump_main",
183    "${hidumper_service_path}:zidl_service",
184    "${hidumper_utils_path}:utils",
185  ]
186
187  external_deps = [
188    "access_token:libaccesstoken_sdk",
189    "access_token:libtokensetproc_shared",
190    "c_utils:utils",
191    "eventhandler:libeventhandler",
192    "hilog:libhilog",
193    "ipc:ipc_core",
194    "safwk:system_ability_fwk",
195    "samgr:samgr_proxy",
196  ]
197
198  subsystem_name = "${hidumper_subsystem_name}"
199
200  part_name = "${hidumper_part_name}"
201}
202
203ohos_shared_library("hidumperservice_cpu_source") {
204  if (hidumper_hiviewdfx_hiview_enable) {
205    public_configs = [ ":dump_cpu_config" ]
206    sources = [ "native/src/dump_manager_cpu_service.cpp" ]
207
208    configs = [
209      "${hidumper_utils_path}:utils_config",
210      ":interface_include",
211      "${hidumper_frameworks_path}:hidumper_include",
212      "${hidumper_service_path}:service_config",
213      "${hidumper_service_path}:zidl_config",
214    ]
215
216    deps = [
217      "${hidumper_service_path}:hidumperservice_source",
218      "${hidumper_service_path}:zidl_cpu_service",
219    ]
220
221    external_deps = [
222      "access_token:libaccesstoken_sdk",
223      "access_token:libtokensetproc_shared",
224      "c_utils:utils",
225      "eventhandler:libeventhandler",
226      "hilog:libhilog",
227      "hiview:libucollection_utility",
228      "ipc:ipc_core",
229      "safwk:system_ability_fwk",
230      "samgr:samgr_proxy",
231    ]
232    defines = []
233    if (hidumper_ablility_base_enable) {
234      external_deps += [ "ability_base:want" ]
235      external_deps += [ "ability_runtime:app_manager" ]
236      defines += [ "HIDUMPER_ABILITY_BASE_ENABLE" ]
237    }
238    sanitize = {
239      cfi = true
240      cfi_cross_dso = true
241      cfi_no_nvcall = true
242      cfi_vcall_icall_only = true
243      debug = false
244    }
245
246    version_script = "hidumper.map"
247    subsystem_name = "${hidumper_subsystem_name}"
248
249    part_name = "${hidumper_part_name}"
250  }
251}
252
253ohos_source_set("hidumperservice_cpu_source_test") {
254  sources = [ "native/src/dump_manager_cpu_service.cpp" ]
255
256  configs = [
257    "${hidumper_utils_path}:utils_config",
258    ":interface_include",
259    "${hidumper_frameworks_path}:hidumper_include",
260    "${hidumper_service_path}:service_config",
261    "${hidumper_service_path}:zidl_config",
262  ]
263
264  deps = [ "${hidumper_service_path}:zidl_cpu_service" ]
265
266  external_deps = [
267    "access_token:libaccesstoken_sdk",
268    "access_token:libtokensetproc_shared",
269    "c_utils:utils",
270    "eventhandler:libeventhandler",
271    "hilog:libhilog",
272    "hiview:libucollection_utility",
273    "safwk:system_ability_fwk",
274    "samgr:samgr_proxy",
275  ]
276  defines = []
277  if (hidumper_ablility_base_enable) {
278    external_deps += [ "ability_base:want" ]
279    external_deps += [ "ability_runtime:app_manager" ]
280    defines += [ "HIDUMPER_ABILITY_BASE_ENABLE" ]
281  }
282
283  subsystem_name = "${hidumper_subsystem_name}"
284
285  part_name = "${hidumper_part_name}"
286}
287
288ohos_shared_library("hidumperservice") {
289  deps = [ ":hidumperservice_source" ]
290  external_deps = [ "hilog:libhilog" ]
291  cflags = [ "-fstack-protector-strong" ]
292  install_enable = true
293  version_script = "hidumper.map"
294  shlib_type = "sa"
295  subsystem_name = "${hidumper_subsystem_name}"
296  part_name = "${hidumper_part_name}"
297}
298
299ohos_source_set("hidumpermemory_source") {
300  sources = [
301    "${hidumper_frameworks_path}/dump_utils.cpp",
302    "${hidumper_frameworks_path}/src/common/dump_cfg.cpp",
303    "${hidumper_frameworks_path}/src/common/dumper_opts.cpp",
304    "${hidumper_frameworks_path}/src/common/dumper_parameter.cpp",
305    "${hidumper_frameworks_path}/src/common/option_args.cpp",
306    "${hidumper_frameworks_path}/src/executor/memory/dma_info.cpp",
307    "${hidumper_frameworks_path}/src/executor/memory/get_cma_info.cpp",
308    "${hidumper_frameworks_path}/src/executor/memory/get_hardware_info.cpp",
309    "${hidumper_frameworks_path}/src/executor/memory/get_heap_info.cpp",
310    "${hidumper_frameworks_path}/src/executor/memory/get_kernel_info.cpp",
311    "${hidumper_frameworks_path}/src/executor/memory/get_process_info.cpp",
312    "${hidumper_frameworks_path}/src/executor/memory/get_ram_info.cpp",
313    "${hidumper_frameworks_path}/src/executor/memory/memory_filter.cpp",
314    "${hidumper_frameworks_path}/src/executor/memory/memory_info.cpp",
315    "${hidumper_frameworks_path}/src/executor/memory/memory_info_wrapper.cpp",
316    "${hidumper_frameworks_path}/src/executor/memory/memory_util.cpp",
317    "${hidumper_frameworks_path}/src/executor/memory/parse/parse_meminfo.cpp",
318    "${hidumper_frameworks_path}/src/executor/memory/parse/parse_smaps_info.cpp",
319    "${hidumper_frameworks_path}/src/executor/memory/parse/parse_smaps_rollup_info.cpp",
320    "${hidumper_frameworks_path}/src/executor/memory/parse/parse_vmallocinfo.cpp",
321    "${hidumper_frameworks_path}/src/executor/memory/smaps_memory_info.cpp",
322    "${hidumper_frameworks_path}/src/util/config_data.cpp",
323    "${hidumper_frameworks_path}/src/util/config_utils.cpp",
324    "${hidumper_frameworks_path}/src/util/file_utils.cpp",
325    "${hidumper_frameworks_path}/src/util/string_utils.cpp",
326    "native/src/dump_common_utils.cpp",
327  ]
328
329  configs = [
330    "${hidumper_utils_path}:utils_config",
331    ":interface_include",
332    "${hidumper_frameworks_path}:hidumper_include",
333    "${hidumper_service_path}:service_config",
334  ]
335  deps = [ "${hidumper_utils_path}:utils" ]
336  external_deps = [
337    "c_utils:utils",
338    "drivers_interface_memorytracker:libmemorytracker_proxy_1.0",
339    "eventhandler:libeventhandler",
340    "hdf_core:libhdf_utils",
341    "hilog:libhilog",
342    "hiview:libucollection_graphic",
343    "hiview:libucollection_utility",
344    "init:libbegetutil",
345    "ipc:ipc_core",
346    "safwk:system_ability_fwk",
347    "samgr:samgr_proxy",
348  ]
349  defines = []
350
351  if (hidumper_ability_runtime_enable) {
352    external_deps += [ "ability_runtime:app_manager" ]
353    defines += [ "HIDUMPER_ABILITY_RUNTIME_ENABLE" ]
354  }
355
356  if (hidumper_report_memmgr) {
357    external_deps += [ "memmgr:memmgrclient" ]
358    defines += [ "HIDUMPER_MEMMGR_ENABLE" ]
359  }
360
361  subsystem_name = "${hidumper_subsystem_name}"
362  part_name = "${hidumper_part_name}"
363}
364
365ohos_shared_library("hidumpermemory") {
366  deps = [ ":hidumpermemory_source" ]
367  external_deps = [ "hilog:libhilog" ]
368  install_enable = true
369  version_script = "hidumper.map"
370  subsystem_name = "${hidumper_subsystem_name}"
371  part_name = "${hidumper_part_name}"
372}
373
374if (hidumper_hiviewdfx_hiview_enable) {
375  ohos_shared_library("hidumpercpuservice") {
376    deps = [ ":hidumperservice_cpu_source" ]
377    external_deps = [ "hilog:libhilog" ]
378    install_enable = true
379    version_script = "hidumper.map"
380    shlib_type = "sa"
381    subsystem_name = "${hidumper_subsystem_name}"
382    part_name = "${hidumper_part_name}"
383  }
384}
385
386############################################################################
387
388ohos_prebuilt_etc("hidumper_service.rc") {
389  source = "native/etc/hidumper_service.cfg"
390
391  relative_install_dir = "init"
392
393  subsystem_name = "${hidumper_subsystem_name}"
394
395  part_name = "${hidumper_part_name}"
396}
397
398ohos_prebuilt_etc("infos_config") {
399  source = "native/etc/infos_config.json"
400
401  relative_install_dir = "hidumper"
402
403  subsystem_name = "${hidumper_subsystem_name}"
404
405  part_name = "${hidumper_part_name}"
406}
407