1# Copyright (C) 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/config/components/idl_tool/idl.gni") 15import("//build/ohos.gni") 16import("//foundation/filemanagement/dfs_service/distributedfile.gni") 17config("optimize-size") { 18 cflags = [ 19 "-fdata-sections", 20 "-ffunction-sections", 21 "-Oz", 22 ] 23 cflags_cc = [ 24 "-fvisibility-inlines-hidden", 25 "-Oz", 26 ] 27} 28 29config("cloud_sync_service_public_config") { 30 include_dirs = [ "${target_gen_dir}" ] 31} 32 33idl_gen_interface("cloud_sync_service_interface") { 34 sources = [ "ICloudSyncService.idl" ] 35} 36 37ohos_source_set("cloud_sync_service_proxy") { 38 configs = [ ":optimize-size" ] 39 public_configs = [ ":cloud_sync_service_public_config" ] 40 sanitize = { 41 integer_overflow = true 42 ubsan = true 43 boundary_sanitize = true 44 cfi = true 45 cfi_cross_dso = true 46 debug = false 47 } 48 49 include_dirs = [ 50 "${distributedfile_path}/utils/log/include", 51 "${innerkits_native_path}/cloudsync_kit_inner", 52 ] 53 54 output_values = get_target_outputs(":cloud_sync_service_interface") 55 sources = filter_include(output_values, [ "*_proxy.cpp" ]) 56 sources += [ "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp" ] 57 58 deps = [ ":cloud_sync_service_interface" ] 59 external_deps = [ 60 "c_utils:utils", 61 "hilog:libhilog", 62 "ipc:ipc_single", 63 "samgr:samgr_proxy", 64 ] 65 part_name = "dfs_service" 66 subsystem_name = "filemanagement" 67} 68 69ohos_source_set("cloud_sync_service_stub") { 70 configs = [ ":optimize-size" ] 71 public_configs = [ ":cloud_sync_service_public_config" ] 72 sanitize = { 73 integer_overflow = true 74 ubsan = true 75 boundary_sanitize = true 76 cfi = true 77 cfi_cross_dso = true 78 debug = false 79 } 80 81 include_dirs = [ 82 "${distributedfile_path}/utils/log/include", 83 "${innerkits_native_path}/cloudsync_kit_inner", 84 ] 85 86 output_values = get_target_outputs(":cloud_sync_service_interface") 87 sources = filter_include(output_values, [ "*_stub.cpp" ]) 88 sources += [ "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp" ] 89 90 deps = [ ":cloud_sync_service_interface" ] 91 external_deps = [ 92 "c_utils:utils", 93 "hilog:libhilog", 94 "ipc:ipc_single", 95 "samgr:samgr_proxy", 96 ] 97 part_name = "dfs_service" 98 subsystem_name = "filemanagement" 99} 100 101ohos_shared_library("cloudsync_sa") { 102 branch_protector_ret = "pac_ret" 103 configs = [ ":optimize-size" ] 104 public_configs = [ ":cloud_sync_service_public_config" ] 105 sanitize = { 106 integer_overflow = true 107 ubsan = true 108 boundary_sanitize = true 109 cfi = true 110 cfi_cross_dso = true 111 debug = false 112 } 113 include_dirs = [ 114 "include", 115 "include/cycle_task", 116 "include/cycle_task/tasks", 117 "include/transport", 118 "include/transport/softbus", 119 "${services_path}/cloudfiledaemon/include/cloud_disk", 120 "${innerkits_native_path}/cloudsync_kit_inner", 121 ] 122 123 cycle_task = [ 124 "src/cycle_task/cycle_task.cpp", 125 "src/cycle_task/cycle_task_runner.cpp", 126 "src/cycle_task/tasks/optimize_cache_task.cpp", 127 "src/cycle_task/tasks/optimize_storage_task.cpp", 128 "src/cycle_task/tasks/periodic_check_task.cpp", 129 "src/cycle_task/tasks/report_statistics_task.cpp", 130 "src/cycle_task/tasks/save_subscription_task.cpp", 131 "src/cycle_task/tasks/database_backup_task.cpp", 132 ] 133 134 transport = [ 135 "src/transport/file_transfer_manager.cpp", 136 "src/transport/message_handler.cpp", 137 "src/transport/softbus/session_manager.cpp", 138 "src/transport/softbus/softbus_adapter.cpp", 139 "src/transport/softbus/softbus_session.cpp", 140 ] 141 142 sources = [ 143 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp", 144 "src/ipc/cloud_sync_service.cpp", 145 "src/ipc/download_asset_callback_manager.cpp", 146 "src/ipc/download_asset_callback_proxy.cpp", 147 "src/sync_rule/battery_status_listener.cpp", 148 "src/sync_rule/package_status_listener.cpp", 149 "src/sync_rule/screen_status_listener.cpp", 150 "src/sync_rule/user_status_listener.cpp", 151 ] 152 153 sources += cycle_task 154 sources += transport 155 156 output_values = get_target_outputs(":cloud_sync_service_interface") 157 sources += filter_include(output_values, [ "*_stub.cpp" ]) 158 159 defines = [ 160 "LOG_DOMAIN=0xD004307", 161 "LOG_TAG=\"CLOUDSYNC_SA\"", 162 ] 163 164 deps = [ 165 ":cloud_sync_service_interface", 166 "${clouddisk_database_path}:clouddisk_database", 167 "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit", 168 "${utils_path}:libdistributedfiledentry", 169 "${utils_path}:libdistributedfileutils", 170 ] 171 172 external_deps = [ 173 "ability_base:want", 174 "ability_base:zuri", 175 "ability_runtime:ability_manager", 176 "app_file_service:sandbox_helper_native", 177 "c_utils:utils", 178 "common_event_service:cesfwk_innerkits", 179 "dsoftbus:softbus_client", 180 "ffrt:libffrt", 181 "hilog:libhilog", 182 "hitrace:hitrace_meter", 183 "init:libbegetutil", 184 "ipc:ipc_single", 185 "libfuse:libfuse", 186 "memmgr:memmgrclient", 187 "netmanager_base:net_conn_manager_if", 188 "os_account:os_account_innerkits", 189 "preferences:native_preferences", 190 "safwk:system_ability_fwk", 191 "samgr:samgr_proxy", 192 ] 193 194 if (cloudsync_service_hicollie_enable) { 195 external_deps += [ "hicollie:libhicollie" ] 196 defines += [ "HICOLLIE_ENABLE" ] 197 } 198 199 if (cloudsync_service_resource_schedule) { 200 external_deps += [ "resource_schedule_service:ressched_client" ] 201 } 202 203 use_exceptions = true 204 part_name = "dfs_service" 205 subsystem_name = "filemanagement" 206} 207 208ohos_static_library("cloudsync_sa_static") { 209 branch_protector_ret = "pac_ret" 210 public_configs = [ ":cloud_sync_service_public_config" ] 211 sanitize = { 212 integer_overflow = true 213 ubsan = true 214 boundary_sanitize = true 215 cfi = true 216 cfi_cross_dso = true 217 debug = false 218 } 219 include_dirs = [ 220 "include", 221 "include/cycle_task", 222 "include/cycle_task/tasks", 223 "include/transport", 224 "include/transport/softbus", 225 "${clouddisk_database_path}/include", 226 "${services_path}/cloudfiledaemon/include/cloud_disk", 227 "${innerkits_native_path}/cloudsync_kit_inner", 228 "${distributedfile_path}/test/unittests/cloudsync_sa/mock/", 229 ] 230 231 cycle_task = [ 232 "src/cycle_task/cycle_task.cpp", 233 "src/cycle_task/cycle_task_runner.cpp", 234 "src/cycle_task/tasks/optimize_cache_task.cpp", 235 "src/cycle_task/tasks/optimize_storage_task.cpp", 236 "src/cycle_task/tasks/periodic_check_task.cpp", 237 "src/cycle_task/tasks/report_statistics_task.cpp", 238 "src/cycle_task/tasks/save_subscription_task.cpp", 239 "src/cycle_task/tasks/database_backup_task.cpp", 240 ] 241 242 transport = [ 243 "src/transport/file_transfer_manager.cpp", 244 "src/transport/message_handler.cpp", 245 "src/transport/softbus/session_manager.cpp", 246 "src/transport/softbus/softbus_adapter.cpp", 247 "src/transport/softbus/softbus_session.cpp", 248 ] 249 250 sources = [ 251 "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp", 252 "src/ipc/cloud_sync_service.cpp", 253 "src/ipc/download_asset_callback_manager.cpp", 254 "src/ipc/download_asset_callback_proxy.cpp", 255 "src/sync_rule/battery_status_listener.cpp", 256 "src/sync_rule/package_status_listener.cpp", 257 "src/sync_rule/screen_status_listener.cpp", 258 "src/sync_rule/user_status_listener.cpp", 259 ] 260 261 sources += cycle_task 262 sources += transport 263 264 output_values = get_target_outputs(":cloud_sync_service_interface") 265 sources += filter_include(output_values, [ "*_stub.cpp" ]) 266 267 defines = [ 268 "LOG_DOMAIN=0xD004307", 269 "LOG_TAG=\"CLOUDSYNC_SA\"", 270 ] 271 272 deps = [ 273 ":cloud_sync_service_interface", 274 "${clouddisk_database_path}:clouddisk_database", 275 "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit", 276 "${utils_path}:libdistributedfiledentry", 277 "${utils_path}:libdistributedfileutils", 278 ] 279 280 external_deps = [ 281 "ability_base:want", 282 "ability_base:zuri", 283 "ability_runtime:ability_manager", 284 "ability_runtime:dataobs_manager", 285 "app_file_service:sandbox_helper_native", 286 "c_utils:utils", 287 "common_event_service:cesfwk_innerkits", 288 "dsoftbus:softbus_client", 289 "e2fsprogs:libext2_uuid", 290 "eventhandler:libeventhandler", 291 "ffrt:libffrt", 292 "hilog:libhilog", 293 "hitrace:hitrace_meter", 294 "init:libbegetutil", 295 "ipc:ipc_single", 296 "libfuse:libfuse", 297 "memmgr:memmgrclient", 298 "netmanager_base:net_conn_manager_if", 299 "os_account:os_account_innerkits", 300 "power_manager:powermgr_client", 301 "preferences:native_preferences", 302 "relational_store:native_rdb", 303 "safwk:system_ability_fwk", 304 "samgr:samgr_proxy", 305 ] 306 307 if (cloudsync_service_hicollie_enable) { 308 external_deps += [ "hicollie:libhicollie" ] 309 defines += [ "HICOLLIE_ENABLE" ] 310 } 311 312 deps += 313 [ "${distributedfile_path}/adapter/cloud_adapter_example:cloud_adapter" ] 314 315 if (cloudsync_service_resource_schedule) { 316 external_deps += [ "resource_schedule_service:ressched_client" ] 317 defines += [ "CLOUDSYNC_SERVICE_RESOURCE_SCHEDULE" ] 318 } 319 320 if (cloudsync_service_power) { 321 external_deps += [ "battery_manager:batterysrv_client" ] 322 defines += [ "SUPPORT_POWER" ] 323 } 324 325 if (is_emulator) { 326 defines += [ "EMULATOR" ] 327 } 328 329 use_exceptions = true 330 part_name = "dfs_service" 331 subsystem_name = "filemanagement" 332} 333