• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2024 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("//base/hiviewdfx/hiview/build/hiview_var.gni")
15import("//base/hiviewdfx/hiview/hiview.gni")
16import("//build/ohos.gni")
17
18gen_plugin_script =
19    rebase_path("//base/hiviewdfx/hiview/build/gen_plugin_build.py")
20copy_plugin_script =
21    rebase_path("//base/hiviewdfx/hiview/build/copy_plugin_config.py")
22
23out_plugin_config_file = "${target_gen_dir}/plugin_config"
24out_plugin_build_file = "${target_gen_dir}/plugin_build.gni"
25out_plugin_config_file_tmp = "${target_gen_dir}/plugin_config_tmp"
26
27if (build_with_config) {
28  input_build_file = rebase_path(config_path)
29}
30
31action("gen_plugin_config") {
32  script = gen_plugin_script
33  outputs = [ out_plugin_config_file_tmp ]
34  args = [
35    "--input-file",
36    input_build_file,
37    "--plugin-config-file",
38    rebase_path(out_plugin_config_file_tmp),
39    "--plugin-build-file",
40    rebase_path(out_plugin_build_file),
41    "--target_os",
42    target_os,
43    "--double_framework",
44    "$is_double_framework",
45    "--target_platform",
46    target_platform,
47    "--target_cpu",
48    target_cpu,
49    "--plugin_so",
50    "$plugin_so",
51    "--plugin_target_platform",
52    plugin_target_platform,
53    "--plugin_target_ram",
54    plugin_target_ram,
55    "--plugin_target_rom",
56    plugin_target_rom,
57  ]
58}
59
60action("copy_plugin_config") {
61  script = copy_plugin_script
62  outputs = [ out_plugin_config_file ]
63  args = [
64    "--src-file",
65    rebase_path(out_plugin_config_file_tmp),
66    "--dst-file",
67    rebase_path(out_plugin_config_file),
68  ]
69  deps = [ ":gen_plugin_config" ]
70}
71
72ohos_prebuilt_etc("plugin_config") {
73  source = out_plugin_config_file
74  deps = [ ":copy_plugin_config" ]
75
76  part_name = "hiview"
77  subsystem_name = "hiviewdfx"
78  relative_install_dir = "hiview"
79}
80
81ohos_executable("hiview") {
82  branch_protector_ret = "pac_ret"
83  sanitize = {
84    cfi = true
85    cfi_cross_dso = true
86    cfi_vcall_icall_only = true
87    debug = false
88  }
89
90  install_enable = true
91
92  deps = [
93    "base:hiviewbase",
94    "core:hiview_core",
95    "service:hiview_service",
96  ]
97
98  sources = [ "main.cpp" ]
99
100  deps += plugin_static_deps
101
102  external_deps = [
103    "c_utils:utils",
104    "ffrt:libffrt",
105    "hidumper:hidumperservice_cpu_source",
106    "hilog:libhilog",
107    "ipc:ipc_single",
108    "safwk:system_ability_fwk",
109    "samgr:samgr_proxy",
110  ]
111
112  part_name = "hiview"
113  subsystem_name = "hiviewdfx"
114}
115
116group("hiview_package") {
117  # root of all the hiview dependencies
118  deps = [
119    ":hiview",
120    ":plugin_config",
121    "$hiview_plugin/faultlogger:libfaultlogger",
122    "$hiview_plugin/performance:xperformance",
123    "$hiview_plugin/performance/perfmonitor:libperfmonitor",
124    "$hiview_plugin/plugin_build:adft",
125    "$hiview_plugin/plugin_build:bdfr",
126    "$hiview_root/utility/analysis_faultlog:analysis_faultlog",
127  ]
128
129  if (hiview_enable_crash_validator) {
130    deps += [ "$hiview_plugin/crash_validator:libcrashvalidator" ]
131  }
132
133  if (enable_hiview_usage_event_report_build) {
134    deps += [ "plugins/usage_event_report/service:usage_report" ]
135  }
136
137  if (hiview_freeze_collect_enable) {
138    deps += [ "$hiview_plugin/eventlogger:eventloggerso" ]
139  }
140}
141
142group("hiview_test_package") {
143  testonly = true
144  deps = [
145    "$hiview_adapter:moduletest",
146    "$hiview_adapter:unittest",
147    "adapter/service:fuzztest",
148    "adapter/service:unittest",
149    "base/test:unittest",
150    "core/test:unittest",
151    "framework/native/unified_collection:unittest",
152    "interfaces/js/napi/test:unittest",
153    "plugins:fuzztest",
154    "plugins:moduletest",
155    "plugins:unittest",
156    "service:fuzztest",
157    "test:moduletest",
158    "test:unittest",
159    "utility/common_utils:unittest",
160    "utility/smart_parser:moduletest",
161    "utility/test:unittest",
162  ]
163
164  deps += plugin_ut_deps
165  deps += plugin_mst_deps
166}
167