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("//build/ohos.gni")
15import("//foundation/arkui/ace_engine/ace_config.gni")
16
17# build static
18template("ace_capability_ohos_source_set") {
19  forward_variables_from(invoker, "*")
20
21  ohos_source_set(target_name) {
22    subsystem_name = ace_engine_subsystem
23    part_name = ace_engine_part
24    defines += invoker.defines
25
26    configs = [ "$ace_root:ace_config" ]
27
28    sources = [
29      "clipboard/clipboard_impl.cpp",
30      "environment/environment_impl.cpp",
31      "environment/environment_proxy_impl.cpp",
32      "html/html_to_span.cpp",
33      "html/span_to_html.cpp",
34      "package/package_event_proxy_ohos.cpp",
35      "preference/storage_impl.cpp",
36      "time/time_event_proxy_ohos.cpp",
37    ]
38    include_dirs = []
39    external_deps = [
40      "ability_base:want",
41      "common_event_service:cesfwk_innerkits",
42      "hicollie:libhicollie",
43      "hilog:libhilog",
44      "ipc:ipc_core",
45      "libxml2:libxml2",
46      "preferences:native_preferences",
47    ]
48    if (defined(config.enable_system_clipboard) &&
49        config.enable_system_clipboard) {
50      external_deps += [ "pasteboard:pasteboard_client" ]
51      defines += [ "SYSTEM_CLIPBOARD_SUPPORTED" ]
52    }
53
54    sources += [ "xcollie/xcollieInterface_impl.cpp" ]
55    if (defined(config.enable_drag_framework) && config.enable_drag_framework) {
56      if (defined(global_parts_info.distributeddatamgr_udmf)) {
57        external_deps += [ "udmf:udmf_client" ]
58        external_deps += [ "udmf:udmf_data_napi" ]
59        external_deps += [ "device_status:devicestatus_client" ]
60        sources += [ "udmf/udmf_impl.cpp" ]
61        sources += [ "interaction/interaction_impl.cpp" ]
62      }
63      external_deps += [ "kv_store:distributeddata_inner" ]
64    } else {
65      sources += [ "//foundation/arkui/ace_engine/adapter/preview/entrance/msdp/interaction_impl.cpp" ]
66      sources += [ "//foundation/arkui/ace_engine/adapter/preview/entrance/udmf/udmf_impl.cpp" ]
67    }
68    if (defined(config.enable_ability_component) &&
69        config.enable_ability_component) {
70      if (os_account_exists) {
71        external_deps += [ "os_account:os_account_innerkits" ]
72      }
73      external_deps += [
74        "ability_base:want",
75        "ability_runtime:abilitykit_native",
76        "ability_runtime:runtime",
77        "bundle_framework:appexecfwk_base",
78        "c_utils:utils",
79        "eventhandler:libeventhandler",
80        "graphic_2d:librender_service_client",
81        "input:libmmi-client",
82        "ipc:ipc_core",
83        "napi:ace_napi",
84        "window_manager:libwindow_extension_client",
85        "window_manager:scene_session",
86      ]
87      sources += [
88        "window_connection/window_extension_connection_ohos.cpp",
89        "window_connection/window_extension_connection_proxy.cpp",
90        "window_connection_ng/window_extension_connection_ohos_ng.cpp",
91        "window_connection_ng/window_extension_connection_proxy_ng.cpp",
92      ]
93    }
94  }
95}
96
97foreach(item, ace_platforms) {
98  platform = item.name
99  if (platform == "ohos") {
100    ace_capability_ohos_source_set("ace_capability_ohos") {
101      defines = []
102      config = {
103      }
104
105      if (defined(item.config)) {
106        config = item.config
107      }
108      if (defined(config.defines)) {
109        defines = config.defines
110      }
111    }
112  }
113}
114