# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//base/hiviewdfx/hiview/build/hiview_var.gni") import("//base/hiviewdfx/hiview/hiview.gni") import("//build/ohos.gni") gen_plugin_script = rebase_path("//base/hiviewdfx/hiview/build/gen_plugin_build.py") copy_plugin_script = rebase_path("//base/hiviewdfx/hiview/build/copy_plugin_config.py") input_build_file = rebase_path("//base/hiviewdfx/hiview/build/plugin_build.json") out_plugin_config_file = "${target_gen_dir}/plugin_config" out_plugin_build_file = "${target_gen_dir}/plugin_build.gni" out_plugin_config_file_tmp = "${target_gen_dir}/plugin_config_tmp" if (build_with_config) { input_build_file = rebase_path(config_path) } arguments = [ "--input-file", input_build_file, "--plugin-config-file", rebase_path(out_plugin_config_file_tmp), "--plugin-build-file", rebase_path(out_plugin_build_file), "--target_os", target_os, "--double_framework", "$is_double_framework", "--target_platform", target_platform, "--target_cpu", target_cpu, "--plugin_so", "$plugin_so", "--plugin_target_platform", plugin_target_platform, "--plugin_target_ram", plugin_target_ram, "--plugin_target_rom", plugin_target_rom, ] result_ = exec_script(gen_plugin_script, arguments, "string") print(result_) action("copy_plugin_config") { script = copy_plugin_script outputs = [ out_plugin_config_file ] args = [ "--src-file", rebase_path(out_plugin_config_file_tmp), "--dst-file", rebase_path(out_plugin_config_file), ] } import(out_plugin_build_file) ohos_prebuilt_etc("plugin_config") { source = out_plugin_config_file deps = [ ":copy_plugin_config" ] part_name = "hiview" subsystem_name = "hiviewdfx" relative_install_dir = "hiview" } config("hiview_plus_config") { visibility = [ ":*" ] include_dirs = [ "include" ] } ohos_executable("hiview") { install_enable = true deps = [ "$hiview_plugin:adft", "$hiview_plugin/eventlogger:eventloggerso", "$hiview_plugin/faultlogger:libfaultlogger", "$hiview_plugin/plugins_so:bdfr", "base:hiviewbase", "core:hiview_core", "plugins/crash_validator:libcrashvalidator", "plugins/performance:xperf", "service:hiview_service", ] configs = [ "//third_party/jsoncpp:jsoncpp_public_config" ] sources = [ "main.cpp" ] deps += plugin_static_deps external_deps = [ "ffrt:libffrt", "hidumper:hidumperservice_cpu_source", "hilog:libhilog", ] part_name = "hiview" subsystem_name = "hiviewdfx" } group("hiview_package") { # root of all the hiview dependencies deps = [ ":hiview", ":plugin_config", ] if (enable_hiview_usage_event_report_build) { deps += [ "plugins/usage_event_report/service:usage_report" ] } deps += plugin_dynamic_deps } group("hiview_test_package") { testonly = true deps = [ "$hiview_adapter:moduletest", "$hiview_adapter:unittest", "adapter/service/idl:fuzztest", "adapter/service/idl:unittest", "base/test:unittest", "core/test:unittest", "interfaces/js/napi/test:unittest", "plugins:fuzztest", "plugins:moduletest", "plugins:unittest", "service:fuzztest", "test:moduletest", "test:unittest", "utility/common_utils:unittest", "utility/smart_parser:moduletest", ] deps += plugin_ut_deps deps += plugin_mst_deps }