123b3eb3cSopenharmony_ci# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
223b3eb3cSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
323b3eb3cSopenharmony_ci# you may not use this file except in compliance with the License.
423b3eb3cSopenharmony_ci# You may obtain a copy of the License at
523b3eb3cSopenharmony_ci#
623b3eb3cSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
723b3eb3cSopenharmony_ci#
823b3eb3cSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
923b3eb3cSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1023b3eb3cSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1123b3eb3cSopenharmony_ci# See the License for the specific language governing permissions and
1223b3eb3cSopenharmony_ci# limitations under the License.
1323b3eb3cSopenharmony_ci
1423b3eb3cSopenharmony_ciimport("//build/ohos.gni")
1523b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/ace_config.gni")
1623b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/build/ace_ext.gni")
1723b3eb3cSopenharmony_ci
1823b3eb3cSopenharmony_ci# build static
1923b3eb3cSopenharmony_citemplate("ace_osal_ohos_source_set") {
2023b3eb3cSopenharmony_ci  forward_variables_from(invoker, "*")
2123b3eb3cSopenharmony_ci
2223b3eb3cSopenharmony_ci  ohos_source_set(target_name) {
2323b3eb3cSopenharmony_ci    subsystem_name = ace_engine_subsystem
2423b3eb3cSopenharmony_ci    part_name = ace_engine_part
2523b3eb3cSopenharmony_ci    defines += invoker.defines
2623b3eb3cSopenharmony_ci    if (defined(vendor_configs.use_ext_surface) &&
2723b3eb3cSopenharmony_ci        vendor_configs.use_ext_surface) {
2823b3eb3cSopenharmony_ci      defines += [ "EXT_SURFACE_ENABLE" ]
2923b3eb3cSopenharmony_ci    }
3023b3eb3cSopenharmony_ci    if (is_ohos_standard_system) {
3123b3eb3cSopenharmony_ci      external_deps = [
3223b3eb3cSopenharmony_ci        "hilog:libhilog",
3323b3eb3cSopenharmony_ci        "hitrace:hitrace_meter",
3423b3eb3cSopenharmony_ci        "imf:inputmethod_client",
3523b3eb3cSopenharmony_ci        "init:libbeget_proxy",
3623b3eb3cSopenharmony_ci        "init:libbegetutil",
3723b3eb3cSopenharmony_ci      ]
3823b3eb3cSopenharmony_ci      configs = [ "$ace_root:ace_config" ]
3923b3eb3cSopenharmony_ci    } else {
4023b3eb3cSopenharmony_ci      external_deps = [
4123b3eb3cSopenharmony_ci        "hilog:libhilog",
4223b3eb3cSopenharmony_ci        "hitrace:hitrace_meter",
4323b3eb3cSopenharmony_ci        "init:libbegetutil",
4423b3eb3cSopenharmony_ci      ]
4523b3eb3cSopenharmony_ci
4623b3eb3cSopenharmony_ci      configs = [ "$ace_root:ace_config" ]
4723b3eb3cSopenharmony_ci    }
4823b3eb3cSopenharmony_ci
4923b3eb3cSopenharmony_ci    sources = [
5023b3eb3cSopenharmony_ci      "ace_checker.cpp",
5123b3eb3cSopenharmony_ci      "ace_engine_ext.cpp",
5223b3eb3cSopenharmony_ci      "ace_trace.cpp",
5323b3eb3cSopenharmony_ci      "ai_write_adapter.cpp",
5423b3eb3cSopenharmony_ci      "anr_thread.cpp",
5523b3eb3cSopenharmony_ci      "app_bar_helper_impl.cpp",
5623b3eb3cSopenharmony_ci      "data_detector_adapter.cpp",
5723b3eb3cSopenharmony_ci      "data_detector_loader.cpp",
5823b3eb3cSopenharmony_ci      "data_detector_mgr.cpp",
5923b3eb3cSopenharmony_ci      "display_info_utils.cpp",
6023b3eb3cSopenharmony_ci      "download_manager_ohos.cpp",
6123b3eb3cSopenharmony_ci      "event_report.cpp",
6223b3eb3cSopenharmony_ci      "exception_handler.cpp",
6323b3eb3cSopenharmony_ci      "frame_report.cpp",
6423b3eb3cSopenharmony_ci      "image_analyzer_adapter_impl.cpp",
6523b3eb3cSopenharmony_ci      "image_analyzer_loader.cpp",
6623b3eb3cSopenharmony_ci      "image_analyzer_manager.cpp",
6723b3eb3cSopenharmony_ci      "image_analyzer_mgr.cpp",
6823b3eb3cSopenharmony_ci      "input_method_manager_ohos.cpp",
6923b3eb3cSopenharmony_ci      "layout_inspector.cpp",
7023b3eb3cSopenharmony_ci      "log_wrapper.cpp",
7123b3eb3cSopenharmony_ci      "modal_ui_extension_impl.cpp",
7223b3eb3cSopenharmony_ci      "ressched_report.cpp",
7323b3eb3cSopenharmony_ci      "socperf_client_impl.cpp",
7423b3eb3cSopenharmony_ci      "stylus_detector_default.cpp",
7523b3eb3cSopenharmony_ci      "stylus_detector_loader.cpp",
7623b3eb3cSopenharmony_ci      "stylus_detector_mgr.cpp",
7723b3eb3cSopenharmony_ci      "system_properties.cpp",
7823b3eb3cSopenharmony_ci      "thp_extra_manager_impl.cpp",
7923b3eb3cSopenharmony_ci      "trace_id_impl.cpp",
8023b3eb3cSopenharmony_ci      "view_data_wrap_ohos.cpp",
8123b3eb3cSopenharmony_ci      "want_wrap_ohos.cpp",
8223b3eb3cSopenharmony_ci      "window_utils.cpp",
8323b3eb3cSopenharmony_ci    ]
8423b3eb3cSopenharmony_ci
8523b3eb3cSopenharmony_ci    external_deps += [
8623b3eb3cSopenharmony_ci      "ability_runtime:app_manager",
8723b3eb3cSopenharmony_ci      "i18n:intl_util",
8823b3eb3cSopenharmony_ci      "init:libbegetutil",
8923b3eb3cSopenharmony_ci    ]
9023b3eb3cSopenharmony_ci
9123b3eb3cSopenharmony_ci    if (is_ohos_standard_system) {
9223b3eb3cSopenharmony_ci      sources += [
9323b3eb3cSopenharmony_ci        "resource_adapter_impl.cpp",
9423b3eb3cSopenharmony_ci        "resource_adapter_impl_v2.cpp",
9523b3eb3cSopenharmony_ci        "resource_convertor.cpp",
9623b3eb3cSopenharmony_ci        "resource_theme_style.cpp",
9723b3eb3cSopenharmony_ci      ]
9823b3eb3cSopenharmony_ci      deps = []
9923b3eb3cSopenharmony_ci
10023b3eb3cSopenharmony_ci      if (defined(global_parts_info) &&
10123b3eb3cSopenharmony_ci          defined(global_parts_info.resourceschedule_soc_perf)) {
10223b3eb3cSopenharmony_ci        external_deps += [ "soc_perf:socperf_client" ]
10323b3eb3cSopenharmony_ci        defines += [ "SOC_PERF_ENABLE" ]
10423b3eb3cSopenharmony_ci      }
10523b3eb3cSopenharmony_ci
10623b3eb3cSopenharmony_ci      if (defined(global_parts_info) && defined(
10723b3eb3cSopenharmony_ci              global_parts_info.resourceschedule_resource_schedule_service)) {
10823b3eb3cSopenharmony_ci        external_deps += [ "resource_schedule_service:ressched_client" ]
10923b3eb3cSopenharmony_ci        defines += [ "RESOURCE_SCHEDULE_SERVICE_ENABLE" ]
11023b3eb3cSopenharmony_ci      }
11123b3eb3cSopenharmony_ci
11223b3eb3cSopenharmony_ci      if (defined(resourceschedule_ffrt_support) &&
11323b3eb3cSopenharmony_ci          resourceschedule_ffrt_support) {
11423b3eb3cSopenharmony_ci        sources += [ "long_frame_report_impl.cpp" ]
11523b3eb3cSopenharmony_ci        external_deps += [ "ffrt:libffrt" ]
11623b3eb3cSopenharmony_ci      }
11723b3eb3cSopenharmony_ci
11823b3eb3cSopenharmony_ci      external_deps += [
11923b3eb3cSopenharmony_ci        "ability_base:view_data",
12023b3eb3cSopenharmony_ci        "ability_base:want",
12123b3eb3cSopenharmony_ci        "ability_runtime:abilitykit_native",
12223b3eb3cSopenharmony_ci        "graphic_2d:libframe_analyzer",
12323b3eb3cSopenharmony_ci        "image_framework:image",
12423b3eb3cSopenharmony_ci        "input:libmmi-client",
12523b3eb3cSopenharmony_ci        "napi:ace_napi",
12623b3eb3cSopenharmony_ci        "resource_management:global_resmgr",
12723b3eb3cSopenharmony_ci      ]
12823b3eb3cSopenharmony_ci      if (defined(config.accessibility_support) &&
12923b3eb3cSopenharmony_ci          config.accessibility_support) {
13023b3eb3cSopenharmony_ci        sources += [
13123b3eb3cSopenharmony_ci          "js_accessibility_manager.cpp",
13223b3eb3cSopenharmony_ci          "js_third_accessibility_hover_ng.cpp",
13323b3eb3cSopenharmony_ci          "js_third_provider_interaction_operation.cpp",
13423b3eb3cSopenharmony_ci        ]
13523b3eb3cSopenharmony_ci        deps += [ "$ace_root/frameworks/bridge/common/accessibility:bridge_accessibility_$platform" ]
13623b3eb3cSopenharmony_ci        external_deps += [
13723b3eb3cSopenharmony_ci          "accessibility:accessibility_common",
13823b3eb3cSopenharmony_ci          "accessibility:accessibilityclient",
13923b3eb3cSopenharmony_ci          "accessibility:accessibilityconfig",
14023b3eb3cSopenharmony_ci        ]
14123b3eb3cSopenharmony_ci      } else {
14223b3eb3cSopenharmony_ci        sources += [ "fake_accessibility_manager.cpp" ]
14323b3eb3cSopenharmony_ci      }
14423b3eb3cSopenharmony_ci      if (frame_trace_support) {
14523b3eb3cSopenharmony_ci        sources += [ "frame_trace_adapter_impl.cpp" ]
14623b3eb3cSopenharmony_ci        external_deps += [ "frame_aware_sched:frame_trace_intf" ]
14723b3eb3cSopenharmony_ci        defines += [ "FRAME_TRACE_ENABLE" ]
14823b3eb3cSopenharmony_ci      } else {
14923b3eb3cSopenharmony_ci        sources += [ "frame_trace_adapter_fake_impl.cpp" ]
15023b3eb3cSopenharmony_ci      }
15123b3eb3cSopenharmony_ci    } else {
15223b3eb3cSopenharmony_ci      external_deps += [ "multimedia_image:image" ]
15323b3eb3cSopenharmony_ci    }
15423b3eb3cSopenharmony_ci    sources += [
15523b3eb3cSopenharmony_ci      "background_task_helper_ohos.cpp",
15623b3eb3cSopenharmony_ci      "drawing_color_filter_ohos.cpp",
15723b3eb3cSopenharmony_ci      "drawing_lattice_ohos.cpp",
15823b3eb3cSopenharmony_ci      "file_uri_helper_ohos.cpp",
15923b3eb3cSopenharmony_ci      "image_packer_ohos.cpp",
16023b3eb3cSopenharmony_ci      "image_source_ohos.cpp",
16123b3eb3cSopenharmony_ci      "input_manager.cpp",
16223b3eb3cSopenharmony_ci      "mouse_style_ohos.cpp",
16323b3eb3cSopenharmony_ci      "navigation_route_ohos.cpp",
16423b3eb3cSopenharmony_ci      "page_url_checker_ohos.cpp",
16523b3eb3cSopenharmony_ci      "pixel_map_ohos.cpp",
16623b3eb3cSopenharmony_ci      "system_bar_style_ohos.cpp",
16723b3eb3cSopenharmony_ci    ]
16823b3eb3cSopenharmony_ci    external_deps += [
16923b3eb3cSopenharmony_ci      "ability_runtime:abilitykit_native",
17023b3eb3cSopenharmony_ci      "ability_runtime:app_manager",
17123b3eb3cSopenharmony_ci      "ability_runtime:wantagent_innerkits",
17223b3eb3cSopenharmony_ci      "app_file_service:fileuri_native",
17323b3eb3cSopenharmony_ci      "background_task_mgr:bgtaskmgr_innerkits",
17423b3eb3cSopenharmony_ci      "bundle_framework:appexecfwk_core",
17523b3eb3cSopenharmony_ci      "graphic_2d:2d_graphics",
17623b3eb3cSopenharmony_ci      "graphic_2d:drawing_napi_impl",
17723b3eb3cSopenharmony_ci      "graphic_2d:librender_service_client",
17823b3eb3cSopenharmony_ci      "hicollie:libhicollie",
17923b3eb3cSopenharmony_ci      "hisysevent:libhisysevent",
18023b3eb3cSopenharmony_ci      "hitrace:libhitracechain",
18123b3eb3cSopenharmony_ci      "safwk:system_ability_fwk",
18223b3eb3cSopenharmony_ci      "samgr:samgr_proxy",
18323b3eb3cSopenharmony_ci      "window_manager:libdm",
18423b3eb3cSopenharmony_ci      "window_manager:libwm",
18523b3eb3cSopenharmony_ci      "window_manager:scene_session",
18623b3eb3cSopenharmony_ci      "window_manager:window_native_kit",
18723b3eb3cSopenharmony_ci    ]
18823b3eb3cSopenharmony_ci
18923b3eb3cSopenharmony_ci    if (defined(config.hichecker_exists) && config.hichecker_exists) {
19023b3eb3cSopenharmony_ci      external_deps += [ "hichecker:libhichecker" ]
19123b3eb3cSopenharmony_ci    }
19223b3eb3cSopenharmony_ci    deps += [
19323b3eb3cSopenharmony_ci      "$ace_root/interfaces/inner_api/drawable_descriptor:drawable_descriptor",
19423b3eb3cSopenharmony_ci    ]
19523b3eb3cSopenharmony_ci
19623b3eb3cSopenharmony_ci    if (ability_runtime_graphics) {
19723b3eb3cSopenharmony_ci      external_deps += [ "image_framework:image_native" ]
19823b3eb3cSopenharmony_ci    }
19923b3eb3cSopenharmony_ci  }
20023b3eb3cSopenharmony_ci}
20123b3eb3cSopenharmony_ci
20223b3eb3cSopenharmony_ciforeach(item, ace_platforms) {
20323b3eb3cSopenharmony_ci  platform = item.name
20423b3eb3cSopenharmony_ci  if (platform == "ohos" || platform == "ohos_ng") {
20523b3eb3cSopenharmony_ci    ace_osal_ohos_source_set("ace_osal_ohos_${platform}") {
20623b3eb3cSopenharmony_ci      platform = item.name
20723b3eb3cSopenharmony_ci      assert(defined(platform) && platform != "", "platform must be defined")
20823b3eb3cSopenharmony_ci      defines = []
20923b3eb3cSopenharmony_ci      config = {
21023b3eb3cSopenharmony_ci      }
21123b3eb3cSopenharmony_ci
21223b3eb3cSopenharmony_ci      if (defined(item.config)) {
21323b3eb3cSopenharmony_ci        config = item.config
21423b3eb3cSopenharmony_ci      }
21523b3eb3cSopenharmony_ci      if (defined(config.defines)) {
21623b3eb3cSopenharmony_ci        defines = config.defines
21723b3eb3cSopenharmony_ci      }
21823b3eb3cSopenharmony_ci    }
21923b3eb3cSopenharmony_ci  }
22023b3eb3cSopenharmony_ci}
221