• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 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")
15import("//build/ohos/ace/ace.gni")
16import("//foundation/arkui/ace_engine/ace_config.gni")
17
18weex_loader_lib_dir =
19    get_label_info(":build_weex_loader_library", "target_out_dir") + "/lib"
20
21weex_loader_files_set = [
22  weex_loader_lib_dir + "/element.js",
23  weex_loader_lib_dir + "/json.js",
24  weex_loader_lib_dir + "/legacy.js",
25  weex_loader_lib_dir + "/loader.js",
26  weex_loader_lib_dir + "/parser.js",
27  weex_loader_lib_dir + "/script.js",
28  weex_loader_lib_dir + "/style.js",
29  weex_loader_lib_dir + "/template.js",
30  weex_loader_lib_dir + "/util.js",
31]
32
33action("build_weex_loader_library") {
34  script = "build_weex_loader_library.py"
35  depfile = "$target_gen_dir/$target_name.d"
36  outputs = [
37    weex_loader_lib_dir,
38    weex_loader_lib_dir + "/scripter",
39    weex_loader_lib_dir + "/styler",
40    weex_loader_lib_dir + "/element.js",
41    weex_loader_lib_dir + "/json.js",
42    weex_loader_lib_dir + "/legacy.js",
43    weex_loader_lib_dir + "/loader.js",
44    weex_loader_lib_dir + "/parser.js",
45    weex_loader_lib_dir + "/script.js",
46    weex_loader_lib_dir + "/style.js",
47    weex_loader_lib_dir + "/template.js",
48    weex_loader_lib_dir + "/util.js",
49  ]
50
51  _babel_js = "//third_party/weex-loader/node_modules/@babel/cli/bin/babel.js"
52  _babel_config_js = "//third_party/weex-loader/babel.config.js"
53  _module_source_js = "//third_party/weex-loader/module-source.js"
54  _uglify_source_js = "//third_party/weex-loader/uglify-source.js"
55
56  inputs = [
57    _babel_config_js,
58    _babel_js,
59    _module_source_js,
60    _uglify_source_js,
61  ]
62
63  nodejs_path = "//prebuilts/build-tools/common/nodejs/current/bin/node"
64
65  args = [
66    "--depfile",
67    rebase_path(depfile, root_build_dir),
68    "--node",
69    rebase_path(nodejs_path, root_build_dir),
70    "--babel-js",
71    rebase_path(_babel_js, root_build_dir),
72    "--weex-loader-src-dir",
73    rebase_path("src", root_build_dir),
74    "--babel-config-js",
75    rebase_path(_babel_config_js, root_build_dir),
76    "--module-source-js",
77    rebase_path(_module_source_js, root_build_dir),
78    "--uglify-source-js",
79    rebase_path(_uglify_source_js, root_build_dir),
80    "--output-dir",
81    rebase_path(weex_loader_lib_dir, root_build_dir),
82  ]
83}
84
85ohos_copy("weex_loader") {
86  deps = [
87    ":build_weex_loader_library",
88    ":scripter",
89    ":styler",
90  ]
91  sources = weex_loader_files_set
92  outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
93  module_source_dir = target_out_dir + "/$target_name/"
94  module_install_name = ""
95  part_name = "weex-loader"
96  subsystem_name = "thirdparty"
97  license_file = "//third_party/weex-loader/LICENSE"
98}
99
100ohos_copy("scripter") {
101  deps = [ ":build_weex_loader_library" ]
102  sources = [ weex_loader_lib_dir + "/scripter" ]
103  outputs = [ target_out_dir + "/$target_name" ]
104  part_name = "weex-loader"
105  subsystem_name = "thirdparty"
106  license_file = "//third_party/weex-loader/LICENSE"
107}
108
109ohos_copy("styler") {
110  deps = [ ":build_weex_loader_library" ]
111  sources = [ weex_loader_lib_dir + "/styler" ]
112  outputs = [ target_out_dir + "/$target_name" ]
113  part_name = "weex-loader"
114  subsystem_name = "thirdparty"
115  license_file = "//third_party/weex-loader/LICENSE"
116}
117
118ace_loader_ark_dir = get_label_info("//developtools/ace_js2bundle:ace_loader",
119                                    "target_out_dir") + "/ace_loader_ark"
120
121ohos_copy("weex_loader_ark_hap") {
122  deps = [
123    ":build_weex_loader_library",
124    ":weex_loader",
125    ":weex_scripter_ark_hap",
126    ":weex_styler_ark_hap",
127    "//developtools/ace_js2bundle:ace_loader_ark_hap",
128  ]
129  sources = weex_loader_files_set
130  outputs = [ ace_loader_ark_dir + "/lib/{{source_file_part}}" ]
131}
132
133ohos_copy("weex_scripter_ark_hap") {
134  deps = [
135    ":build_weex_loader_library",
136    ":weex_loader",
137    "//developtools/ace_js2bundle:ace_loader_ark_hap",
138  ]
139  sources = [ weex_loader_lib_dir + "/scripter" ]
140  outputs = [ ace_loader_ark_dir + "/lib/scripter" ]
141}
142
143ohos_copy("weex_styler_ark_hap") {
144  deps = [
145    ":build_weex_loader_library",
146    ":weex_loader",
147    "//developtools/ace_js2bundle:ace_loader_ark_hap",
148  ]
149  sources = [ weex_loader_lib_dir + "/styler" ]
150  outputs = [ ace_loader_ark_dir + "/lib/styler" ]
151}
152