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=0xD004315", 43 "LOG_LEVEL=INFO", 44 ] 45} 46 47config("utils_public_config") { 48 include_dirs = [ 49 "inner_api", 50 "ioctl/include", 51 "load/include", 52 "log/include", 53 "work/include", 54 "system/include", 55 ] 56} 57 58config("optimize-size") { 59 cflags = [ 60 "-fdata-sections", 61 "-ffunction-sections", 62 "-Oz", 63 ] 64 cflags_cc = [ 65 "-fvisibility-inlines-hidden", 66 "-Oz", 67 ] 68} 69 70ohos_shared_library("libdistributedfileutils") { 71 branch_protector_ret = "pac_ret" 72 configs = [ ":optimize-size" ] 73 sanitize = { 74 integer_overflow = true 75 ubsan = true 76 boundary_sanitize = true 77 cfi = true 78 cfi_cross_dso = true 79 debug = false 80 } 81 sources = [ 82 "cloud_disk/src/cloud_file_utils.cpp", 83 "dfx/src/xcollie_helper.cpp", 84 "ffrt/src/ffrt_timer.cpp", 85 "load/src/plugin_loader.cpp", 86 "log/src/dfs_error.cpp", 87 "log/src/utils_log.cpp", 88 "preference/src/cloud_pref_impl.cpp", 89 "system/src/dfsu_access_token_helper.cpp", 90 "system/src/dfsu_fd_guard.cpp", 91 "system/src/dfsu_memory_guard.cpp", 92 "system/src/dfsu_mount_argument_descriptors.cpp", 93 "system/src/dfsu_timer.cpp", 94 "system/src/sys_utils.cpp", 95 "system/src/utils_directory.cpp", 96 "work/src/async_work.cpp", 97 ] 98 99 configs += [ "//build/config/compiler:exceptions" ] 100 public_configs = [ ":utils_public_config" ] 101 102 cflags = [ 103 "-D_FORTIFY_SOURCE=2", 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 "json:nlohmann_json_static", 132 "napi:ace_napi", 133 "os_account:os_account_innerkits", 134 "preferences:native_preferences", 135 ] 136 137 if (cloudsync_service_hicollie_enable) { 138 external_deps += [ "hicollie:libhicollie" ] 139 defines += [ "HICOLLIE_ENABLE" ] 140 } 141 142 part_name = "dfs_service" 143 innerapi_tags = [ "platformsdk" ] 144 subsystem_name = "filemanagement" 145} 146 147config("dentry_public_config") { 148 include_dirs = [ 149 "dentry/include", 150 "inner_api", 151 "system/include", 152 ] 153} 154 155ohos_shared_library("libdistributedfiledentry") { 156 branch_protector_ret = "pac_ret" 157 configs = [ ":optimize-size" ] 158 sanitize = { 159 integer_overflow = true 160 ubsan = true 161 boundary_sanitize = true 162 cfi = true 163 cfi_cross_dso = true 164 debug = false 165 } 166 167 sources = [ 168 "dentry/src/file_utils.cpp", 169 "dentry/src/meta_file.cpp", 170 "dentry/src/meta_file_clouddisk.cpp", 171 "system/src/utils_directory.cpp", 172 ] 173 174 public_configs = [ ":dentry_public_config" ] 175 176 cflags = [ 177 "-D_FORTIFY_SOURCE=2", 178 ] 179 180 deps = [ "${utils_path}:libdistributedfileutils" ] 181 182 external_deps = [ 183 "c_utils:utils", 184 "device_manager:devicemanagersdk", 185 "hilog:libhilog", 186 "hisysevent:libhisysevent", 187 "json:nlohmann_json_static", 188 ] 189 190 defines = [ 191 "LOG_DOMAIN=0xD004307", 192 "LOG_TAG=\"CLOUDSYNC_SA\"", 193 ] 194 195 if (cloudsync_service_hicollie_enable) { 196 external_deps += [ "hicollie:libhicollie" ] 197 defines += [ "HICOLLIE_ENABLE" ] 198 } 199 200 part_name = "dfs_service" 201 subsystem_name = "filemanagement" 202} 203 204config("utils_lite_public_config") { 205 include_dirs = [ 206 "dentry/include", 207 "inner_api", 208 "ioctl/include", 209 "load/include", 210 "log/include", 211 "system/include", 212 ] 213} 214 215ohos_shared_library("libdistributedfileutils_lite") { 216 branch_protector_ret = "pac_ret" 217 configs = [ ":optimize-size" ] 218 sanitize = { 219 integer_overflow = true 220 ubsan = true 221 boundary_sanitize = true 222 cfi = true 223 cfi_cross_dso = true 224 debug = false 225 } 226 227 sources = [ 228 "cloud_disk/src/cloud_file_utils.cpp", 229 "dentry/src/file_utils.cpp", 230 "dentry/src/meta_file.cpp", 231 "dentry/src/meta_file_clouddisk.cpp", 232 "dfx/src/xcollie_helper.cpp", 233 "ffrt/src/ffrt_timer.cpp", 234 "load/src/plugin_loader.cpp", 235 "log/src/dfs_error.cpp", 236 "log/src/utils_log.cpp", 237 "system/src/dfsu_memory_guard.cpp", 238 "system/src/utils_directory.cpp", 239 ] 240 241 configs += [ "//build/config/compiler:exceptions" ] 242 public_configs = [ ":utils_lite_public_config" ] 243 244 cflags = [ 245 "-D_FORTIFY_SOURCE=2", 246 ] 247 248 defines = [ 249 "LOG_DOMAIN=0xD004308", 250 "LOG_TAG=\"CloudFileDaemon\"", 251 ] 252 253 deps = [] 254 255 external_deps = [ 256 "c_utils:utils", 257 "device_manager:devicemanagersdk", 258 "ffrt:libffrt", 259 "hilog:libhilog", 260 "hisysevent:libhisysevent", 261 "json:nlohmann_json_static", 262 ] 263 264 if (use_musl) { 265 if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) { 266 defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ] 267 } 268 } 269 270 if (cloudsync_service_hicollie_enable) { 271 external_deps += [ "hicollie:libhicollie" ] 272 defines += [ "HICOLLIE_ENABLE" ] 273 } 274 275 part_name = "dfs_service" 276 innerapi_tags = [ "platformsdk" ] 277 subsystem_name = "filemanagement" 278} 279