1# Copyright (C) 2024 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/app_file_service/app_file_service.gni")
16import("//foundation/filemanagement/app_file_service/backup.gni")
17
18ohos_shared_library("cj_file_fileuri_ffi") {
19  sanitize = {
20    integer_overflow = true
21    ubsan = true
22    boundary_sanitize = true
23    cfi = true
24    cfi_cross_dso = true
25    debug = false
26  }
27
28  include_dirs = [
29    "${app_file_service_path}/interfaces/innerkits/native/file_uri/include",
30    "src",
31  ]
32
33  if (!defined(defines)) {
34    defines = []
35  }
36
37  use_exceptions = true
38
39  if (product_name != "ohos-sdk") {
40    deps = [
41      "${app_file_service_path}/interfaces/innerkits/native:fileuri_native",
42      "${path_backup}/utils:backup_utils",
43    ]
44    external_deps = [
45      "ability_base:zuri",
46      "ability_runtime:abilitykit_native",
47      "bundle_framework:appexecfwk_base",
48      "bundle_framework:appexecfwk_core",
49      "c_utils:utils",
50      "file_api:filemgmt_libhilog",
51      "file_api:filemgmt_libn",
52      "hilog:libhilog",
53      "ipc:ipc_core",
54      "napi:cj_bind_ffi",
55      "napi:cj_bind_native",
56      "samgr:samgr_proxy",
57    ]
58    sources = [
59      "src/file_fileuri_ffi.cpp",
60      "src/file_uri.cpp",
61    ]
62  } else {
63    defines += [ "PREVIEWER" ]
64    sources = [ "src/fileuri_mock.cpp" ]
65  }
66
67  if (current_os == "ohos") {
68    defines += [ "OHOS_PLATFORM" ]
69  }
70
71  if (current_os == "mingw") {
72    defines += [ "WINDOWS_PLATFORM" ]
73  }
74
75  innerapi_tags = [ "platformsdk" ]
76  part_name = "app_file_service"
77  subsystem_name = "filemanagement"
78}
79