1# Copyright (c) 2021-2022 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 18oem_script = rebase_path("//base/hiviewdfx/hiview/build/run_oem_hook.py") 19out_oem_build_file = "${target_gen_dir}/oem_build.gni" 20oem_args = [ 21 "--out_build_file", 22 rebase_path(out_oem_build_file), 23] 24print(exec_script(oem_script, oem_args, "string", [])) 25import(out_oem_build_file) 26 27gen_plugin_script = 28 rebase_path("//base/hiviewdfx/hiview/build/gen_plugin_build.py") 29copy_plugin_script = 30 rebase_path("//base/hiviewdfx/hiview/build/copy_plugin_config.py") 31 32input_build_file = 33 rebase_path("//base/hiviewdfx/hiview/build/plugin_build.json") 34 35out_plugin_config_file = "${target_gen_dir}/plugin_config" 36out_plugin_build_file = "${target_gen_dir}/plugin_build.gni" 37out_plugin_config_file_tmp = "${target_gen_dir}/plugin_config_tmp" 38 39if (build_with_config) { 40 input_build_file = rebase_path(config_path) 41} 42 43arguments = [ 44 "--input-file", 45 input_build_file, 46 "--plugin-config-file", 47 rebase_path(out_plugin_config_file_tmp), 48 "--plugin-build-file", 49 rebase_path(out_plugin_build_file), 50 "--target_os", 51 target_os, 52 "--double_framework", 53 "$is_double_framework", 54 "--target_platform", 55 target_platform, 56 "--target_cpu", 57 target_cpu, 58 "--plugin_so", 59 "$plugin_so", 60 "--plugin_target_platform", 61 plugin_target_platform, 62 "--plugin_target_ram", 63 plugin_target_ram, 64 "--plugin_target_rom", 65 plugin_target_rom, 66] 67 68result_ = exec_script(gen_plugin_script, arguments, "string") 69print(result_) 70action("copy_plugin_config") { 71 script = copy_plugin_script 72 outputs = [ out_plugin_config_file ] 73 args = [ 74 "--src-file", 75 rebase_path(out_plugin_config_file_tmp), 76 "--dst-file", 77 rebase_path(out_plugin_config_file), 78 ] 79} 80 81import(out_plugin_build_file) 82ohos_prebuilt_etc("plugin_config") { 83 source = out_plugin_config_file 84 deps = [ ":copy_plugin_config" ] 85 86 part_name = "hiview" 87 subsystem_name = "hiviewdfx" 88 relative_install_dir = "hiview" 89} 90 91config("hiview_plus_config") { 92 visibility = [ ":*" ] 93 include_dirs = [ "include" ] 94} 95 96ohos_executable("hiview") { 97 install_enable = true 98 99 deps = [ 100 "base:hiviewbase", 101 "core:hiview_core", 102 "service:hiview_service", 103 ] 104 105 sources = [ "main.cpp" ] 106 107 deps += plugin_static_deps 108 part_name = "hiview" 109 subsystem_name = "hiviewdfx" 110} 111 112group("hiview_package") { 113 # root of all the hiview dependencies 114 deps = [ 115 ":hiview", 116 ":plugin_config", 117 "plugins/faultlogger/crash_validator:crashvalidator", 118 ] 119 120 if (enable_hiview_usage_event_report_build) { 121 deps += [ "plugins/usage_event_report/service:usage_report" ] 122 } 123 124 deps += plugin_dynamic_deps 125 deps += oem_dynamic_deps 126} 127 128group("hiview_test_package") { 129 testonly = true 130 deps = [ 131 "$hiview_adapter:moduletest", 132 "$hiview_adapter:unittest", 133 "base/test:unittest", 134 "core/test:unittest", 135 "plugins:fuzztest", 136 "plugins:moduletest", 137 "plugins:unittest", 138 "test:moduletest", 139 "test:unittest", 140 "utility/common_utils:unittest", 141 ] 142 143 deps += plugin_ut_deps 144 deps += plugin_mst_deps 145 deps += oem_test_deps 146} 147