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("//build/config/components/ets_frontend/es2abc_config.gni") 15import("//build/ohos.gni") 16import("//foundation/arkui/ace_engine/ace_config.gni") 17import("//foundation/arkui/ace_engine/adapter/preview/build/config.gni") 18import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni") 19 20es2abc_gen_abc("gen_promptaction_abc") { 21 src_js = rebase_path("promptaction.js") 22 dst_file = rebase_path(target_out_dir + "/promptaction.abc") 23 in_puts = [ "promptaction.js" ] 24 out_puts = [ target_out_dir + "/promptaction.abc" ] 25 extra_args = [ "--module" ] 26} 27 28base_output_path = get_label_info(":gen_promptaction_abc", "target_out_dir") 29promptaction_obj_path = base_output_path + "/promptaction.o" 30promptaction_abc_obj_path = base_output_path + "/promptaction_abc.o" 31 32gen_obj("promptaction_js") { 33 input = "promptaction.js" 34 if (use_mac || use_mingw_win || use_linux || target_os == "ios") { 35 promptaction_obj_path = base_output_path + "/promptaction.c" 36 } 37 output = promptaction_obj_path 38 snapshot_dep = [] 39} 40 41gen_obj("promptaction_abc") { 42 input = get_label_info(":gen_promptaction_abc", "target_out_dir") + 43 "/promptaction.abc" 44 if (use_mac || use_mingw_win || use_linux || target_os == "ios") { 45 promptaction_abc_obj_path = base_output_path + "/promptaction_abc.c" 46 } 47 output = promptaction_abc_obj_path 48 snapshot_dep = [ ":gen_promptaction_abc" ] 49} 50 51template("napi_promptaction_static") { 52 forward_variables_from(invoker, "*") 53 54 ohos_source_set(target_name) { 55 defines += invoker.defines 56 cflags_cc += invoker.cflags_cc 57 58 configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ] 59 60 sources = [ 61 "../promptaction/prompt_action.cpp", 62 "js_prompt_action.cpp", 63 ] 64 deps = [ 65 ":gen_obj_src_promptaction_abc", 66 ":gen_obj_src_promptaction_js", 67 ] 68 external_deps = [] 69 if (platform != "" && is_arkui_x) { 70 deps += [ "//plugins/libs/napi:napi_$platform" ] 71 } else { 72 external_deps += [ "napi:ace_napi" ] 73 } 74 if (use_hilog) { 75 external_deps += [ "hilog:libhilog" ] 76 } 77 if (defined(config.libace_target)) { 78 deps += [ config.libace_target ] 79 } 80 81 deps += [ "../utils:napi_utils_static_${platform}" ] 82 83 subsystem_name = ace_engine_subsystem 84 part_name = ace_engine_part 85 } 86} 87 88foreach(item, ace_platforms) { 89 napi_promptaction_static("promptaction_static_" + item.name) { 90 defines = [] 91 cflags_cc = [] 92 config = { 93 } 94 platform = item.name 95 96 if (defined(item.config)) { 97 config = item.config 98 } 99 100 if (defined(config.defines)) { 101 defines = config.defines 102 } 103 104 if (defined(config.cflags_cc)) { 105 cflags_cc = config.cflags_cc 106 } 107 } 108} 109