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