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/es2panda/es2abc_config.gni") 15import("//build/ohos.gni") 16import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni") 17 18template("gen_js_src_binary") { 19 es2abc_gen_abc("gen_abc_" + target_name) { 20 src_js = rebase_path(invoker.js_source) 21 dst_file = rebase_path(target_out_dir + "/" + 22 get_path_info(invoker.js_source, "name") + ".abc") 23 in_puts = [ invoker.js_source ] 24 out_puts = [ target_out_dir + "/" + 25 get_path_info(invoker.js_source, "name") + ".abc" ] 26 extra_args = [ "--module" ] 27 } 28 29 gen_obj(target_name + "_js") { 30 input = invoker.js_source 31 32 if (is_mac || is_mingw) { 33 output = target_out_dir + "/" + invoker.target_name + "_js.c" 34 } else { 35 output = target_out_dir + "/" + invoker.target_name + "_js.o" 36 } 37 38 snapshot_dep = [] 39 } 40 41 gen_obj(target_name + "_abc") { 42 input = 43 get_label_info(":gen_abc_" + invoker.target_name, "target_out_dir") + 44 "/" + get_path_info(invoker.js_source, "name") + ".abc" 45 46 if (is_mac || is_mingw) { 47 output = target_out_dir + "/" + invoker.target_name + "_abc.c" 48 } else { 49 output = target_out_dir + "/" + invoker.target_name + "_abc.o" 50 } 51 52 snapshot_dep = [ ":gen_abc_" + invoker.target_name ] 53 } 54} 55