1# Copyright (c) 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/app_file_service/app_file_service.gni")
16
17config("file_share_config") {
18  visibility = [ ":*" ]
19  include_dirs = [
20    "file_share/include",
21    "//third_party/json/include",
22    "../../common/include",
23  ]
24}
25
26config("file_uri_config") {
27  visibility = [ ":*" ]
28  include_dirs = [
29    "file_uri/include",
30    "//third_party/json/include",
31    "../../common/include",
32  ]
33}
34
35ohos_shared_library("fileshare_native") {
36  branch_protector_ret = "pac_ret"
37
38  sanitize = {
39    integer_overflow = true
40    ubsan = true
41    boundary_sanitize = true
42    cfi = true
43    cfi_cross_dso = true
44    debug = false
45  }
46
47  sources = [
48    "../../common/src/json_utils.cpp",
49    "../../common/src/sandbox_helper.cpp",
50    "file_share/src/file_permission.cpp",
51    "file_share/src/file_share.cpp",
52  ]
53
54  public_configs = [ ":file_share_config" ]
55
56  deps =
57      [ "${app_file_service_path}/interfaces/innerkits/native:fileuri_native" ]
58
59  external_deps = [
60    "ability_base:base",
61    "ability_base:want",
62    "ability_base:zuri",
63    "access_token:libaccesstoken_sdk",
64    "bundle_framework:appexecfwk_base",
65    "c_utils:utils",
66    "file_api:filemgmt_libn",
67    "hilog:libhilog",
68    "init:libbegetutil",
69    "ipc:ipc_core",
70    "napi:ace_napi",
71  ]
72  defines = []
73  if (sandbox_manarer) {
74    external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ]
75    defines += [ "SANDBOX_MANAGER" ]
76  }
77  part_name = "app_file_service"
78  subsystem_name = "filemanagement"
79}
80
81ohos_shared_library("fileuri_native") {
82  branch_protector_ret = "pac_ret"
83  sanitize = {
84    integer_overflow = true
85    cfi = true
86    cfi_cross_dso = true
87    debug = false
88  }
89
90  sources = [
91    "../../common/src/common_func.cpp",
92    "../../common/src/json_utils.cpp",
93    "../../common/src/sandbox_helper.cpp",
94    "file_uri/src/file_uri.cpp",
95  ]
96
97  public_configs = [ ":file_uri_config" ]
98
99  external_deps = [
100    "ability_base:zuri",
101    "bundle_framework:appexecfwk_base",
102    "bundle_framework:appexecfwk_core",
103    "c_utils:utils",
104    "hilog:libhilog",
105    "init:libbegetutil",
106    "ipc:ipc_core",
107    "samgr:samgr_proxy",
108  ]
109
110  part_name = "app_file_service"
111  subsystem_name = "filemanagement"
112}
113
114ohos_prebuilt_etc("file_share_sandbox.json") {
115  source = "../../common/file_share_sandbox.json"
116  part_name = "app_file_service"
117  subsystem_name = "filemanagement"
118  module_install_dir = "etc/app_file_service"
119}
120
121ohos_prebuilt_etc("backup_sandbox.json") {
122  source = "../../common/backup_sandbox.json"
123  part_name = "app_file_service"
124  subsystem_name = "filemanagement"
125  module_install_dir = "etc/app_file_service"
126}
127
128config("remote_file_share_config") {
129  visibility = [ ":*" ]
130  include_dirs = [
131    "include",
132    "${utils_system_safwk_path}/native/include",
133    "remote_file_share/include",
134    "//third_party/json/include",
135    "${path_base}/include",
136    "../../common/include",
137    ".",
138  ]
139}
140
141ohos_shared_library("remote_file_share_native") {
142  branch_protector_ret = "pac_ret"
143  sanitize = {
144    integer_overflow = true
145    cfi = true
146    cfi_cross_dso = true
147    debug = false
148  }
149
150  sources = [
151    "../../common/src/json_utils.cpp",
152    "../../common/src/sandbox_helper.cpp",
153    "remote_file_share/src/remote_file_share.cpp",
154  ]
155
156  public_configs = [ ":remote_file_share_config" ]
157
158  external_deps = [
159    "ability_base:zuri",
160    "c_utils:utils",
161    "hilog:libhilog",
162  ]
163
164  if (defined(global_parts_info) &&
165      defined(global_parts_info.distributedhardware_device_manager)) {
166    external_deps += [ "device_manager:devicemanagersdk" ]
167    defines = [ "ENABLE_DEVICE_MANAGER" ]
168  }
169
170  innerapi_tags = [ "platformsdk_indirect" ]
171  part_name = "app_file_service"
172  subsystem_name = "filemanagement"
173}
174
175config("sandbox_helper_config") {
176  visibility = [ ":*" ]
177  include_dirs = [
178    "include",
179    "${utils_system_safwk_path}/native/include",
180    "//third_party/json/include",
181    "${path_base}/include",
182    "../../common/include",
183    ".",
184  ]
185}
186
187ohos_shared_library("sandbox_helper_native") {
188  branch_protector_ret = "pac_ret"
189  sanitize = {
190    integer_overflow = true
191    cfi = true
192    cfi_cross_dso = true
193    debug = false
194  }
195
196  sources = [
197    "../../common/src/json_utils.cpp",
198    "../../common/src/sandbox_helper.cpp",
199  ]
200
201  public_configs = [ ":sandbox_helper_config" ]
202
203  external_deps = [
204    "ability_base:zuri",
205    "c_utils:utils",
206    "hilog:libhilog",
207  ]
208
209  innerapi_tags = [ "platformsdk_indirect" ]
210  part_name = "app_file_service"
211  subsystem_name = "filemanagement"
212}
213
214group("app_file_service_native") {
215  deps = [
216    ":fileshare_native",
217    ":fileuri_native",
218    ":remote_file_share_native",
219    ":sandbox_helper_native",
220  ]
221}
222
223group("etc_files") {
224  deps = [
225    ":backup_sandbox.json",
226    ":file_share_sandbox.json",
227  ]
228}
229