1# Copyright (c) 2021 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/filemanagement/dfs_service/distributedfile.gni") 16 17config("compiler_configs") { 18 visibility = [ ":*" ] 19 visibility += [ 20 "${distributedfile_path}/services/*", 21 "${distributedfile_path}/test/moduletest/*", 22 ] 23 24 cflags = [ 25 "-Wall", 26 "-Werror", 27 "-Wdate-time", 28 "-Wfloat-equal", 29 "-Wshadow", 30 "-Wformat=2", 31 "-ffunction-sections", 32 "-Os", 33 ] 34 configs = [ "//build/config/compiler:exceptions" ] 35 36 cflags_cc = [ 37 "-fvisibility-inlines-hidden", 38 "-Os", 39 ] 40 41 defines = [ 42 "LOG_DOMAIN=0xD001600", 43 "LOG_LEVEL=INFO", 44 ] 45} 46 47config("utils_public_config") { 48 include_dirs = [ 49 "inner_api", 50 "load/include", 51 "log/include", 52 "work/include", 53 "system/include", 54 ] 55} 56 57config("optimize-size") { 58 cflags = [ 59 "-fdata-sections", 60 "-ffunction-sections", 61 "-Oz", 62 ] 63 cflags_cc = [ 64 "-fvisibility-inlines-hidden", 65 "-Oz", 66 ] 67} 68 69ohos_shared_library("libdistributedfileutils") { 70 branch_protector_ret = "pac_ret" 71 configs = [ ":optimize-size" ] 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 sources = [ 81 "cloud_disk/src/cloud_file_utils.cpp", 82 "dfx/src/xcollie_helper.cpp", 83 "ffrt/src/ffrt_timer.cpp", 84 "load/src/plugin_loader.cpp", 85 "log/src/dfs_error.cpp", 86 "log/src/utils_log.cpp", 87 "preference/src/cloud_pref_impl.cpp", 88 "system/src/dfsu_access_token_helper.cpp", 89 "system/src/dfsu_fd_guard.cpp", 90 "system/src/dfsu_memory_guard.cpp", 91 "system/src/dfsu_mount_argument_descriptors.cpp", 92 "system/src/dfsu_timer.cpp", 93 "system/src/sys_utils.cpp", 94 "system/src/utils_directory.cpp", 95 "work/src/async_work.cpp", 96 ] 97 98 configs += [ "//build/config/compiler:exceptions" ] 99 public_configs = [ ":utils_public_config" ] 100 101 cflags = [ 102 "-D_FORTIFY_SOURCE=2", 103 "-fstack-protector-strong", 104 ] 105 106 defines = [ 107 "LOG_DOMAIN=0xD004308", 108 "LOG_TAG=\"distributedfile_utils\"", 109 ] 110 111 if (use_musl) { 112 if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) { 113 defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ] 114 } 115 } 116 117 external_deps = [ 118 "ability_base:want", 119 "ability_base:zuri", 120 "ability_runtime:uri_permission_mgr", 121 "access_token:libaccesstoken_sdk", 122 "access_token:libtokenid_sdk", 123 "c_utils:utils", 124 "device_manager:devicemanagersdk", 125 "ffrt:libffrt", 126 "file_api:filemgmt_libhilog", 127 "file_api:filemgmt_libn", 128 "hilog:libhilog", 129 "hisysevent:libhisysevent", 130 "ipc:ipc_core", 131 "napi:ace_napi", 132 "preferences:native_preferences", 133 ] 134 135 if (cloudsync_service_hicollie_enable) { 136 external_deps += [ "hicollie:libhicollie" ] 137 defines += [ "HICOLLIE_ENABLE" ] 138 } 139 140 part_name = "dfs_service" 141 innerapi_tags = [ "platformsdk" ] 142 subsystem_name = "filemanagement" 143} 144 145config("dentry_public_config") { 146 include_dirs = [ 147 "dentry/include", 148 "inner_api", 149 "system/include", 150 ] 151} 152 153ohos_shared_library("libdistributedfiledentry") { 154 branch_protector_ret = "pac_ret" 155 configs = [ ":optimize-size" ] 156 sanitize = { 157 integer_overflow = true 158 ubsan = true 159 boundary_sanitize = true 160 cfi = true 161 cfi_cross_dso = true 162 debug = false 163 } 164 165 sources = [ 166 "dentry/src/file_utils.cpp", 167 "dentry/src/meta_file.cpp", 168 "dentry/src/meta_file_clouddisk.cpp", 169 "system/src/utils_directory.cpp", 170 ] 171 172 public_configs = [ ":dentry_public_config" ] 173 174 cflags = [ 175 "-D_FORTIFY_SOURCE=2", 176 "-fstack-protector-strong", 177 ] 178 179 deps = [ "${utils_path}:libdistributedfileutils" ] 180 181 external_deps = [ 182 "c_utils:utils", 183 "device_manager:devicemanagersdk", 184 "hilog:libhilog", 185 "hisysevent:libhisysevent", 186 ] 187 188 defines = [ 189 "LOG_DOMAIN=0xD004307", 190 "LOG_TAG=\"CLOUDSYNC_SA\"", 191 ] 192 193 if (cloudsync_service_hicollie_enable) { 194 external_deps += [ "hicollie:libhicollie" ] 195 defines += [ "HICOLLIE_ENABLE" ] 196 } 197 198 part_name = "dfs_service" 199 subsystem_name = "filemanagement" 200} 201 202config("utils_lite_public_config") { 203 include_dirs = [ 204 "dentry/include", 205 "inner_api", 206 "load/include", 207 "log/include", 208 "system/include", 209 ] 210} 211 212ohos_shared_library("libdistributedfileutils_lite") { 213 branch_protector_ret = "pac_ret" 214 configs = [ ":optimize-size" ] 215 sanitize = { 216 integer_overflow = true 217 ubsan = true 218 boundary_sanitize = true 219 cfi = true 220 cfi_cross_dso = true 221 debug = false 222 } 223 224 sources = [ 225 "cloud_disk/src/cloud_file_utils.cpp", 226 "dentry/src/file_utils.cpp", 227 "dentry/src/meta_file.cpp", 228 "dentry/src/meta_file_clouddisk.cpp", 229 "dfx/src/xcollie_helper.cpp", 230 "ffrt/src/ffrt_timer.cpp", 231 "load/src/plugin_loader.cpp", 232 "log/src/dfs_error.cpp", 233 "log/src/utils_log.cpp", 234 "system/src/dfsu_memory_guard.cpp", 235 "system/src/utils_directory.cpp", 236 ] 237 238 configs += [ "//build/config/compiler:exceptions" ] 239 public_configs = [ ":utils_lite_public_config" ] 240 241 cflags = [ 242 "-D_FORTIFY_SOURCE=2", 243 "-fstack-protector-strong", 244 ] 245 246 defines = [ 247 "LOG_DOMAIN=0xD004308", 248 "LOG_TAG=\"CloudFileDaemon\"", 249 ] 250 251 deps = [] 252 253 external_deps = [ 254 "c_utils:utils", 255 "device_manager:devicemanagersdk", 256 "ffrt:libffrt", 257 "hilog:libhilog", 258 "hisysevent:libhisysevent", 259 ] 260 261 if (use_musl) { 262 if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) { 263 defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ] 264 } 265 } 266 267 if (cloudsync_service_hicollie_enable) { 268 external_deps += [ "hicollie:libhicollie" ] 269 defines += [ "HICOLLIE_ENABLE" ] 270 } 271 272 part_name = "dfs_service" 273 innerapi_tags = [ "platformsdk" ] 274 subsystem_name = "filemanagement" 275} 276