• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2024 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/ohos.gni")
15import("//build/templates/abc/ohos_abc.gni")
16import("//foundation/arkui/ace_engine/ace_config.gni")
17import("//foundation/arkui/ace_engine/build/ace_ext.gni")
18import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni")
19
20# declarative frontend source
21template("declarative_frontend") {
22  forward_variables_from(invoker, "*")
23  platform = invoker.platform
24
25  ohos_source_set(target_name) {
26    subsystem_name = ace_engine_subsystem
27    part_name = ace_engine_part
28    defines += invoker.defines
29    defines += [ "USE_ARK_ENGINE" ]
30    configs = [ "$ace_root:ace_config" ]
31
32    include_dirs =
33        [ "$ace_napi_frameworks/bridge/declarative_frontend/engine/jsi" ]
34    if (platform == "ohos_ng" || is_arkui_x) {
35      sources = [
36        "ng/declarative_frontend_ng.cpp",
37        "ng/frontend_delegate_declarative_ng.cpp",
38        "ng/page_router_manager.cpp",
39      ]
40    } else {
41      sources = [
42        "declarative_frontend.cpp",
43        "frontend_delegate_declarative.cpp",
44        "ng/page_router_manager.cpp",
45      ]
46    }
47
48    if (ace_engine_feature_enable_split_mode &&
49        defined(vendor_configs.ace_engine_advanced_split_mode_dirs)) {
50      include_dirs += vendor_configs.ace_engine_advanced_split_mode_dirs
51    }
52
53    if (ace_engine_feature_enable_split_mode &&
54        defined(vendor_configs.ace_engine_advanced_split_mode_bridge)) {
55      sources += vendor_configs.ace_engine_advanced_split_mode_bridge
56    } else {
57      sources += [ "ng/page_router_manager_factory.cpp" ]
58    }
59
60    deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
61    if (is_arkui_x) {
62      deps += [
63        "//arkcompiler/ets_runtime:libark_jsruntime_static",
64        "//foundation/arkui/napi:ace_napi",
65      ]
66    }
67    external_deps = [
68      "ets_runtime:libark_jsruntime",
69      "napi:ace_napi",
70    ]
71    if (use_hilog) {
72      external_deps += [ "hilog:libhilog" ]
73    }
74  }
75}
76
77foreach(item, ace_platforms) {
78  platform = item.name
79  declarative_frontend("declarative_frontend_" + item.name) {
80    defines = []
81    config = {
82    }
83
84    if (defined(item.config)) {
85      config = item.config
86    }
87
88    if (defined(config.defines)) {
89      defines = config.defines
90    }
91  }
92}
93
94# js resources objects
95base_output_path = get_label_info(":gen_js_proxyclass", "target_out_dir")
96jsproxyclass_obj_path = base_output_path + "/js_proxy_class.o"
97jsenumstyle_obj_path = base_output_path + "/js_enum_style.o"
98jsmocksystemplugin_obj_path = base_output_path + "/js_mock_system_plugin.o"
99ark_theme_obj_path = base_output_path + "/arkTheme.o"
100jsuicontext_obj_path = base_output_path + "/jsUIContext.o"
101arkcomponent_obj_path = base_output_path + "/arkComponent.o"
102
103gen_obj("js_proxyclass") {
104  input = "engine/stateMgmt.js"
105  if (use_mac || use_mingw_win || use_linux || target_os == "ios") {
106    jsproxyclass_obj_path = base_output_path + "/js_proxy_class.c"
107  }
108  output = jsproxyclass_obj_path
109  snapshot_dep = []
110}
111
112gen_obj("js_enum_style") {
113  input = "engine/jsEnumStyle.js"
114  if (use_mac || use_mingw_win || use_linux || target_os == "ios") {
115    jsenumstyle_obj_path = base_output_path + "/js_enum_style.c"
116  }
117  output = jsenumstyle_obj_path
118  snapshot_dep = []
119}
120
121gen_obj("ark_theme") {
122  input = "engine/arkTheme.js"
123  if (use_mac || use_mingw_win || use_linux || target_os == "ios") {
124    ark_theme_obj_path = base_output_path + "/ark_theme.c"
125  }
126  output = ark_theme_obj_path
127  snapshot_dep = []
128}
129
130gen_obj("ark_component") {
131  input = "engine/arkComponent.js"
132  if (use_mac || use_mingw_win || use_linux || target_os == "ios") {
133    arkcomponent_obj_path = base_output_path + "/ark_component.c"
134  }
135  output = arkcomponent_obj_path
136  snapshot_dep = []
137}
138
139if (!is_arkui_x) {
140  gen_obj("js_mock_system_plugin") {
141    input = "$root_out_dir/obj/ide/tools/previewer/automock/dist/jsMockSystemPlugin.js"
142    if (use_mac || use_mingw_win || use_linux || target_os == "ios") {
143      jsmocksystemplugin_obj_path =
144          base_output_path + "/js_mock_system_plugin.c"
145    }
146    output = jsmocksystemplugin_obj_path
147    snapshot_dep = [ "//ide/tools/previewer/automock:gen_snapshot_jsmock" ]
148  }
149}
150
151gen_obj("js_uicontext") {
152  input = "engine/jsUIContext.js"
153  if (use_mac || use_mingw_win || use_linux || target_os == "ios") {
154    jsuicontext_obj_path = base_output_path + "/jsUIContext.c"
155  }
156  output = jsuicontext_obj_path
157  snapshot_dep = []
158}
159
160# build declarative javascript engine source
161template("declarative_js_engine") {
162  forward_variables_from(invoker, "*")
163
164  ohos_source_set(target_name) {
165    subsystem_name = ace_engine_subsystem
166    part_name = ace_engine_part
167    defines += invoker.defines
168    if (target_cpu == "arm64") {
169      if (!is_mingw) {
170        defines += [ "_ARM64_" ]
171      }
172    }
173    if (current_os == "ohos" && current_cpu == "x86_64") {
174      defines += [ "SIMULATOR_64" ]
175    }
176
177    deps = [
178      ":ark_modifier",
179      ":ark_theme_control",
180      ":gen_obj_src_ark_component",
181      ":gen_obj_src_ark_theme",
182      ":gen_obj_src_js_enum_style",
183      ":gen_obj_src_js_proxyclass",
184      ":mock",
185      ":prefetcher",
186      ":statemanagement",
187      ":x_node",
188      "engine/$engine_path:declarative_js_engine_bridge_${engine_name}_$platform",
189    ]
190
191    if (!is_arkui_x) {
192      deps += [ ":uicontext" ]
193    } else {
194      deps += [ ":gen_obj_src_js_uicontext" ]
195    }
196
197    configs = [ "$ace_root:ace_config" ]
198    if (ace_engine_feature_enable_point_light) {
199      defines += [ "POINT_LIGHT_ENABLE" ]
200    }
201
202    sources = [
203      "engine/bindings_implementation.cpp",
204      "engine/declarative_engine_loader.cpp",
205      "engine/functions/js_animator_function.cpp",
206      "engine/functions/js_click_function.cpp",
207      "engine/functions/js_clipboard_function.cpp",
208      "engine/functions/js_drag_function.cpp",
209      "engine/functions/js_focus_function.cpp",
210      "engine/functions/js_foreach_function.cpp",
211      "engine/functions/js_function.cpp",
212      "engine/functions/js_gesture_function.cpp",
213      "engine/functions/js_gesture_judge_function.cpp",
214      "engine/functions/js_hover_function.cpp",
215      "engine/functions/js_key_function.cpp",
216      "engine/functions/js_mouse_function.cpp",
217      "engine/functions/js_navigation_function.cpp",
218      "engine/functions/js_on_area_change_function.cpp",
219      "engine/functions/js_on_child_touch_test_function.cpp",
220      "engine/functions/js_on_size_change_function.cpp",
221      "engine/functions/js_page_transition_function.cpp",
222      "engine/functions/js_pan_function.cpp",
223      "engine/functions/js_should_built_in_recognizer_parallel_with_function.cpp",
224      "engine/functions/js_swiper_function.cpp",
225      "engine/functions/js_tabs_function.cpp",
226      "engine/functions/js_touch_function.cpp",
227      "engine/functions/js_touch_intercept_function.cpp",
228      "engine/functions/js_webview_function.cpp",
229      "engine/js_types.cpp",
230      "interfaces/profiler/js_profiler.cpp",
231      "jsview/action_sheet/js_action_sheet.cpp",
232      "jsview/canvas/js_canvas.cpp",
233      "jsview/canvas/js_canvas_gradient.cpp",
234      "jsview/canvas/js_canvas_image_data.cpp",
235      "jsview/canvas/js_canvas_path.cpp",
236      "jsview/canvas/js_canvas_pattern.cpp",
237      "jsview/canvas/js_canvas_renderer.cpp",
238      "jsview/canvas/js_drawing_rendering_context.cpp",
239      "jsview/canvas/js_matrix2d.cpp",
240      "jsview/canvas/js_offscreen_canvas.cpp",
241      "jsview/canvas/js_offscreen_rendering_context.cpp",
242      "jsview/canvas/js_path2d.cpp",
243      "jsview/canvas/js_render_image.cpp",
244      "jsview/canvas/js_rendering_context.cpp",
245      "jsview/canvas/js_rendering_context_settings.cpp",
246      "jsview/dialog/js_alert_dialog.cpp",
247      "jsview/dialog/js_custom_dialog_controller.cpp",
248      "jsview/js_animator.cpp",
249      "jsview/js_badge.cpp",
250      "jsview/js_base_node.cpp",
251      "jsview/js_blank.cpp",
252      "jsview/js_button.cpp",
253      "jsview/js_calendar.cpp",
254      "jsview/js_calendar_controller.cpp",
255      "jsview/js_calendar_picker.cpp",
256      "jsview/js_checkbox.cpp",
257      "jsview/js_checkboxgroup.cpp",
258      "jsview/js_circle.cpp",
259      "jsview/js_circle_shape.cpp",
260      "jsview/js_clipboard.cpp",
261      "jsview/js_column.cpp",
262      "jsview/js_column_split.cpp",
263      "jsview/js_common_view.cpp",
264      "jsview/js_container_base.cpp",
265      "jsview/js_container_span.cpp",
266      "jsview/js_content_slot.cpp",
267      "jsview/js_counter.cpp",
268      "jsview/js_data_panel.cpp",
269      "jsview/js_datepicker.cpp",
270      "jsview/js_divider.cpp",
271      "jsview/js_dump_log.cpp",
272      "jsview/js_ellipse.cpp",
273      "jsview/js_ellipse_shape.cpp",
274      "jsview/js_environment.cpp",
275      "jsview/js_flex.cpp",
276      "jsview/js_flex_impl.cpp",
277      "jsview/js_folder_stack.cpp",
278      "jsview/js_foreach.cpp",
279      "jsview/js_form_link.cpp",
280      "jsview/js_gauge.cpp",
281      "jsview/js_gesture.cpp",
282      "jsview/js_grid.cpp",
283      "jsview/js_grid_col.cpp",
284      "jsview/js_grid_container.cpp",
285      "jsview/js_grid_item.cpp",
286      "jsview/js_grid_row.cpp",
287      "jsview/js_hyperlink.cpp",
288      "jsview/js_if_else.cpp",
289      "jsview/js_image.cpp",
290      "jsview/js_image_animator.cpp",
291      "jsview/js_image_span.cpp",
292      "jsview/js_indexer.cpp",
293      "jsview/js_interactable_view.cpp",
294      "jsview/js_keyboard_avoid.cpp",
295      "jsview/js_layout_manager.cpp",
296      "jsview/js_lazy_foreach.cpp",
297      "jsview/js_line.cpp",
298      "jsview/js_linear_gradient.cpp",
299      "jsview/js_list.cpp",
300      "jsview/js_list_item.cpp",
301      "jsview/js_list_item_group.cpp",
302      "jsview/js_loading_progress.cpp",
303      "jsview/js_local_storage.cpp",
304      "jsview/js_location_button.cpp",
305      "jsview/js_marquee.cpp",
306      "jsview/js_menu.cpp",
307      "jsview/js_menu_item.cpp",
308      "jsview/js_menu_item_group.cpp",
309      "jsview/js_mock.cpp",
310      "jsview/js_nav_path_stack.cpp",
311      "jsview/js_navdestination.cpp",
312      "jsview/js_navdestination_context.cpp",
313      "jsview/js_navigation.cpp",
314      "jsview/js_navigation_stack.cpp",
315      "jsview/js_navigation_utils.cpp",
316      "jsview/js_navigator.cpp",
317      "jsview/js_navrouter.cpp",
318      "jsview/js_node_container.cpp",
319      "jsview/js_page_transition.cpp",
320      "jsview/js_pan_handler.cpp",
321      "jsview/js_particle.cpp",
322      "jsview/js_paste_button.cpp",
323      "jsview/js_path.cpp",
324      "jsview/js_path_shape.cpp",
325      "jsview/js_pattern_lock.cpp",
326      "jsview/js_persistent.cpp",
327      "jsview/js_polygon.cpp",
328      "jsview/js_polyline.cpp",
329      "jsview/js_progress.cpp",
330      "jsview/js_qrcode.cpp",
331      "jsview/js_radio.cpp",
332      "jsview/js_rect.cpp",
333      "jsview/js_rect_shape.cpp",
334      "jsview/js_recycle_view.cpp",
335      "jsview/js_refresh.cpp",
336      "jsview/js_relative_container.cpp",
337      "jsview/js_repeat.cpp",
338      "jsview/js_repeat_virtual_scroll.cpp",
339      "jsview/js_richeditor.cpp",
340      "jsview/js_row.cpp",
341      "jsview/js_row_split.cpp",
342      "jsview/js_save_button.cpp",
343      "jsview/js_scope_util.cpp",
344      "jsview/js_scroll.cpp",
345      "jsview/js_scrollable.cpp",
346      "jsview/js_scrollable_base.cpp",
347      "jsview/js_scroller.cpp",
348      "jsview/js_search.cpp",
349      "jsview/js_sec_button_base.cpp",
350      "jsview/js_select.cpp",
351      "jsview/js_shape.cpp",
352      "jsview/js_shape_abstract.cpp",
353      "jsview/js_sheet.cpp",
354      "jsview/js_side_bar.cpp",
355      "jsview/js_slider.cpp",
356      "jsview/js_sliding_panel.cpp",
357      "jsview/js_span.cpp",
358      "jsview/js_stack.cpp",
359      "jsview/js_state_mgmt_profiler.cpp",
360      "jsview/js_stepper.cpp",
361      "jsview/js_stepper_item.cpp",
362      "jsview/js_swiper.cpp",
363      "jsview/js_symbol.cpp",
364      "jsview/js_symbol_span.cpp",
365      "jsview/js_tab_content.cpp",
366      "jsview/js_tabs.cpp",
367      "jsview/js_tabs_controller.cpp",
368      "jsview/js_tabs_feature.cpp",
369      "jsview/js_text.cpp",
370      "jsview/js_text_clock.cpp",
371      "jsview/js_text_editable_controller.cpp",
372      "jsview/js_textarea.cpp",
373      "jsview/js_textfield.cpp",
374      "jsview/js_textinput.cpp",
375      "jsview/js_textpicker.cpp",
376      "jsview/js_texttimer.cpp",
377      "jsview/js_toggle.cpp",
378      "jsview/js_touch_handler.cpp",
379      "jsview/js_utils.cpp",
380      "jsview/js_view.cpp",
381      "jsview/js_view_abstract.cpp",
382      "jsview/js_view_context.cpp",
383      "jsview/js_view_functions.cpp",
384      "jsview/js_view_measure_layout.cpp",
385      "jsview/js_view_stack_processor.cpp",
386      "jsview/js_water_flow.cpp",
387      "jsview/js_water_flow_item.cpp",
388      "jsview/js_water_flow_sections.cpp",
389      "jsview/menu/js_context_menu.cpp",
390      "jsview/scroll_bar/js_scroll_bar.cpp",
391      "sharedata/js_share_data.cpp",
392      "style_string/js_span_object.cpp",
393      "style_string/js_span_string.cpp",
394      "view_stack_processor.cpp",
395
396      # ark_theme
397      "ark_theme/theme_apply/js_with_theme.cpp",
398
399      # Models implemenations for classic fw
400      "jsview/models/action_sheet_model_impl.cpp",
401      "jsview/models/alert_dialog_model_impl.cpp",
402      "jsview/models/animator_model_impl.cpp",
403      "jsview/models/badge_model_impl.cpp",
404      "jsview/models/blank_model_impl.cpp",
405      "jsview/models/button_model_impl.cpp",
406      "jsview/models/calendar_controller_model_impl.cpp",
407      "jsview/models/calendar_model_impl.cpp",
408      "jsview/models/canvas/canvas_model_impl.cpp",
409      "jsview/models/canvas/canvas_rendering_context_2d_model_impl.cpp",
410      "jsview/models/canvas/offscreen_canvas_rendering_context_2d_model_impl.cpp",
411      "jsview/models/checkbox_model_impl.cpp",
412      "jsview/models/checkboxgroup_model_impl.cpp",
413      "jsview/models/circle_model_impl.cpp",
414      "jsview/models/column_model_impl.cpp",
415      "jsview/models/common_view_model_impl.cpp",
416      "jsview/models/counter_model_impl.cpp",
417      "jsview/models/custom_dialog_controller_model_impl.cpp",
418      "jsview/models/data_panel_model_impl.cpp",
419      "jsview/models/divider_model_impl.cpp",
420      "jsview/models/ellipse_model_impl.cpp",
421      "jsview/models/flex_model_impl.cpp",
422      "jsview/models/for_each_model_impl.cpp",
423      "jsview/models/gauge_model_impl.cpp",
424      "jsview/models/gesture_model_impl.cpp",
425      "jsview/models/grid_col_model_impl.cpp",
426      "jsview/models/grid_container_model_impl.cpp",
427      "jsview/models/grid_item_model_impl.cpp",
428      "jsview/models/grid_model_impl.cpp",
429      "jsview/models/grid_row_model_impl.cpp",
430      "jsview/models/hyperlink_model_impl.cpp",
431      "jsview/models/if_else_model_impl.cpp",
432      "jsview/models/image_animator_model_impl.cpp",
433      "jsview/models/image_model_impl.cpp",
434      "jsview/models/indexer_model_impl.cpp",
435      "jsview/models/lazy_for_each_model_impl.cpp",
436      "jsview/models/line_model_impl.cpp",
437      "jsview/models/linear_split_model_impl.cpp",
438      "jsview/models/list_item_group_model_impl.cpp",
439      "jsview/models/list_item_model_impl.cpp",
440      "jsview/models/list_model_impl.cpp",
441      "jsview/models/loading_progress_model_impl.cpp",
442      "jsview/models/marquee_model_impl.cpp",
443      "jsview/models/menu_item_model_impl.cpp",
444      "jsview/models/menu_model_impl.cpp",
445      "jsview/models/navigation_model_impl.cpp",
446      "jsview/models/navigator_model_impl.cpp",
447      "jsview/models/page_transition_model_impl.cpp",
448      "jsview/models/path_model_impl.cpp",
449      "jsview/models/patternlock_model_impl.cpp",
450      "jsview/models/picker_model_impl.cpp",
451      "jsview/models/polygon_model_impl.cpp",
452      "jsview/models/progress_model_impl.cpp",
453      "jsview/models/qrcode_model_impl.cpp",
454      "jsview/models/radio_model_impl.cpp",
455      "jsview/models/rect_model_impl.cpp",
456      "jsview/models/refresh_model_impl.cpp",
457      "jsview/models/relative_container_model_impl.cpp",
458      "jsview/models/richeditor_model_impl.cpp",
459      "jsview/models/row_model_impl.cpp",
460      "jsview/models/scroll_bar_model_impl.cpp",
461      "jsview/models/scroll_model_impl.cpp",
462      "jsview/models/search_model_impl.cpp",
463      "jsview/models/select_model_impl.cpp",
464      "jsview/models/shape_abstract_model_impl.cpp",
465      "jsview/models/shape_model_impl.cpp",
466      "jsview/models/side_bar_container_model_impl.cpp",
467      "jsview/models/slider_model_impl.cpp",
468      "jsview/models/sliding_panel_model_impl.cpp",
469      "jsview/models/span_model_impl.cpp",
470      "jsview/models/stack_model_impl.cpp",
471      "jsview/models/stepper_item_model_impl.cpp",
472      "jsview/models/stepper_model_impl.cpp",
473      "jsview/models/swiper_model_impl.cpp",
474      "jsview/models/tab_content_model_impl.cpp",
475      "jsview/models/tabs_model_impl.cpp",
476      "jsview/models/text_clock_model_impl.cpp",
477      "jsview/models/text_field_model_impl.cpp",
478      "jsview/models/text_model_impl.cpp",
479      "jsview/models/text_timer_model_impl.cpp",
480      "jsview/models/textpicker_model_impl.cpp",
481      "jsview/models/timepicker_model_impl.cpp",
482      "jsview/models/toggle_model_impl.cpp",
483      "jsview/models/view_abstract_model_impl.cpp",
484      "jsview/models/view_context_model_impl.cpp",
485      "jsview/models/view_full_update_model_impl.cpp",
486      "jsview/models/view_partial_update_model_impl.cpp",
487      "jsview/models/water_flow_item_model_impl.cpp",
488      "jsview/models/water_flow_model_impl.cpp",
489    ]
490
491    external_deps = [ "graphic_2d:drawing_napi_impl" ]
492    if (use_hilog) {
493      external_deps += [ "hilog:libhilog" ]
494    }
495    if (defined(config.enable_drag_framework) && config.enable_drag_framework &&
496        defined(global_parts_info.distributeddatamgr_udmf)) {
497      external_deps += [
498        "udmf:udmf_client",
499        "udmf:udmf_data_napi",
500      ]
501    }
502
503    # rich components needed by phone and TV. wearable like watch do not need them
504    if (defined(config.rich_components_support) &&
505        config.rich_components_support) {
506      sources += [
507        "jsview/js_camera.cpp",
508        "jsview/js_piece.cpp",
509        "jsview/js_rating.cpp",
510        "jsview/models/rating_model_impl.cpp",
511      ]
512      if (defined(config.video_components_support) &&
513          config.video_components_support) {
514        sources += [
515          "jsview/js_video.cpp",
516          "jsview/js_video_controller.cpp",
517          "jsview/models/video_model_impl.cpp",
518        ]
519      }
520      if (defined(config.video_support_jsstack) &&
521          config.video_support_jsstack) {
522        external_deps += [ "hiview:libxpower_event_js" ]
523      }
524    }
525
526    include_dirs = []
527    if (defined(vendor_configs.ace_engine_advanced)) {
528      include_dirs += vendor_configs.ace_advance_dirs
529      sources += vendor_configs.ace_engine_advanced_jsview
530    } else {
531      sources += [ "jsview/js_cached_image.cpp" ]
532    }
533
534    if (defined(config.xcomponent_components_support) &&
535        config.xcomponent_components_support) {
536      sources += [
537        "jsview/js_xcomponent.cpp",
538        "jsview/js_xcomponent_controller.cpp",
539        "jsview/models/xcomponent_model_impl.cpp",
540      ]
541    }
542
543    if (defined(config.enable_ability_component) &&
544        config.enable_ability_component) {
545      sources += [
546        "jsview/js_ability_component.cpp",
547        "jsview/js_ability_component_controller.cpp",
548        "jsview/models/ability_component_model_impl.cpp",
549      ]
550
551      external_deps += [
552        "input:libmmi-client",
553        "window_manager:scene_session",
554      ]
555    }
556
557    if (defined(config.web_components_support) &&
558        config.web_components_support) {
559      if (is_arkui_x) {
560        sources += [
561          "jsview/js_web.cpp",
562          "jsview/models/web_model_impl.cpp",
563        ]
564      } else {
565        sources += [
566          "jsview/js_richtext.cpp",
567          "jsview/js_web.cpp",
568          "jsview/js_web_controller.cpp",
569          "jsview/models/richtext_model_impl.cpp",
570          "jsview/models/web_model_impl.cpp",
571        ]
572      }
573    }
574
575    if (defined(config.form_components_support) &&
576        config.form_components_support) {
577      sources += [
578        "jsview/js_form.cpp",
579        "jsview/js_form_menu_item.cpp",
580        "jsview/models/form_model_impl.cpp",
581      ]
582    }
583
584    if (defined(config.remote_window_support) && config.remote_window_support) {
585      sources += [
586        "jsview/js_remote_window.cpp",
587        "jsview/models/remote_window_model_impl.cpp",
588      ]
589    }
590
591    if (defined(config.effect_component_support) &&
592        config.effect_component_support) {
593      sources += [
594        "jsview/js_effect_component.cpp",
595        "jsview/models/effect_component_model_impl.cpp",
596      ]
597    }
598
599    if (defined(config.plugin_components_support) &&
600        config.plugin_components_support) {
601      sources += [
602        "jsview/js_plugin.cpp",
603        "jsview/models/plugin_model_impl.cpp",
604      ]
605    }
606
607    if (defined(config.preview_support) && config.preview_support) {
608      sources += [ "jsview/js_previewer_mock.cpp" ]
609    }
610
611    if (defined(config.model_component_support) &&
612        config.model_component_support) {
613      sources += [ "jsview/js_sceneview.cpp" ]
614      external_deps += [ "graphic_3d:3dWidgetAdapterInterface" ]
615    }
616
617    if (defined(config.use_build_in_js_engine) &&
618        config.use_build_in_js_engine) {
619      deps += [ "$ace_root/frameworks/bridge:framework_bridge_$platform" ]
620      defines += [ "BUILT_IN_JS_ENGINE" ]
621    } else {
622      sources += [
623        "$ace_root/frameworks/bridge/js_frontend/engine/common/js_engine.cpp",
624      ]
625      deps += [ "$ace_root/build:libace_compatible" ]
626      if (defined(config.build_container_scope_lib) &&
627          config.build_container_scope_lib) {
628        if (is_arkui_x) {
629          deps += [ "$ace_napi:ace_container_scope_static" ]
630        } else {
631          external_deps += [ "napi:ace_container_scope" ]
632        }
633      }
634    }
635
636    deps += [ ":shape" ]
637
638    # add for cross_platfrom_build temporarily, shall be removed after external_deps is supported
639    if (is_arkui_x) {
640      configs += [ "$ark_ets_path:ark_jsruntime_public_config" ]
641      deps += [ "$ark_ets_path:libark_jsruntime_static" ]
642      if (defined(config.pixel_map_support) && config.pixel_map_support) {
643        configs += [ "//foundation/multimedia/image_framework/interfaces/innerkits:image_external_config" ]
644      }
645    } else {
646      external_deps += [
647        "ets_runtime:libark_jsruntime",
648        "napi:ace_napi",
649      ]
650    }
651
652    if (platform == "windows" || platform == "mac" || platform == "linux") {
653      deps += [ ":gen_obj_src_js_mock_system_plugin" ]
654    } else {
655      if (defined(config.plugin_components_support) &&
656          config.plugin_components_support) {
657        if (!use_mingw_win && !use_mac && !use_linux) {
658          external_deps += [
659            "image_framework:image",
660            "image_framework:image_native",
661          ]
662        }
663      } else {
664        external_deps += [
665          "image_framework:image",
666          "image_framework:image_native",
667        ]
668      }
669
670      if (defined(config.window_scene_support) && config.window_scene_support) {
671        sources += [
672          "jsview/js_embedded_component.cpp",
673          "jsview/js_security_ui_extension.cpp",
674          "jsview/js_ui_extension.cpp",
675          "jsview/window_scene/js_root_scene.cpp",
676          "jsview/window_scene/js_screen.cpp",
677          "jsview/window_scene/js_window_scene.cpp",
678        ]
679
680        if (defined(config.dynamic_component_support) &&
681            config.dynamic_component_support && !build_ohos_sdk) {
682          external_deps += [ "ets_utils:worker" ]
683          sources += [
684            "jsview/js_dynamic_component.cpp",
685            "jsview/js_isolated_component.cpp",
686          ]
687        }
688      }
689    }
690  }
691}
692
693# build ng declarative javascript engine source
694template("declarative_js_engine_ng") {
695  forward_variables_from(invoker, "*")
696
697  ohos_source_set(target_name) {
698    subsystem_name = ace_engine_subsystem
699    part_name = ace_engine_part
700    defines += invoker.defines
701    if (target_cpu == "arm64") {
702      if (!is_mingw) {
703        defines += [ "_ARM64_" ]
704      }
705    }
706    if (current_os == "ohos" && current_cpu == "x86_64") {
707      defines += [ "SIMULATOR_64" ]
708    }
709
710    deps = [
711      ":ark_modifier",
712      ":ark_theme_control",
713      ":gen_obj_src_ark_component",
714      ":gen_obj_src_ark_theme",
715      ":gen_obj_src_js_enum_style",
716      ":gen_obj_src_js_proxyclass",
717      ":mock",
718      ":prefetcher",
719      ":statemanagement",
720      ":x_node",
721      "engine/$engine_path:declarative_js_engine_bridge_${engine_name}_$platform",
722    ]
723
724    if (!is_arkui_x) {
725      deps += [ ":uicontext" ]
726    } else {
727      deps += [ ":gen_obj_src_js_uicontext" ]
728    }
729
730    configs = [ "$ace_root:ace_config" ]
731
732    sources = [
733      "engine/bindings_implementation.cpp",
734      "engine/declarative_engine_loader.cpp",
735      "engine/functions/js_animator_function.cpp",
736      "engine/functions/js_click_function.cpp",
737      "engine/functions/js_clipboard_function.cpp",
738      "engine/functions/js_drag_function.cpp",
739      "engine/functions/js_focus_function.cpp",
740      "engine/functions/js_foreach_function.cpp",
741      "engine/functions/js_function.cpp",
742      "engine/functions/js_gesture_function.cpp",
743      "engine/functions/js_gesture_judge_function.cpp",
744      "engine/functions/js_hover_function.cpp",
745      "engine/functions/js_key_function.cpp",
746      "engine/functions/js_mouse_function.cpp",
747      "engine/functions/js_navigation_function.cpp",
748      "engine/functions/js_on_area_change_function.cpp",
749      "engine/functions/js_on_child_touch_test_function.cpp",
750      "engine/functions/js_on_size_change_function.cpp",
751      "engine/functions/js_page_transition_function.cpp",
752      "engine/functions/js_pan_function.cpp",
753      "engine/functions/js_should_built_in_recognizer_parallel_with_function.cpp",
754      "engine/functions/js_swiper_function.cpp",
755      "engine/functions/js_tabs_function.cpp",
756      "engine/functions/js_touch_function.cpp",
757      "engine/functions/js_touch_intercept_function.cpp",
758      "engine/functions/js_webview_function.cpp",
759      "engine/js_types.cpp",
760      "jsview/js_dump_log.cpp",
761      "jsview/js_environment.cpp",
762      "jsview/js_local_storage.cpp",
763      "jsview/js_persistent.cpp",
764      "jsview/js_state_mgmt_profiler.cpp",
765      "jsview/js_view_functions.cpp",
766      "jsview/js_view_measure_layout.cpp",
767      "jsview/js_view_stack_processor.cpp",
768      "sharedata/js_share_data.cpp",
769      "view_stack_processor.cpp",
770
771      # jsviews
772      "interfaces/profiler/js_profiler.cpp",
773      "jsview/action_sheet/js_action_sheet.cpp",
774      "jsview/canvas/js_canvas.cpp",
775      "jsview/canvas/js_canvas_gradient.cpp",
776      "jsview/canvas/js_canvas_image_data.cpp",
777      "jsview/canvas/js_canvas_path.cpp",
778      "jsview/canvas/js_canvas_pattern.cpp",
779      "jsview/canvas/js_canvas_renderer.cpp",
780      "jsview/canvas/js_drawing_rendering_context.cpp",
781      "jsview/canvas/js_matrix2d.cpp",
782      "jsview/canvas/js_offscreen_canvas.cpp",
783      "jsview/canvas/js_offscreen_rendering_context.cpp",
784      "jsview/canvas/js_path2d.cpp",
785      "jsview/canvas/js_render_image.cpp",
786      "jsview/canvas/js_rendering_context.cpp",
787      "jsview/canvas/js_rendering_context_settings.cpp",
788      "jsview/dialog/js_alert_dialog.cpp",
789      "jsview/dialog/js_custom_dialog_controller.cpp",
790      "jsview/js_animator.cpp",
791      "jsview/js_badge.cpp",
792      "jsview/js_base_node.cpp",
793      "jsview/js_blank.cpp",
794      "jsview/js_button.cpp",
795      "jsview/js_calendar.cpp",
796      "jsview/js_calendar_controller.cpp",
797      "jsview/js_calendar_picker.cpp",
798      "jsview/js_checkbox.cpp",
799      "jsview/js_checkboxgroup.cpp",
800      "jsview/js_circle.cpp",
801      "jsview/js_circle_shape.cpp",
802      "jsview/js_clipboard.cpp",
803      "jsview/js_column.cpp",
804      "jsview/js_column_split.cpp",
805      "jsview/js_common_view.cpp",
806      "jsview/js_container_base.cpp",
807      "jsview/js_container_span.cpp",
808      "jsview/js_content_slot.cpp",
809      "jsview/js_counter.cpp",
810      "jsview/js_data_panel.cpp",
811      "jsview/js_datepicker.cpp",
812      "jsview/js_divider.cpp",
813      "jsview/js_ellipse.cpp",
814      "jsview/js_ellipse_shape.cpp",
815      "jsview/js_flex.cpp",
816      "jsview/js_flex_impl.cpp",
817      "jsview/js_folder_stack.cpp",
818      "jsview/js_foreach.cpp",
819      "jsview/js_form_link.cpp",
820      "jsview/js_gauge.cpp",
821      "jsview/js_gesture.cpp",
822      "jsview/js_grid.cpp",
823      "jsview/js_grid_col.cpp",
824      "jsview/js_grid_container.cpp",
825      "jsview/js_grid_item.cpp",
826      "jsview/js_grid_row.cpp",
827      "jsview/js_hyperlink.cpp",
828      "jsview/js_if_else.cpp",
829      "jsview/js_image.cpp",
830      "jsview/js_image_animator.cpp",
831      "jsview/js_image_span.cpp",
832      "jsview/js_indexer.cpp",
833      "jsview/js_interactable_view.cpp",
834      "jsview/js_keyboard_avoid.cpp",
835      "jsview/js_layout_manager.cpp",
836      "jsview/js_lazy_foreach.cpp",
837      "jsview/js_line.cpp",
838      "jsview/js_linear_gradient.cpp",
839      "jsview/js_list.cpp",
840      "jsview/js_list_item.cpp",
841      "jsview/js_list_item_group.cpp",
842      "jsview/js_loading_progress.cpp",
843      "jsview/js_location_button.cpp",
844      "jsview/js_marquee.cpp",
845      "jsview/js_menu.cpp",
846      "jsview/js_menu_item.cpp",
847      "jsview/js_menu_item_group.cpp",
848      "jsview/js_mock.cpp",
849      "jsview/js_nav_path_stack.cpp",
850      "jsview/js_navdestination.cpp",
851      "jsview/js_navdestination_context.cpp",
852      "jsview/js_navigation.cpp",
853      "jsview/js_navigation_stack.cpp",
854      "jsview/js_navigation_utils.cpp",
855      "jsview/js_navigator.cpp",
856      "jsview/js_navrouter.cpp",
857      "jsview/js_node_container.cpp",
858      "jsview/js_page_transition.cpp",
859      "jsview/js_paste_button.cpp",
860      "jsview/js_path.cpp",
861      "jsview/js_path_shape.cpp",
862      "jsview/js_polygon.cpp",
863      "jsview/js_polyline.cpp",
864      "jsview/js_progress.cpp",
865      "jsview/js_radio.cpp",
866      "jsview/js_rating.cpp",
867      "jsview/js_rect.cpp",
868      "jsview/js_rect_shape.cpp",
869      "jsview/js_recycle_view.cpp",
870      "jsview/js_refresh.cpp",
871      "jsview/js_repeat.cpp",
872      "jsview/js_repeat_virtual_scroll.cpp",
873      "jsview/js_richeditor.cpp",
874      "jsview/js_row.cpp",
875      "jsview/js_row_split.cpp",
876      "jsview/js_save_button.cpp",
877      "jsview/js_scope_util.cpp",
878      "jsview/js_scroll.cpp",
879      "jsview/js_scrollable.cpp",
880      "jsview/js_scrollable_base.cpp",
881      "jsview/js_scroller.cpp",
882      "jsview/js_search.cpp",
883      "jsview/js_sec_button_base.cpp",
884      "jsview/js_select.cpp",
885      "jsview/js_shape.cpp",
886      "jsview/js_shape_abstract.cpp",
887      "jsview/js_side_bar.cpp",
888      "jsview/js_slider.cpp",
889      "jsview/js_sliding_panel.cpp",
890      "jsview/js_span.cpp",
891      "jsview/js_stack.cpp",
892      "jsview/js_stepper.cpp",
893      "jsview/js_stepper_item.cpp",
894      "jsview/js_swiper.cpp",
895      "jsview/js_symbol.cpp",
896      "jsview/js_symbol_span.cpp",
897      "jsview/js_tab_content.cpp",
898      "jsview/js_tabs.cpp",
899      "jsview/js_tabs_controller.cpp",
900      "jsview/js_tabs_feature.cpp",
901      "jsview/js_text.cpp",
902      "jsview/js_text_clock.cpp",
903      "jsview/js_text_editable_controller.cpp",
904      "jsview/js_textarea.cpp",
905      "jsview/js_textfield.cpp",
906      "jsview/js_textinput.cpp",
907      "jsview/js_textpicker.cpp",
908      "jsview/js_texttimer.cpp",
909      "jsview/js_toggle.cpp",
910      "jsview/js_utils.cpp",
911      "jsview/js_view.cpp",
912      "jsview/js_view_abstract.cpp",
913      "jsview/js_view_context.cpp",
914      "jsview/js_water_flow.cpp",
915      "jsview/js_water_flow_item.cpp",
916      "jsview/js_water_flow_sections.cpp",
917      "jsview/menu/js_context_menu.cpp",
918      "jsview/scroll_bar/js_scroll_bar.cpp",
919      "style_string/js_span_object.cpp",
920      "style_string/js_span_string.cpp",
921
922      # ark_theme
923      "ark_theme/theme_apply/js_with_theme.cpp",
924    ]
925
926    sources += [
927      "$ace_root/frameworks/bridge/js_frontend/engine/common/js_engine.cpp",
928    ]
929
930    external_deps = [ "graphic_2d:drawing_napi_impl" ]
931    if (use_hilog) {
932      external_deps += [ "hilog:libhilog" ]
933    }
934
935    if (!defined(config.use_components_lib) || !config.use_components_lib) {
936      sources += [
937        "jsview/js_pattern_lock.cpp",
938        "jsview/js_qrcode.cpp",
939        "jsview/js_relative_container.cpp",
940      ]
941    }
942
943    if (defined(config.video_components_support) &&
944        config.video_components_support) {
945      sources += [
946        "jsview/js_video.cpp",
947        "jsview/js_video_controller.cpp",
948      ]
949      if (defined(config.video_support_jsstack) &&
950          config.video_support_jsstack) {
951        external_deps += [ "hiview:libxpower_event_js" ]
952      }
953    }
954
955    if (defined(config.window_scene_support) && config.window_scene_support) {
956      sources += [
957        "jsview/js_embedded_component.cpp",
958        "jsview/js_security_ui_extension.cpp",
959        "jsview/js_ui_extension.cpp",
960        "jsview/window_scene/js_root_scene.cpp",
961        "jsview/window_scene/js_screen.cpp",
962        "jsview/window_scene/js_window_scene.cpp",
963      ]
964
965      if (defined(config.dynamic_component_support) &&
966          config.dynamic_component_support && !build_ohos_sdk) {
967        external_deps += [ "ets_utils:worker" ]
968
969        sources += [
970          "jsview/js_dynamic_component.cpp",
971          "jsview/js_isolated_component.cpp",
972        ]
973      }
974    }
975
976    if (defined(config.enable_ability_component) &&
977        config.enable_ability_component) {
978      sources += [
979        "jsview/js_ability_component.cpp",
980        "jsview/js_ability_component_controller.cpp",
981      ]
982
983      external_deps += [
984        "input:libmmi-client",
985        "window_manager:scene_session",
986      ]
987    }
988
989    if (defined(config.form_components_support) &&
990        config.form_components_support) {
991      sources += [ "jsview/js_form.cpp" ]
992    }
993
994    if (defined(config.plugin_components_support) &&
995        config.plugin_components_support) {
996      sources += [ "jsview/js_plugin.cpp" ]
997    }
998
999    if (defined(config.web_components_support) &&
1000        config.web_components_support) {
1001      sources += [
1002        "jsview/js_richtext.cpp",
1003        "jsview/js_web.cpp",
1004        "jsview/js_web_controller.cpp",
1005      ]
1006    }
1007
1008    if (defined(config.remote_window_support) && config.remote_window_support) {
1009      sources += [ "jsview/js_remote_window.cpp" ]
1010    }
1011
1012    if (!defined(vendor_configs.ace_engine_advanced)) {
1013      sources += [ "jsview/js_cached_image.cpp" ]
1014    }
1015
1016    if (defined(config.xcomponent_components_support) &&
1017        config.xcomponent_components_support) {
1018      sources += [
1019        "jsview/js_xcomponent.cpp",
1020        "jsview/js_xcomponent_controller.cpp",
1021      ]
1022    }
1023
1024    if (defined(config.effect_component_support) &&
1025        config.effect_component_support) {
1026      sources += [
1027        "jsview/js_effect_component.cpp",
1028        #"jsview/models/effect_component_model_impl.cpp",
1029      ]
1030    }
1031
1032    if (defined(config.model_component_support) &&
1033        config.model_component_support) {
1034      sources += [ "jsview/js_sceneview.cpp" ]
1035      external_deps += [ "graphic_3d:3dWidgetAdapterInterface" ]
1036    }
1037
1038    if (defined(config.use_build_in_js_engine) &&
1039        config.use_build_in_js_engine) {
1040      deps += [ "$ace_root/frameworks/bridge:framework_bridge_ng_$platform" ]
1041      defines += [ "BUILT_IN_JS_ENGINE" ]
1042    } else {
1043      if (is_asan || !ace_engine_feature_enable_libace) {
1044        deps += [ "$ace_root/build:libace_compatible" ]
1045      } else {
1046        deps += [ "$ace_root/build:libace" ]
1047      }
1048      if (defined(config.build_container_scope_lib) &&
1049          config.build_container_scope_lib) {
1050        external_deps += [ "napi:ace_container_scope" ]
1051      }
1052    }
1053    include_dirs = []
1054
1055    # add for cross_platfrom_build temporarily, shall be removed after external_deps is supported
1056    if (is_arkui_x) {
1057      sources -= [
1058        "interfaces/profiler/js_profiler.cpp",
1059        "jsview/js_location_button.cpp",
1060        "jsview/js_paste_button.cpp",
1061        "jsview/js_save_button.cpp",
1062        "jsview/js_sec_button_base.cpp",
1063        "jsview/menu/js_context_menu.cpp",
1064      ]
1065      include_dirs += [ "//commonlibrary/c_utils/base/include" ]
1066      configs += [ "$ark_ets_path:ark_jsruntime_public_config" ]
1067      deps += [
1068        "$ark_ets_path:libark_jsruntime_static",
1069        "//foundation/graphic/graphic_2d/interfaces/kits/napi/graphic/drawing:drawing_napi_impl",
1070      ]
1071      if (defined(config.pixel_map_support) && config.pixel_map_support) {
1072        configs += [ "//foundation/multimedia/image_framework/interfaces/innerkits:image_external_config" ]
1073      }
1074    } else {
1075      external_deps += [
1076        "ets_runtime:libark_jsruntime",
1077        "napi:ace_napi",
1078      ]
1079    }
1080
1081    deps += [ ":shape" ]
1082
1083    if (defined(config.enable_drag_framework) && config.enable_drag_framework &&
1084        defined(global_parts_info.distributeddatamgr_udmf)) {
1085      external_deps += [
1086        "udmf:udmf_client",
1087        "udmf:udmf_data_napi",
1088      ]
1089    }
1090
1091    if (!use_mingw_win && !use_mac && !use_linux) {
1092      external_deps += [
1093        "image_framework:image",
1094        "image_framework:image_native",
1095      ]
1096    }
1097  }
1098}
1099
1100# dynamic generate js_engine targets
1101foreach(item, ace_platforms) {
1102  platform = item.name
1103  engine_config = {
1104  }
1105  engine_config = item.config
1106  support_engines = []
1107  support_engines = engine_config.js_engines
1108  foreach(engine, support_engines) {
1109    declarative_js_engine(
1110        "declarative_js_engine_${engine.engine_name}_$platform") {
1111      platform = item.name
1112      engine_name = engine.engine_name
1113      engine_path = engine.engine_path
1114      defines = engine.engine_defines
1115
1116      config = {
1117      }
1118      if (defined(item.config)) {
1119        config = item.config
1120      }
1121      if (defined(config.defines)) {
1122        defines += config.defines
1123      }
1124    }
1125
1126    declarative_js_engine_ng(
1127        "declarative_js_engine_ng_${engine.engine_name}_$platform") {
1128      platform = item.name
1129      engine_name = engine.engine_name
1130      engine_path = engine.engine_path
1131      defines = engine.engine_defines
1132
1133      config = {
1134      }
1135      if (defined(item.config)) {
1136        config = item.config
1137      }
1138      if (defined(config.defines)) {
1139        defines += config.defines
1140      }
1141    }
1142  }
1143}
1144
1145ohos_abc("statemanagement") {
1146  sources = [ "engine/jsStateManagement.js" ]
1147  output_name = "statemanagement"
1148  install_images = [ "system" ]
1149  module_install_dir = "etc/abc/arkui"
1150  subsystem_name = ace_engine_subsystem
1151  part_name = ace_engine_part
1152}
1153
1154ohos_abc("mock") {
1155  sources = [ "engine/jsMock.js" ]
1156  output_name = "mock"
1157  install_images = [ "system" ]
1158  module_install_dir = "etc/abc/arkui"
1159  subsystem_name = ace_engine_subsystem
1160  part_name = ace_engine_part
1161}
1162
1163ohos_abc("x_node") {
1164  sources = [ "engine/jsXNode.js" ]
1165  output_name = "node"
1166  install_images = [ "system" ]
1167  module_install_dir = "etc/abc/arkui"
1168  subsystem_name = ace_engine_subsystem
1169  part_name = ace_engine_part
1170}
1171
1172ohos_abc("prefetcher") {
1173  sources = [ "engine/jsPrefetcher.js" ]
1174  output_name = "prefetcher"
1175  install_images = [ "system" ]
1176  module_install_dir = "etc/abc/arkui"
1177  subsystem_name = ace_engine_subsystem
1178  part_name = ace_engine_part
1179}
1180
1181action("gen_uicontext_ohos") {
1182  script = "$ace_root/build/tools/gen_uicontext_ohos.py"
1183  inputs = [
1184    "$ace_root/frameworks/bridge/declarative_frontend/engine/jsUIContext.js",
1185  ]
1186  outputs = [ "$base_output_path/jsUIContext_ohos.js" ]
1187  args = [
1188    rebase_path(inputs[0]),
1189    rebase_path(outputs[0]),
1190  ]
1191}
1192
1193ohos_abc("uicontext") {
1194  sources = [ "$base_output_path/jsUIContext_ohos.js" ]
1195  output_name = "uicontext"
1196  deps = [ ":gen_uicontext_ohos" ]
1197  install_images = [ "system" ]
1198  module_install_dir = "etc/abc/arkui"
1199  subsystem_name = ace_engine_subsystem
1200  part_name = ace_engine_part
1201}
1202
1203ohos_abc("ark_theme_control") {
1204  sources = [ "engine/arkThemeControl.js" ]
1205  output_name = "theme"
1206  install_images = [ "system" ]
1207  module_install_dir = "etc/abc/arkui"
1208  subsystem_name = ace_engine_subsystem
1209  part_name = ace_engine_part
1210}
1211
1212ohos_abc("ark_modifier") {
1213  sources = [ "engine/arkModifier.js" ]
1214  output_name = "modifier"
1215  install_images = [ "system" ]
1216  module_install_dir = "etc/abc/arkui"
1217  subsystem_name = ace_engine_subsystem
1218  part_name = ace_engine_part
1219}
1220
1221ohos_abc("shape") {
1222  sources = [ "engine/jsShape.js" ]
1223  output_name = "shape"
1224  install_images = [ "system" ]
1225  module_install_dir = "etc/abc/arkui"
1226  subsystem_name = ace_engine_subsystem
1227  part_name = ace_engine_part
1228}
1229