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