• 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  args = [
23    "--dst-file",
24    rebase_path(target_out_dir + "/js_convertxml.js"),
25    "--module-path",
26    rebase_path("/commonlibrary/ets_utils/js_api_module/convertxml"),
27    "--out-file",
28    rebase_path("./out/js_convertxml.js"),
29    "--relative-path",
30    rebase_path("//", root_build_dir),
31  ]
32  outputs = [ target_out_dir + "/js_convertxml.js" ]
33}
34base_output_path = get_label_info(":js_convertxml", "target_out_dir")
35js_xml_obj_path = base_output_path + "/convertxml.o"
36gen_js_obj("js_convertxml") {
37  input = "$target_out_dir/js_convertxml.js"
38  output = js_xml_obj_path
39  dep = ":build_ts_js"
40}
41
42# compile .js to .abc.
43action("gen_convertxml_abc") {
44  visibility = [ ":*" ]
45  script = "//arkcompiler/ets_frontend/ts2panda/scripts/generate_js_bytecode.py"
46
47  args = [
48    "--src-js",
49    rebase_path(target_out_dir + "/js_convertxml.js"),
50    "--dst-file",
51    rebase_path(target_out_dir + "/convertxml.abc"),
52    "--node",
53    rebase_path("${node_path}"),
54    "--frontend-tool-path",
55    rebase_path("${ts2abc_build_path}"),
56    "--node-modules",
57    rebase_path("${node_modules}"),
58    "--module",
59  ]
60  deps = [
61    ":build_ts_js",
62    "//arkcompiler/ets_frontend/ts2panda:ark_ts2abc_build",
63  ]
64
65  inputs = [ target_out_dir + "/js_convertxml.js" ]
66  outputs = [ target_out_dir + "/convertxml.abc" ]
67}
68
69abc_output_path = get_label_info(":convertxml_abc", "target_out_dir")
70convertxml_abc_obj_path = abc_output_path + "/convertxml_abc.o"
71gen_js_obj("convertxml_abc") {
72  input = "$target_out_dir/convertxml.abc"
73  output = convertxml_abc_obj_path
74  dep = ":gen_convertxml_abc"
75}
76
77ohos_shared_library("convertxml") {
78  include_dirs = [
79    "//third_party/icu/icu4c/source/common",
80    "//third_party/node/src",
81    "//third_party/libxml2/include",
82    "//foundation/arkui/napi/interfaces/kits",
83    "//commonlibrary/ets_utils/js_api_module/convertxml",
84  ]
85
86  sources = [
87    "js_convertxml.cpp",
88    "native_module_convertxml.cpp",
89  ]
90
91  deps = [
92    ":convertxml_abc",
93    ":js_convertxml",
94    "//commonlibrary/ets_utils/js_api_module/convertxml/:js_convertxml",
95    "//foundation/arkui/napi/:ace_napi",
96    "//third_party/icu/icu4c:shared_icuuc",
97    "//third_party/libxml2:xml2",
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("convertxml_static") {
115  include_dirs = [
116    "//third_party/icu/icu4c/source/common",
117    "//third_party/node/src",
118    "//third_party/libxml2/include",
119    "//foundation/arkui/napi/interfaces/kits",
120    "//commonlibrary/ets_utils/js_api_module/convertxml",
121  ]
122
123  sources = [
124    "js_convertxml.cpp",
125    "native_module_convertxml.cpp",
126  ]
127
128  deps = [
129    ":convertxml_abc",
130    ":js_convertxml",
131    "//commonlibrary/ets_utils/js_api_module/convertxml/:js_convertxml",
132    "//foundation/arkui/napi/:ace_napi",
133    "//third_party/icu/icu4c:shared_icuuc",
134    "//third_party/libxml2:xml2",
135  ]
136
137  if (is_standard_system) {
138    external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
139  } else {
140    external_deps = [
141      "c_utils:utils",
142      "hilog:libhilog",
143    ]
144  }
145  subsystem_name = "commonlibrary"
146  part_name = "ets_utils"
147}
148
149group("convertxml_packages") {
150  deps = [ ":convertxml" ]
151}
152