• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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("//ark/ts2abc/ts2panda/ts2abc_config.gni")
15import("//build/ohos.gni")
16import("//build/ohos/ace/ace.gni")
17import("//foundation/ace/ace_engine/ace_config.gni")
18
19# compile .ts to .js.
20action("build_ts_js") {
21  script = "//base/compileruntime/js_api_module/build_ts_js.py"
22
23  args = [
24    "--dst-file",
25    rebase_path(target_out_dir + "/js_xml.js"),
26    "--module-path",
27    rebase_path("/base/compileruntime/js_api_module/xml"),
28    "--out-file",
29    rebase_path("./out/js_xml.js"),
30  ]
31  depfile = "$target_gen_dir/$target_name.d"
32  outputs = [ target_out_dir + "/js_xml.js" ]
33}
34
35base_output_path = get_label_info(":js_xml", "target_out_dir")
36js_xml_obj_path = base_output_path + "/xml.o"
37gen_js_obj("js_xml") {
38  input = "$target_out_dir/js_xml.js"
39  output = js_xml_obj_path
40  dep = ":build_ts_js"
41}
42
43# compile .js to .abc.
44action("gen_xml_abc") {
45  visibility = [ ":*" ]
46  script = "//ark/ts2abc/ts2panda/scripts/generate_js_bytecode.py"
47
48  args = [
49    "--src-js",
50    rebase_path(target_out_dir + "/js_xml.js"),
51    "--dst-file",
52    rebase_path(target_out_dir + "/xml.abc"),
53    "--node",
54    rebase_path("${node_path}"),
55    "--frontend-tool-path",
56    rebase_path("${ts2abc_build_path}"),
57    "--node-modules",
58    rebase_path("${node_modules}"),
59    "--module",
60  ]
61  deps = [
62    ":build_ts_js",
63    "//ark/ts2abc/ts2panda:ark_ts2abc_build",
64  ]
65
66  inputs = [ target_out_dir + "/js_xml.js" ]
67  outputs = [ target_out_dir + "/xml.abc" ]
68}
69
70abc_output_path = get_label_info(":xml_abc", "target_out_dir")
71xml_abc_obj_path = abc_output_path + "/xml_abc.o"
72gen_js_obj("xml_abc") {
73  input = "$target_out_dir/xml.abc"
74  output = xml_abc_obj_path
75  dep = ":gen_xml_abc"
76}
77
78ohos_shared_library("xml") {
79  include_dirs = [
80    "//third_party/icu/icu4c/source/common",
81    "//third_party/node/src",
82    "//foundation/ace/napi/interfaces/kits",
83    "//base/compileruntime/js_api_module/xml",
84  ]
85
86  sources = [
87    "js_xml.cpp",
88    "native_module_xml.cpp",
89  ]
90
91  deps = [
92    ":js_xml",
93    ":xml_abc",
94    "//base/compileruntime/js_api_module/xml/:js_xml",
95    "//foundation/ace/napi/:ace_napi",
96    "//foundation/ace/napi/:ace_napi_quickjs",
97    "//third_party/icu/icu4c:static_icuuc",
98    "//utils/native/base:utils",
99  ]
100
101  if (is_standard_system) {
102    external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
103  } else {
104    external_deps = [ "hilog:libhilog" ]
105  }
106  subsystem_name = "utils"
107  part_name = "jsapi_api"
108
109  relative_install_dir = "module"
110}
111
112group("xml_packages") {
113  deps = [ ":xml" ]
114}
115