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