• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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("//arkcompiler/ets_frontend/ts2panda/ts2abc_config.gni")
15import("//build/ohos.gni")
16import("//build/ohos/ace/ace.gni")
17import("//foundation/arkui/ace_engine/ace_config.gni")
18
19# compile .ts to .js.
20action("build_ts_js") {
21  script = "//commonlibrary/ets_utils/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("/commonlibrary/ets_utils/js_api_module/xml"),
28    "--out-file",
29    rebase_path("./out/js_xml.js"),
30    "--relative-path",
31    rebase_path("//", root_build_dir),
32  ]
33  outputs = [ target_out_dir + "/js_xml.js" ]
34}
35
36base_output_path = get_label_info(":js_xml", "target_out_dir")
37js_xml_obj_path = base_output_path + "/xml.o"
38gen_js_obj("js_xml") {
39  input = "$target_out_dir/js_xml.js"
40  output = js_xml_obj_path
41  dep = ":build_ts_js"
42}
43
44# compile .js to .abc.
45action("gen_xml_abc") {
46  visibility = [ ":*" ]
47  script = "//arkcompiler/ets_frontend/ts2panda/scripts/generate_js_bytecode.py"
48
49  args = [
50    "--src-js",
51    rebase_path(target_out_dir + "/js_xml.js"),
52    "--dst-file",
53    rebase_path(target_out_dir + "/xml.abc"),
54    "--node",
55    rebase_path("${node_path}"),
56    "--frontend-tool-path",
57    rebase_path("${ts2abc_build_path}"),
58    "--node-modules",
59    rebase_path("${node_modules}"),
60    "--module",
61  ]
62  deps = [
63    ":build_ts_js",
64    "//arkcompiler/ets_frontend/ts2panda:ark_ts2abc_build",
65  ]
66
67  inputs = [ target_out_dir + "/js_xml.js" ]
68  outputs = [ target_out_dir + "/xml.abc" ]
69}
70
71abc_output_path = get_label_info(":xml_abc", "target_out_dir")
72xml_abc_obj_path = abc_output_path + "/xml_abc.o"
73gen_js_obj("xml_abc") {
74  input = "$target_out_dir/xml.abc"
75  output = xml_abc_obj_path
76  dep = ":gen_xml_abc"
77}
78
79ohos_shared_library("xml") {
80  include_dirs = [
81    "//third_party/icu/icu4c/source/common",
82    "//third_party/node/src",
83    "//foundation/arkui/napi/interfaces/kits",
84    "//commonlibrary/ets_utils/js_api_module/xml",
85  ]
86
87  sources = [
88    "js_xml.cpp",
89    "native_module_xml.cpp",
90  ]
91
92  deps = [
93    ":js_xml",
94    ":xml_abc",
95    "//commonlibrary/ets_utils/js_api_module/xml/:js_xml",
96    "//foundation/arkui/napi/:ace_napi",
97    "//third_party/icu/icu4c:shared_icuuc",
98  ]
99
100  if (is_standard_system) {
101    external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
102  } else {
103    external_deps = [
104      "c_utils:utils",
105      "hilog:libhilog",
106    ]
107  }
108  subsystem_name = "commonlibrary"
109  part_name = "ets_utils"
110
111  relative_install_dir = "module"
112}
113
114ohos_static_library("xml_static") {
115  include_dirs = [
116    "//third_party/icu/icu4c/source/common",
117    "//third_party/node/src",
118    "//foundation/arkui/napi/interfaces/kits",
119    "//commonlibrary/ets_utils/js_api_module/xml",
120  ]
121
122  sources = [
123    "js_xml.cpp",
124    "native_module_xml.cpp",
125  ]
126
127  deps = [
128    ":js_xml",
129    ":xml_abc",
130    "//commonlibrary/ets_utils/js_api_module/xml/:js_xml",
131    "//foundation/arkui/napi/:ace_napi",
132    "//third_party/icu/icu4c:shared_icuuc",
133  ]
134
135  if (is_standard_system) {
136    external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
137  } else {
138    external_deps = [
139      "c_utils:utils",
140      "hilog:libhilog",
141    ]
142  }
143  subsystem_name = "commonlibrary"
144  part_name = "ets_utils"
145}
146
147group("xml_packages") {
148  deps = [ ":xml" ]
149}
150