1# Copyright (c) 2021-2022 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("//build/ohos/sa_profile/sa_profile.gni") 16import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni") 17 18config("storage_manager_config") { 19 include_dirs = [ 20 "include", 21 "../../interfaces/innerkits/storage_manager/native", 22 "../storage_daemon/include", 23 "../common/include", 24 ] 25 26 cflags = [ 27 "-D_FORTIFY_SOURCE=2", 28 "-fstack-protector-strong", 29 "-O2", 30 ] 31} 32 33ohos_shared_library("storage_manager") { 34 branch_protector_ret = "pac_ret" 35 sanitize = { 36 integer_overflow = true 37 ubsan = true 38 boundary_sanitize = true 39 cfi = true 40 cfi_cross_dso = true 41 debug = false 42 } 43 44 sources = [ 45 "ipc/src/storage_manager.cpp", 46 "ipc/src/storage_manager_stub.cpp", 47 "storage_daemon_communication/src/storage_daemon_communication.cpp", 48 "user/src/multi_user_manager_service.cpp", 49 "utils/src/storage_utils.cpp", 50 ] 51 52 defines = [ 53 "STORAGE_LOG_TAG = \"StorageManager\"", 54 "LOG_DOMAIN = 0xD004300", 55 ] 56 57 if (storage_service_media_fuse) { 58 defines += [ "STORAGE_SERVICE_MEDIA_FUSE" ] 59 } 60 61 configs = [ ":storage_manager_config" ] 62 63 deps = [ 64 "${storage_daemon_path}:storage_common_utils", 65 "${storage_interface_path}/innerkits/storage_manager/native:storage_manager_sa_proxy", 66 ] 67 68 external_deps = [ 69 "ability_base:base", 70 "ability_base:want", 71 "ability_runtime:extensionkit_native", 72 "access_token:libaccesstoken_sdk", 73 "appspawn:appspawn_client", 74 "cJSON:cjson", 75 "c_utils:utils", 76 "common_event_service:cesfwk_innerkits", 77 "hilog:libhilog", 78 "hitrace:hitrace_meter", 79 "ipc:ipc_single", 80 "os_account:os_account_innerkits", 81 "safwk:system_ability_fwk", 82 "samgr:samgr_proxy", 83 ] 84 85 if (storage_service_user_crypto_manager) { 86 defines += [ "USER_CRYPTO_MANAGER" ] 87 sources += [ 88 "account_subscriber/account_subscriber.cpp", 89 "crypto/filesystem_crypto.cpp", 90 ] 91 external_deps += [ "data_share:datashare_consumer" ] 92 } 93 94 if (storage_service_external_storage_manager) { 95 defines += [ "EXTERNAL_STORAGE_MANAGER" ] 96 sources += [ 97 "disk/src/disk_manager_service.cpp", 98 "volume/src/notification.cpp", 99 "volume/src/volume_manager_service.cpp", 100 ] 101 } 102 103 if (storage_service_storage_statistics_manager) { 104 defines += [ "STORAGE_STATISTICS_MANAGER" ] 105 sources += [ 106 "storage/src/bundle_manager_connector.cpp", 107 "storage/src/storage_monitor_service.cpp", 108 "storage/src/storage_status_service.cpp", 109 "storage/src/storage_total_status_service.cpp", 110 "storage/src/volume_storage_status_service.cpp", 111 ] 112 external_deps += [ 113 "ability_runtime:abilitykit_native", 114 "ability_runtime:dataobs_manager", 115 "bundle_framework:appexecfwk_base", 116 "bundle_framework:appexecfwk_core", 117 "eventhandler:libeventhandler", 118 "init:libbegetutil", 119 "relational_store:native_rdb", 120 ] 121 deps += [ ":storage_manager_monitor_config" ] 122 123 if (storage_service_graphic) { 124 defines += [ "STORAGE_SERVICE_GRAPHIC" ] 125 external_deps += [ "data_share:datashare_common" ] 126 } 127 } 128 129 if (enable_screenlock_manager) { 130 defines += [ "ENABLE_SCREENLOCK_MANAGER" ] 131 external_deps += [ "screenlock_mgr:screenlock_client" ] 132 } 133 134 subsystem_name = "filemanagement" 135 part_name = "storage_service" 136 install_enable = true 137} 138 139ohos_prebuilt_etc("storage_manager_config.para") { 140 source = "storage_manager_config.para" 141 part_name = "storage_service" 142 subsystem_name = "filemanagement" 143 module_install_dir = "etc/param" 144} 145 146ohos_prebuilt_etc("storage_manager_config.para.dac") { 147 source = "storage_manager_config.para.dac" 148 part_name = "storage_service" 149 subsystem_name = "filemanagement" 150 module_install_dir = "etc/param" 151} 152 153group("storage_manager_monitor_config") { 154 deps = [ 155 ":storage_manager_config.para", 156 ":storage_manager_config.para.dac", 157 ] 158} 159 160group("storage_manager_unit_test") { 161 testonly = true 162 deps = [ 163 "client/test:storage_manager_client_test", 164 "innerkits_impl/test:storage_manager_innerkits_test", 165 "ipc/test:storage_manager_ipc_test", 166 "storage_daemon_communication/test:storage_manager_communication_test", 167 "user/test:storage_manager_user_test", 168 ] 169 170 if (storage_service_user_crypto_manager) { 171 deps += [ "crypto/test:storage_manager_crypto_test" ] 172 } 173 174 if (storage_service_storage_statistics_manager) { 175 deps += [ "storage/test:storage_manager_storage_test" ] 176 } 177 178 if (storage_service_external_storage_manager) { 179 deps += [ 180 "disk/test:storage_manager_disk_test", 181 "volume/test:storage_manager_volume_test", 182 ] 183 } 184} 185