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("//build/ohos.gni")
15
16if (support_jsapi) {
17  import("//build/config/components/ets_frontend/es2abc_config.gni")
18}
19
20if (support_jsapi) {
21  es2abc_gen_abc("gen_js_leak_watcher_abc") {
22    src_js = rebase_path("js_leak_watcher.js")
23    dst_file = rebase_path(target_out_dir + "/js_leak_watcher.abc")
24    in_puts = [ "js_leak_watcher.js" ]
25    out_puts = [ target_out_dir + "/js_leak_watcher.abc" ]
26    extra_args = [ "--module" ]
27  }
28
29  gen_js_obj("js_leak_watcher_js") {
30    input = "js_leak_watcher.js"
31    output = target_out_dir + "/js_leak_watcher.o"
32  }
33
34  gen_js_obj("js_leak_watcher_abc") {
35    input = get_label_info(":gen_js_leak_watcher_abc", "target_out_dir") +
36            "/js_leak_watcher.abc"
37    output = target_out_dir + "/js_leak_watcher_abc.o"
38    dep = ":gen_js_leak_watcher_abc"
39  }
40}
41
42ohos_shared_library("jsleakwatcher") {
43  if (support_jsapi) {
44    sources = [ "js_leak_watcher_module.cpp" ]
45
46    deps = [
47      ":js_leak_watcher_abc",
48      ":js_leak_watcher_js",
49    ]
50
51    external_deps = [
52      "ets_runtime:libark_jsruntime",
53      "napi:ace_napi",
54    ]
55    cflags = [ "-fstack-protector-strong" ]
56    relative_install_dir = "module/hiviewdfx"
57    subsystem_name = "hiviewdfx"
58    part_name = "hichecker"
59  }
60}
61