1# Copyright (c) 2021-2023 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/file_api/file_api.gni") 16 17file_common_src = [ 18 "src/common/file_helper/fd_guard.cpp", 19 "src/common/napi/n_async/n_async_work_callback.cpp", 20 "src/common/napi/n_async/n_async_work_promise.cpp", 21 "src/common/napi/n_async/n_ref.cpp", 22 "src/common/napi/n_class.cpp", 23 "src/common/napi/n_func_arg.cpp", 24 "src/common/napi/n_val.cpp", 25 "src/common/uni_error.cpp", 26] 27 28ohos_shared_library("fileio") { 29 subsystem_name = "filemanagement" 30 part_name = "file_api" 31 32 relative_install_dir = "module" 33 34 include_dirs = [ 35 "//foundation/arkui/napi/interfaces/kits", 36 "//foundation/filemanagement/file_api/interfaces/kits/js/src/common/file_helper", 37 "//foundation/filemanagement/file_api/interfaces/kits/js/src/common/napi", 38 "//foundation/filemanagement/file_api/interfaces/kits/js/src/common/napi/n_async", 39 "//third_party/node/src", 40 "//third_party/bounds_checking_function/include", 41 "//third_party/libuv/include", 42 "//third_party/openssl/include", 43 ] 44 45 sources = file_common_src 46 sources += [ 47 "src/common/file_helper/hash_file.cpp", 48 "src/mod_fileio/class_constants/constants.cpp", 49 "src/mod_fileio/class_dir/dir_n_exporter.cpp", 50 "src/mod_fileio/class_dirent/dirent_n_exporter.cpp", 51 "src/mod_fileio/class_randomaccessfile/randomaccessfile_n_exporter.cpp", 52 "src/mod_fileio/class_stat/stat_n_exporter.cpp", 53 "src/mod_fileio/class_stream/flush.cpp", 54 "src/mod_fileio/class_stream/stream_n_exporter.cpp", 55 "src/mod_fileio/class_watcher/watcher_n_exporter.cpp", 56 "src/mod_fileio/common_func.cpp", 57 "src/mod_fileio/module.cpp", 58 "src/mod_fileio/properties/chmod.cpp", 59 "src/mod_fileio/properties/chown.cpp", 60 "src/mod_fileio/properties/close.cpp", 61 "src/mod_fileio/properties/copy_file.cpp", 62 "src/mod_fileio/properties/create_randomaccessfile.cpp", 63 "src/mod_fileio/properties/create_stream.cpp", 64 "src/mod_fileio/properties/fchmod.cpp", 65 "src/mod_fileio/properties/fchown.cpp", 66 "src/mod_fileio/properties/fdatasync.cpp", 67 "src/mod_fileio/properties/fdopen_stream.cpp", 68 "src/mod_fileio/properties/fstat.cpp", 69 "src/mod_fileio/properties/fsync.cpp", 70 "src/mod_fileio/properties/ftruncate.cpp", 71 "src/mod_fileio/properties/hash.cpp", 72 "src/mod_fileio/properties/lchown.cpp", 73 "src/mod_fileio/properties/link.cpp", 74 "src/mod_fileio/properties/lseek.cpp", 75 "src/mod_fileio/properties/lstat.cpp", 76 "src/mod_fileio/properties/mkdtemp.cpp", 77 "src/mod_fileio/properties/open.cpp", 78 "src/mod_fileio/properties/open_dir.cpp", 79 "src/mod_fileio/properties/posix_fallocate.cpp", 80 "src/mod_fileio/properties/prop_n_exporter.cpp", 81 "src/mod_fileio/properties/read_dir.cpp", 82 "src/mod_fileio/properties/read_text.cpp", 83 "src/mod_fileio/properties/rename.cpp", 84 "src/mod_fileio/properties/rmdir.cpp", 85 "src/mod_fileio/properties/rmdirent.cpp", 86 "src/mod_fileio/properties/stat.cpp", 87 "src/mod_fileio/properties/symlink.cpp", 88 "src/mod_fileio/properties/truncate.cpp", 89 "src/mod_fileio/properties/watcher.cpp", 90 ] 91 92 deps = [ 93 "//foundation/arkui/napi:ace_napi", 94 "//foundation/filemanagement/file_api/interfaces/kits/native:remote_uri_native", 95 "//third_party/bounds_checking_function:libsec_shared", 96 "//third_party/openssl:libcrypto_shared", 97 ] 98 99 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 100} 101 102ohos_shared_library("fs") { 103 subsystem_name = "filemanagement" 104 part_name = "file_api" 105 106 relative_install_dir = "module/file" 107 108 include_dirs = [ 109 "${src_path}/common/file_helper", 110 "${src_path}/mod_fs", 111 "${utils_path}/filemgmt_libn/include", 112 "${utils_path}/filemgmt_libn/include/n_async", 113 "//third_party/libuv/include", 114 ] 115 116 sources = [ 117 "src/common/file_helper/fd_guard.cpp", 118 "src/mod_fs/class_file/file_n_exporter.cpp", 119 "src/mod_fs/class_stat/stat_n_exporter.cpp", 120 "src/mod_fs/class_stream/flush.cpp", 121 "src/mod_fs/class_stream/stream_n_exporter.cpp", 122 "src/mod_fs/common_func.cpp", 123 "src/mod_fs/module.cpp", 124 "src/mod_fs/properties/close.cpp", 125 "src/mod_fs/properties/copy_file.cpp", 126 "src/mod_fs/properties/create_stream.cpp", 127 "src/mod_fs/properties/fdatasync.cpp", 128 "src/mod_fs/properties/fdopen_stream.cpp", 129 "src/mod_fs/properties/fsync.cpp", 130 "src/mod_fs/properties/listfile.cpp", 131 "src/mod_fs/properties/lstat.cpp", 132 "src/mod_fs/properties/mkdtemp.cpp", 133 "src/mod_fs/properties/move.cpp", 134 "src/mod_fs/properties/open.cpp", 135 "src/mod_fs/properties/prop_n_exporter.cpp", 136 "src/mod_fs/properties/read_text.cpp", 137 "src/mod_fs/properties/rename.cpp", 138 "src/mod_fs/properties/rmdirent.cpp", 139 "src/mod_fs/properties/stat.cpp", 140 "src/mod_fs/properties/symlink.cpp", 141 "src/mod_fs/properties/truncate.cpp", 142 ] 143 144 deps = [ 145 "${file_api_path}/interfaces/kits/native:remote_uri_native", 146 "${utils_path}/filemgmt_libn:filemgmt_libn", 147 ] 148 149 external_deps = [ 150 "ability_base:zuri", 151 "ability_runtime:abilitykit_native", 152 "bundle_framework:appexecfwk_core", 153 "c_utils:utils", 154 "data_share:datashare_common", 155 "data_share:datashare_consumer", 156 "ipc:ipc_core", 157 "samgr:samgr_proxy", 158 ] 159} 160 161ohos_shared_library("hash") { 162 subsystem_name = "filemanagement" 163 part_name = "file_api" 164 165 relative_install_dir = "module/file" 166 167 include_dirs = [ 168 "${src_path}/common/file_helper", 169 "${utils_path}/filemgmt_libn/include", 170 "${utils_path}/filemgmt_libhilog", 171 ] 172 173 sources = [ 174 "src/common/file_helper/fd_guard.cpp", 175 "src/common/file_helper/hash_file.cpp", 176 "src/mod_hash/hash.cpp", 177 "src/mod_hash/module.cpp", 178 ] 179 180 deps = [ 181 "${utils_path}/filemgmt_libhilog:filemgmt_libhilog", 182 "${utils_path}/filemgmt_libn:filemgmt_libn", 183 "//third_party/bounds_checking_function:libsec_shared", 184 "//third_party/openssl:libcrypto_shared", 185 ] 186} 187 188ohos_shared_library("file") { 189 subsystem_name = "filemanagement" 190 part_name = "file_api" 191 192 relative_install_dir = "module" 193 194 include_dirs = [ 195 "//foundation/arkui/napi/interfaces/kits", 196 "//foundation/filemanagement/file_api/interfaces/kits/js/src/common/napi", 197 "//foundation/filemanagement/file_api/interfaces/kits/js/src/common/napi/n_async", 198 "//foundation/filemanagement/file_api/interfaces/kits/js/src/common/file_helper", 199 "//third_party/node/src", 200 "//third_party/bounds_checking_function/include", 201 ] 202 203 sources = file_common_src 204 sources += [ 205 "src/common/ability_helper.cpp", 206 "src/mod_file/class_file/file_n_exporter.cpp", 207 "src/mod_file/common_func.cpp", 208 "src/mod_file/module.cpp", 209 ] 210 211 deps = [ 212 "${aafwk_kits_path}/ability/native:abilitykit_native", 213 "//foundation/arkui/napi:ace_napi", 214 "//third_party/bounds_checking_function:libsec_shared", 215 ] 216 217 external_deps = [ 218 "eventhandler:libeventhandler", 219 "hiviewdfx_hilog_native:libhilog", 220 ] 221} 222 223ohos_shared_library("statfs") { 224 subsystem_name = "filemanagement" 225 part_name = "file_api" 226 227 relative_install_dir = "module" 228 229 sources = [ 230 "src/mod_statfs/statfs_n_exporter.cpp", 231 "src/mod_statfs/statfs_napi.cpp", 232 ] 233 234 deps = [ 235 "//foundation/filemanagement/file_api/utils/filemgmt_libhilog", 236 "//foundation/filemanagement/file_api/utils/filemgmt_libn", 237 ] 238} 239 240ohos_shared_library("statvfs") { 241 subsystem_name = "filemanagement" 242 part_name = "file_api" 243 244 relative_install_dir = "module/file" 245 246 sources = [ 247 "src/mod_statvfs/statvfs_n_exporter.cpp", 248 "src/mod_statvfs/statvfs_napi.cpp", 249 ] 250 251 deps = [ 252 "//foundation/filemanagement/file_api/utils/filemgmt_libhilog", 253 "//foundation/filemanagement/file_api/utils/filemgmt_libn", 254 ] 255} 256 257ohos_shared_library("environment") { 258 subsystem_name = "filemanagement" 259 part_name = "file_api" 260 261 relative_install_dir = "module/file" 262 263 sources = [ 264 "src/mod_environment/environment_n_exporter.cpp", 265 "src/mod_environment/environment_napi.cpp", 266 ] 267 268 deps = [ 269 "//foundation/filemanagement/file_api/utils/filemgmt_libhilog", 270 "//foundation/filemanagement/file_api/utils/filemgmt_libn", 271 ] 272 273} 274 275ohos_shared_library("securitylabel") { 276 subsystem_name = "filemanagement" 277 part_name = "file_api" 278 279 relative_install_dir = "module/file" 280 281 cflags = [ "-Wno-format" ] 282 283 sources = file_common_src 284 sources += [ 285 "src/mod_securitylabel/securitylabel_n_exporter.cpp", 286 "src/mod_securitylabel/securitylabel_napi.cpp", 287 ] 288 289 deps = [ 290 "//foundation/filemanagement/file_api/utils/filemgmt_libhilog", 291 "//foundation/filemanagement/file_api/utils/filemgmt_libn", 292 ] 293} 294 295ohos_shared_library("document") { 296 subsystem_name = "filemanagement" 297 part_name = "file_api" 298 299 relative_install_dir = "module" 300 301 include_dirs = [ 302 "//foundation/arkui/napi/interfaces/kits", 303 "//foundation/filemanagement/file_api/interfaces/kits/js/src/common/napi/n_async", 304 "//third_party/node/src", 305 ] 306 307 sources = [ 308 "src/common/napi/n_async/n_async_work_callback.cpp", 309 "src/common/napi/n_async/n_async_work_promise.cpp", 310 "src/common/napi/n_async/n_ref.cpp", 311 "src/common/napi/n_func_arg.cpp", 312 "src/common/napi/n_val.cpp", 313 "src/common/uni_error.cpp", 314 "src/mod_document/document_n_exporter.cpp", 315 "src/mod_document/document_napi.cpp", 316 ] 317 318 deps = [ "//foundation/arkui/napi:ace_napi" ] 319 320 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 321} 322 323group("build_kits_js") { 324 deps = [ 325 ":document", 326 ":environment", 327 ":file", 328 ":fileio", 329 ":fs", 330 ":hash", 331 ":securitylabel", 332 ":statfs", 333 ":statvfs", 334 ] 335} 336