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 = weex_loader_files_set 37 38 _babel_js = "//third_party/weex-loader/node_modules/@babel/cli/bin/babel.js" 39 _babel_config_js = "//third_party/weex-loader/babel.config.js" 40 _uglify_source_js = "//third_party/weex-loader/uglify-source.js" 41 42 inputs = [ 43 _babel_config_js, 44 _babel_js, 45 _uglify_source_js, 46 ] 47 48 nodejs_path = "//prebuilts/build-tools/common/nodejs/current/bin/node" 49 50 args = [ 51 "--depfile", 52 rebase_path(depfile, root_build_dir), 53 "--node", 54 rebase_path(nodejs_path, root_build_dir), 55 "--babel-js", 56 rebase_path(_babel_js, root_build_dir), 57 "--weex-loader-src-dir", 58 rebase_path("src", root_build_dir), 59 "--babel-config-js", 60 rebase_path(_babel_config_js, root_build_dir), 61 "--uglify-source-js", 62 rebase_path(_uglify_source_js, root_build_dir), 63 "--output-dir", 64 rebase_path(weex_loader_lib_dir, root_build_dir), 65 ] 66} 67 68ohos_copy("weex_loader") { 69 deps = [ ":build_weex_loader_library" ] 70 sources = weex_loader_files_set 71 outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] 72 module_source_dir = target_out_dir + "/$target_name/" 73 module_install_name = "" 74 license_file = "//third_party/weex-loader/LICENSE" 75} 76 77ace_loader_ark_dir = get_label_info("//developtools/ace_js2bundle:ace_loader", 78 "target_out_dir") + "/ace_loader_ark" 79 80ohos_copy("weex_loader_ark_hap") { 81 deps = [ 82 ":build_weex_loader_library", 83 ":weex_loader", 84 "//developtools/ace_js2bundle:ace_loader_ark_hap", 85 ] 86 sources = weex_loader_files_set 87 outputs = [ ace_loader_ark_dir + "/lib/{{source_file_part}}" ] 88} 89