• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-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/ts2panda/ts2abc_config.gni")
15import("//build/ohos.gni")
16import("//foundation/arkui/ace_engine/ace_config.gni")
17import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni")
18import("../../../../../build/uicast.gni")
19
20base_output_path = get_label_info(":gen_abc_proxyclass", "target_out_dir")
21abcproxyclass_obj_path = base_output_path + "/abc_proxy_class.o"
22abcenumstyle_obj_path = base_output_path + "/abc_enum_style.o"
23jsmocksystemplugin_obj_path = base_output_path + "/abc_js_mock_system_plugin.o"
24
25ts2abc_gen_abc("gen_stateMgmt_abc") {
26  extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
27  src_js = rebase_path(
28          "//foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js")
29  dst_file = rebase_path(base_output_path + "/stateMgmt.abc")
30
31  in_puts = [ "//foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js" ]
32  out_puts = [ base_output_path + "/stateMgmt.abc" ]
33}
34
35ts2abc_gen_abc("gen_jsEnumStyle_abc") {
36  extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
37  src_js = rebase_path(
38          "//foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/jsEnumStyle.js")
39  dst_file = rebase_path(base_output_path + "/jsEnumStyle.abc")
40
41  in_puts = [ "//foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/jsEnumStyle.js" ]
42  out_puts = [ base_output_path + "/jsEnumStyle.abc" ]
43}
44
45ts2abc_gen_abc("gen_js_mock_system_plugin_abc") {
46  extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
47  src_js = rebase_path(
48          "$root_out_dir/obj/third_party/jsframework/dist/jsMockSystemPlugin.js")
49  dst_file = rebase_path(base_output_path + "/jsMockSystemPlugin.abc")
50
51  in_puts = [ rebase_path(
52          "$root_out_dir/obj/third_party/jsframework/dist/jsMockSystemPlugin.js") ]
53  out_puts = [ base_output_path + "/jsMockSystemPlugin.abc" ]
54  extra_dependencies = [ "//third_party/jsframework:gen_snapshot" ]
55}
56
57gen_obj("abc_proxyclass") {
58  input = base_output_path + "/stateMgmt.abc"
59  if (use_mac || use_mingw_win || use_ios || use_linux) {
60    abcproxyclass_obj_path = base_output_path + "/js_proxy_class.c"
61  }
62  output = abcproxyclass_obj_path
63  snapshot_dep = [ ":gen_stateMgmt_abc" ]
64}
65
66gen_obj("abc_enum_style") {
67  input = base_output_path + "/jsEnumStyle.abc"
68  if (use_mac || use_mingw_win || use_linux || use_ios) {
69    abcenumstyle_obj_path = base_output_path + "/jsEnumStyle.c"
70  }
71  output = abcenumstyle_obj_path
72  snapshot_dep = [ ":gen_jsEnumStyle_abc" ]
73}
74
75gen_obj("abc_mock_system_plugin") {
76  input = base_output_path + "/jsMockSystemPlugin.abc"
77  if (use_mac || use_mingw_win || use_linux) {
78    jsmocksystemplugin_obj_path = base_output_path + "/js_mock_system_plugin.c"
79  }
80  output = jsmocksystemplugin_obj_path
81  snapshot_dep = [ ":gen_js_mock_system_plugin_abc" ]
82}
83
84template("declarative_js_engine_ark") {
85  forward_variables_from(invoker, "*")
86
87  ohos_source_set(target_name) {
88    subsystem_name = ace_engine_subsystem
89    part_name = ace_engine_part
90    defines += invoker.defines
91    if (target_cpu == "arm64") {
92      defines += [ "APP_USE_ARM64" ]
93    } else if (target_cpu == "arm") {
94      defines += [ "APP_USE_ARM" ]
95    }
96
97    configs = [ "$ace_root:ace_config" ]
98
99    configs += [ "${uicast_configs.ace_uicast}:uicast_jsi_config" ]
100
101    public_configs = [ "//arkcompiler/ets_runtime:ark_jsruntime_public_config" ]
102
103    sources = [
104      "js_converter.cpp",
105      "jsi_declarative_engine.cpp",
106      "jsi_declarative_group_js_bridge.cpp",
107      "jsi_object_template.cpp",
108      "jsi_types.cpp",
109      "jsi_view_register.cpp",
110      "modules/jsi_app_module.cpp",
111      "modules/jsi_context_module.cpp",
112      "modules/jsi_curves_module.cpp",
113      "modules/jsi_matrix4_module.cpp",
114      "modules/jsi_module_manager.cpp",
115      "modules/jsi_router_module.cpp",
116      "modules/jsi_syscap_module.cpp",
117      "modules/jsi_timer_module.cpp",
118    ]
119    deps = []
120    sources += [ "jsi_animator_model_ng_impl.cpp" ]
121    deps += [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
122
123    defines += uicast_configs.uicast_defines
124    sources += uicast_configs.uicast_jsi_sources
125
126    if (!use_ios) {
127      deps += [ "//arkcompiler/ets_runtime:libark_jsruntime" ]
128    } else {
129      deps += [ "//arkcompiler/ets_runtime:libark_jsruntime_static" ]
130    }
131
132    if (defined(config.build_for_preview) && config.build_for_preview) {
133      deps += [ ":gen_obj_src_abc_mock_system_plugin" ]
134      sources += [ "utils/jsi_module_searcher.cpp" ]
135    } else if (!defined(config.use_build_in_js_engine) ||
136               !config.use_build_in_js_engine) {
137      sources += [
138        "$ace_root/frameworks/bridge/js_frontend/engine/jsi/ark_js_runtime.cpp",
139        "$ace_root/frameworks/bridge/js_frontend/engine/jsi/ark_js_value.cpp",
140        "$ace_root/frameworks/bridge/js_frontend/engine/jsi/jsi_base_utils.cpp",
141      ]
142    }
143
144    # if napi support
145    deps += [ "//foundation/arkui/napi:ace_napi_ark" ]
146    public_deps = [ "//foundation/arkui/napi:ace_napi" ]
147
148    deps += [
149      ":gen_obj_src_abc_enum_style",
150      ":gen_obj_src_abc_proxyclass",
151    ]
152  }
153}
154
155foreach(item, ace_platforms) {
156  platform = item.name
157  engine_config = {
158  }
159  engine_config = item.config
160  support_engines = []
161  support_engines = engine_config.js_engines
162  foreach(engine, support_engines) {
163    if (engine.engine_name == "ark") {
164      declarative_js_engine_ark("declarative_js_engine_bridge_ark_$platform") {
165        defines = engine.engine_defines
166        config = {
167        }
168
169        if (defined(item.config)) {
170          config = item.config
171        }
172        if (defined(config.defines)) {
173          defines += config.defines
174        }
175      }
176    }
177  }
178}
179