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