• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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      "../promptaction/prompt_controller.cpp",
63      "js_level_order.cpp",
64      "js_prompt_action.cpp",
65      "js_prompt_controller.cpp",
66    ]
67    deps = [
68      ":gen_obj_src_promptaction_abc",
69      ":gen_obj_src_promptaction_js",
70    ]
71    external_deps = []
72    if (platform != "" && is_arkui_x) {
73      deps += [ "//plugins/libs/napi:napi_$platform" ]
74    } else {
75      external_deps += [ "napi:ace_napi" ]
76    }
77    if (use_hilog) {
78      external_deps += [ "hilog:libhilog" ]
79    }
80    if (defined(config.libace_target)) {
81      deps += [ config.libace_target ]
82    }
83
84    deps += [ "../utils:napi_utils_static_${platform}" ]
85
86    subsystem_name = ace_engine_subsystem
87    part_name = ace_engine_part
88  }
89}
90
91foreach(item, ace_platforms) {
92  napi_promptaction_static("promptaction_static_" + item.name) {
93    defines = []
94    cflags_cc = []
95    config = {
96    }
97    platform = item.name
98
99    if (defined(item.config)) {
100      config = item.config
101    }
102
103    if (defined(config.defines)) {
104      defines = config.defines
105    }
106
107    if (defined(config.cflags_cc)) {
108      cflags_cc = config.cflags_cc
109    }
110  }
111}
112