• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2025 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
17ohos_shared_library("cj_file_fs_ffi") {
18  include_dirs = [
19    "${src_path}/common",
20    "${src_path}/common/file_helper",
21    "${src_path}/mod_fs",
22    "${src_path}/mod_fs/class_file",
23    "${src_path}/mod_fs/class_randomaccessfile",
24    "${src_path}/mod_fs/class_readeriterator",
25    "${src_path}/mod_fs/class_stream",
26    "${src_path}/mod_fs/properties",
27    "${utils_path}/common/include",
28    "${utils_path}/filemgmt_libhilog",
29    "${utils_path}/filemgmt_libh",
30    "${utils_path}/filemgmt_libn/include",
31    "${file_api_path}/interfaces/kits/cj/src",
32    "${file_api_path}/interfaces/kits/native/remote_uri",
33    "${file_api_path}/interfaces/kits/native/task_signal",
34    "${file_api_path}/interfaces/kits/rust/include",
35  ]
36
37  sources = [
38    "../js/src/common/file_helper/fd_guard.cpp",
39    "../js/src/mod_fs/class_file/file_n_exporter.cpp",
40    "../js/src/mod_fs/class_stream/stream_n_exporter.cpp",
41    "../js/src/mod_fs/common_func.cpp",
42    "src/copy.cpp",
43    "src/copy_dir.cpp",
44    "src/copy_file.cpp",
45    "src/fdatasync.cpp",
46    "src/file_ffi.cpp",
47    "src/file_fs_ffi.cpp",
48    "src/file_fs_impl.cpp",
49    "src/file_impl.cpp",
50    "src/fsync.cpp",
51    "src/list_file.cpp",
52    "src/lseek.cpp",
53    "src/mkdtemp.cpp",
54    "src/move_file.cpp",
55    "src/randomAccessFile_impl.cpp",
56    "src/readerIterator_impl.cpp",
57    "src/stat_ffi.cpp",
58    "src/stat_impl.cpp",
59    "src/stream_ffi.cpp",
60    "src/stream_impl.cpp",
61    "src/symlink.cpp",
62    "src/task_signal_impl.cpp",
63    "src/translistener.cpp",
64    "src/uni_error.cpp",
65    "src/utils.cpp",
66    "src/watcher_impl.cpp",
67    "src/xattr.cpp",
68    "src/xattr_ffi.cpp",
69  ]
70
71  deps = [
72    "${file_api_path}/interfaces/kits/js:build_kits_js",
73    "${file_api_path}/interfaces/kits/js:fs",
74    "${file_api_path}/interfaces/kits/native:remote_uri_native",
75    "${file_api_path}/interfaces/kits/native:task_signal_native",
76    "${file_api_path}/interfaces/kits/rust:rust_file",
77    "${utils_path}/filemgmt_libhilog:filemgmt_libhilog",
78    "${utils_path}/filemgmt_libn:filemgmt_libn",
79  ]
80
81  cflags_cc = [ "-std=c++17" ]
82  use_exceptions = true
83  if (use_mingw_win) {
84    defines = [ "WIN_PLATFORM" ]
85  }
86  if (use_mac) {
87    defines = [ "IOS_PLATFORM" ]
88  }
89
90  external_deps = [
91    "ability_base:zuri",
92    "ability_runtime:ability_manager",
93    "ability_runtime:abilitykit_native",
94    "access_token:libtokenid_sdk",
95    "app_file_service:fileuri_native",
96    "bounds_checking_function:libsec_shared",
97    "bundle_framework:appexecfwk_base",
98    "bundle_framework:appexecfwk_core",
99    "c_utils:utils",
100    "data_share:datashare_common",
101    "data_share:datashare_consumer",
102    "dfs_service:distributed_file_daemon_kit_inner",
103    "hilog:libhilog",
104    "ipc:ipc_core",
105    "napi:ace_napi",
106    "napi:cj_bind_ffi",
107    "napi:cj_bind_native",
108    "samgr:samgr_proxy",
109  ]
110
111  if (!use_mingw_win && !use_mac) {
112    cflags = [
113      "-fvisibility=hidden",
114      "-fdata-sections",
115      "-ffunction-sections",
116      "-Oz",
117    ]
118    cflags_cc += [
119      "-fvisibility-inlines-hidden",
120      "-Oz",
121    ]
122    defines = [ "FILE_API_TRACE" ]
123    branch_protector_ret = "pac_ret"
124    sanitize = {
125      integer_overflow = true
126      ubsan = true
127      boundary_sanitize = true
128      cfi = true
129      cfi_cross_dso = true
130      debug = false
131    }
132  }
133
134  innerapi_tags = [ "platformsdk" ]
135  part_name = "file_api"
136  subsystem_name = "filemanagement"
137}
138
139ohos_shared_library("cj_statvfs_ffi") {
140  cflags = [
141    "-fvisibility=hidden",
142    "-fdata-sections",
143    "-ffunction-sections",
144    "-Oz",
145  ]
146  cflags_cc = [
147    "-fvisibility-inlines-hidden",
148    "-Oz",
149  ]
150  branch_protector_ret = "pac_ret"
151  sanitize = {
152    integer_overflow = true
153    ubsan = true
154    boundary_sanitize = true
155    cfi = true
156    cfi_cross_dso = true
157    debug = false
158  }
159
160  include_dirs = [ "${file_api_path}/interfaces/kits/cj/src" ]
161
162  sources = [
163    "src/statvfs_ffi.cpp",
164    "src/statvfs_impl.cpp",
165    "src/uni_error.cpp",
166  ]
167
168  deps = [
169    "${utils_path}/filemgmt_libhilog:filemgmt_libhilog",
170    "${utils_path}/filemgmt_libn:filemgmt_libn",
171  ]
172  external_deps = [
173    "hilog:libhilog",
174    "napi:ace_napi",
175    "napi:cj_bind_ffi",
176    "napi:cj_bind_native",
177  ]
178
179  innerapi_tags = [ "platformsdk" ]
180  part_name = "file_api"
181  subsystem_name = "filemanagement"
182}
183
184group("fs_ffi_packages") {
185  deps = [
186    ":cj_file_fs_ffi",
187    ":cj_statvfs_ffi",
188  ]
189}
190