# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/config/components/ets_frontend/ets_frontend_config.gni") es2abc_root = "//arkcompiler/ets_frontend/es2panda" es2abc_build_path = "" es2abc_build_deps = "" es2abc_out_root = "" es2abc_indep_path = "//binarys/arkcompiler/ets_frontend/innerapis/es2panda/clang_x64/libs" if (host_toolchain == toolchain_mac) { es2abc_out_root = get_label_info("$es2abc_root:es2panda($toolchain_mac)", "root_out_dir") es2abc_build_deps = [ "$es2abc_root:es2panda($toolchain_mac)" ] } else if (host_toolchain == toolchain_win) { es2abc_out_root = get_label_info("$es2abc_root:es2panda($toolchain_win)", "root_out_dir") es2abc_build_deps = [ "$es2abc_root:es2panda($toolchain_win)" ] } else { es2abc_out_root = get_label_info("$es2abc_root:es2panda($toolchain_linux)", "root_out_dir") es2abc_build_deps = [ "$es2abc_root:es2panda($toolchain_linux)" ] } if (ohos_indep_compiler_enable) { es2abc_build_path = es2abc_indep_path } else { es2abc_build_path = es2abc_out_root + "/arkcompiler/ets_frontend" } # Generate abc. # # Mandatory arguments: # plugin_path -- plugin js file path # plugin_name -- name of js file, ex: BatteryPlugin.js # generat_file -- name of generated file # package_name -- name of generated file's package # extra_dependencies -- a list of files that should be considered as dependencies, must be label # out_puts template("es2abc_gen_abc") { assert(defined(invoker.src_js), "src_js is required!") assert(defined(invoker.dst_file), "dst_file is required!") assert(defined(invoker.out_puts), "out_puts is required!") extra_dependencies = [] if (defined(invoker.extra_dependencies)) { extra_dependencies += invoker.extra_dependencies } action("$target_name") { if (defined(invoker.extra_visibility)) { visibility = invoker.extra_visibility } script = "//build/scripts/generate_js_bytecode.py" deps = extra_dependencies deps += es2abc_build_deps args = [ "--src-js", invoker.src_js, "--dst-file", invoker.dst_file, "--frontend-tool-path", rebase_path("${es2abc_build_path}"), ] if (defined(invoker.extension)) { args += [ "--extension", invoker.extension, ] } if (defined(invoker.dump_symbol_table)) { args += [ "--dump-symbol-table", invoker.dump_symbol_table, ] } if (defined(invoker.input_symbol_table)) { args += [ "--input-symbol-table", invoker.input_symbol_table, ] } if (defined(invoker.extra_args)) { args += invoker.extra_args } if (defined(invoker.in_puts)) { inputs = invoker.in_puts } outputs = invoker.out_puts } }