1# Copyright (c) 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/hiview.gni") 15import("//build/ohos.gni") 16 17if (hiview_enable_leak_detector) { 18 config("leak_detector_config") { 19 visibility = [ ":*" ] 20 include_dirs = [ 21 ".", 22 "./base", 23 "./native_leak", 24 "$hiview_base/event_raw/include", 25 "$hiview_base/event_publish/include", 26 "$hiview_base/include", 27 "$hiview_base/logstore/include", 28 "$hiview_base/utility/include", 29 "$hiview_root/include", 30 "$hiview_root/interfaces/inner_api/unified_collection", 31 "$hiview_root/interfaces/inner_api/unified_collection/utility", 32 "$hiview_plugin/faultlogger/common", 33 "$hiview_plugin/faultlogger/service", 34 ] 35 } 36} 37 38ohos_source_set("leak_detector") { 39 if (hiview_enable_leak_detector) { 40 part_name = "hiview" 41 subsystem_name = "hiviewdfx" 42 43 sources = [ 44 "fault_detector_manager.cpp", 45 "fault_detector_util.cpp", 46 "native_leak/native_leak_config.cpp", 47 "native_leak/native_leak_detector.cpp", 48 "native_leak/native_leak_info.cpp", 49 "native_leak/native_leak_state.cpp", 50 "native_leak/native_leak_state_context.cpp", 51 "native_leak/native_leak_util.cpp", 52 ] 53 54 configs = [ ":leak_detector_config" ] 55 56 deps = [ "config:config" ] 57 58 external_deps = [ 59 "bundle_framework:appexecfwk_base", 60 "bundle_framework:appexecfwk_core", 61 "c_utils:utils", 62 "ffrt:libffrt", 63 "hilog:libhilog", 64 "hiprofiler:libnative_daemon_client", 65 "hisysevent:libhisysevent", 66 "init:libbegetutil", 67 ] 68 69 if (has_hiprofiler) { 70 cflags = [ "-DHAS_HIPROFILER" ] 71 } 72 } 73} 74 75group("unittest") { 76 testonly = true 77 deps = [ "test:LeakDetectorUnitTest" ] 78} 79 80group("moduletest") { 81 testonly = true 82 deps = [ "test:LeakDetectorModuleTest" ] 83} 84