• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "${arkui_napi_path}/interfaces/kits",
36    "src/common/file_helper",
37    "src/common/napi",
38    "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    "${file_api_path}/interfaces/kits/native:remote_uri_native",
94    "//third_party/bounds_checking_function:libsec_shared",
95    "//third_party/openssl:libcrypto_shared",
96  ]
97
98  external_deps = [
99    "hilog:libhilog",
100    "napi:ace_napi",
101  ]
102  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
103}
104
105ohos_shared_library("fs") {
106  subsystem_name = "filemanagement"
107  part_name = "file_api"
108
109  relative_install_dir = "module/file"
110
111  include_dirs = [
112    "${src_path}/common",
113    "${src_path}/common/file_helper",
114    "${src_path}/mod_fs",
115    "${utils_path}/common/include",
116    "//third_party/libuv/include",
117  ]
118
119  sources = [
120    "src/common/file_helper/fd_guard.cpp",
121    "src/mod_fs/class_file/file_n_exporter.cpp",
122    "src/mod_fs/class_stat/stat_n_exporter.cpp",
123    "src/mod_fs/common_func.cpp",
124    "src/mod_fs/module.cpp",
125    "src/mod_fs/properties/close.cpp",
126    "src/mod_fs/properties/fdatasync.cpp",
127    "src/mod_fs/properties/fsync.cpp",
128    "src/mod_fs/properties/lstat.cpp",
129    "src/mod_fs/properties/mkdtemp.cpp",
130    "src/mod_fs/properties/open.cpp",
131    "src/mod_fs/properties/prop_n_exporter.cpp",
132    "src/mod_fs/properties/rename.cpp",
133    "src/mod_fs/properties/rmdirent.cpp",
134    "src/mod_fs/properties/stat.cpp",
135    "src/mod_fs/properties/truncate.cpp",
136  ]
137
138  cflags_cc = [ "-std=c++17" ]
139
140  deps = [
141    "${utils_path}/filemgmt_libhilog:filemgmt_libhilog",
142    "${utils_path}/filemgmt_libn:filemgmt_libn",
143  ]
144
145  use_exceptions = true
146
147  if (use_mingw_win) {
148    defines = [ "WIN_PLATFORM" ]
149  }
150  if (use_mac) {
151    defines = [ "IOS_PLATFORM" ]
152  }
153
154  external_deps = [
155    "hilog:libhilog",
156    "napi:ace_napi",
157  ]
158
159  if (!use_mingw_win && !use_mac) {
160    sources += [
161      "src/mod_fs/class_randomaccessfile/randomaccessfile_n_exporter.cpp",
162      "src/mod_fs/class_stream/flush.cpp",
163      "src/mod_fs/class_stream/stream_n_exporter.cpp",
164      "src/mod_fs/class_watcher/watcher_entity.cpp",
165      "src/mod_fs/class_watcher/watcher_n_exporter.cpp",
166      "src/mod_fs/properties/copy_file.cpp",
167      "src/mod_fs/properties/copydir.cpp",
168      "src/mod_fs/properties/create_randomaccessfile.cpp",
169      "src/mod_fs/properties/create_stream.cpp",
170      "src/mod_fs/properties/dup.cpp",
171      "src/mod_fs/properties/fdopen_stream.cpp",
172      "src/mod_fs/properties/listfile.cpp",
173      "src/mod_fs/properties/move.cpp",
174      "src/mod_fs/properties/movedir.cpp",
175      "src/mod_fs/properties/read_text.cpp",
176      "src/mod_fs/properties/symlink.cpp",
177      "src/mod_fs/properties/watcher.cpp",
178    ]
179    external_deps += [
180      "ability_base:zuri",
181      "ability_runtime:abilitykit_native",
182      "access_token:libtokenid_sdk",
183      "app_file_service:fileuri_native",
184      "bundle_framework:appexecfwk_base",
185      "bundle_framework:appexecfwk_core",
186      "c_utils:utils",
187      "data_share:datashare_common",
188      "data_share:datashare_consumer",
189      "ipc:ipc_core",
190      "samgr:samgr_proxy",
191    ]
192    deps += [ "${file_api_path}/interfaces/kits/native:remote_uri_native" ]
193  }
194}
195
196ohos_shared_library("hash") {
197  subsystem_name = "filemanagement"
198  part_name = "file_api"
199
200  relative_install_dir = "module/file"
201
202  include_dirs = [ "${src_path}/common/file_helper" ]
203
204  sources = [
205    "src/common/file_helper/fd_guard.cpp",
206    "src/common/file_helper/hash_file.cpp",
207    "src/mod_hash/hash.cpp",
208    "src/mod_hash/module.cpp",
209  ]
210
211  deps = [
212    "${utils_path}/filemgmt_libhilog:filemgmt_libhilog",
213    "${utils_path}/filemgmt_libn:filemgmt_libn",
214    "//third_party/bounds_checking_function:libsec_shared",
215    "//third_party/openssl:libcrypto_shared",
216  ]
217
218  external_deps = [
219    "hilog:libhilog",
220    "napi:ace_napi",
221  ]
222  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
223}
224
225ohos_shared_library("file") {
226  subsystem_name = "filemanagement"
227  part_name = "file_api"
228
229  relative_install_dir = "module"
230
231  include_dirs = [
232    "${arkui_napi_path}/interfaces/kits",
233    "src/common/napi",
234    "src/common/napi/n_async",
235    "src/common/file_helper",
236    "//third_party/node/src",
237    "//third_party/bounds_checking_function/include",
238  ]
239
240  sources = file_common_src
241  sources += [
242    "src/common/ability_helper.cpp",
243    "src/mod_file/class_file/file_n_exporter.cpp",
244    "src/mod_file/common_func.cpp",
245    "src/mod_file/module.cpp",
246  ]
247
248  deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
249
250  external_deps = [
251    "ability_runtime:abilitykit_native",
252    "common_event_service:cesfwk_innerkits",
253    "eventhandler:libeventhandler",
254    "hilog:libhilog",
255    "napi:ace_napi",
256  ]
257}
258
259ohos_shared_library("statfs") {
260  subsystem_name = "filemanagement"
261  part_name = "file_api"
262
263  relative_install_dir = "module"
264
265  sources = [
266    "src/mod_statfs/statfs_n_exporter.cpp",
267    "src/mod_statfs/statfs_napi.cpp",
268  ]
269
270  deps = [
271    "${utils_path}/filemgmt_libhilog:filemgmt_libhilog",
272    "${utils_path}/filemgmt_libn:filemgmt_libn",
273  ]
274
275  external_deps = [
276    "hilog:libhilog",
277    "napi:ace_napi",
278  ]
279}
280
281ohos_shared_library("statvfs") {
282  subsystem_name = "filemanagement"
283  part_name = "file_api"
284
285  relative_install_dir = "module/file"
286
287  sources = [
288    "src/mod_statvfs/statvfs_n_exporter.cpp",
289    "src/mod_statvfs/statvfs_napi.cpp",
290  ]
291
292  deps = [
293    "${utils_path}/filemgmt_libhilog:filemgmt_libhilog",
294    "${utils_path}/filemgmt_libn:filemgmt_libn",
295  ]
296
297  external_deps = [
298    "hilog:libhilog",
299    "napi:ace_napi",
300  ]
301}
302
303ohos_shared_library("environment") {
304  subsystem_name = "filemanagement"
305  part_name = "file_api"
306
307  relative_install_dir = "module/file"
308
309  sources = [
310    "src/mod_environment/environment_n_exporter.cpp",
311    "src/mod_environment/environment_napi.cpp",
312  ]
313
314  deps = [
315    "${utils_path}/filemgmt_libhilog:filemgmt_libhilog",
316    "${utils_path}/filemgmt_libn:filemgmt_libn",
317  ]
318
319  external_deps = [
320    "access_token:libtokenid_sdk",
321    "hilog:libhilog",
322    "ipc:ipc_core",
323    "napi:ace_napi",
324  ]
325}
326
327ohos_shared_library("securitylabel") {
328  subsystem_name = "filemanagement"
329  part_name = "file_api"
330
331  relative_install_dir = "module/file"
332
333  cflags = [ "-Wno-format" ]
334
335  sources = [
336    "src/mod_securitylabel/securitylabel_n_exporter.cpp",
337    "src/mod_securitylabel/securitylabel_napi.cpp",
338  ]
339
340  deps = [
341    "${utils_path}/filemgmt_libhilog:filemgmt_libhilog",
342    "${utils_path}/filemgmt_libn:filemgmt_libn",
343  ]
344
345  external_deps = [
346    "access_token:libtokenid_sdk",
347    "hilog:libhilog",
348    "ipc:ipc_core",
349    "napi:ace_napi",
350  ]
351}
352
353ohos_shared_library("document") {
354  subsystem_name = "filemanagement"
355  part_name = "file_api"
356
357  relative_install_dir = "module"
358
359  include_dirs = [
360    "${arkui_napi_path}/interfaces/kits",
361    "src/common/napi/n_async",
362    "//third_party/node/src",
363  ]
364
365  sources = [
366    "src/common/napi/n_async/n_async_work_callback.cpp",
367    "src/common/napi/n_async/n_async_work_promise.cpp",
368    "src/common/napi/n_async/n_ref.cpp",
369    "src/common/napi/n_func_arg.cpp",
370    "src/common/napi/n_val.cpp",
371    "src/common/uni_error.cpp",
372    "src/mod_document/document_n_exporter.cpp",
373    "src/mod_document/document_napi.cpp",
374  ]
375
376  external_deps = [
377    "hilog:libhilog",
378    "napi:ace_napi",
379  ]
380}
381
382group("build_kits_js") {
383  deps = [
384    ":document",
385    ":environment",
386    ":file",
387    ":fileio",
388    ":fs",
389    ":hash",
390    ":securitylabel",
391    ":statfs",
392    ":statvfs",
393  ]
394}
395