1# Copyright (c) 2021-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("//base/notification/common_event_service/event.gni") 15import("//build/ohos.gni") 16 17config("ces_services_config") { 18 visibility = [ ":*" ] 19 20 include_dirs = [ 21 "${ces_services_path}/include", 22 "${ffrt_path}/interfaces/kits", 23 ] 24 25 cflags = [ 26 "-fvisibility=hidden", 27 "-fvisibility-inlines-hidden", 28 "-fno-math-errno", 29 "-fno-unroll-loops", 30 "-fmerge-all-constants", 31 "-fno-ident", 32 "-Oz", 33 "-flto", 34 "-ffunction-sections", 35 "-fdata-sections", 36 ] 37 38 if (target_cpu == "arm") { 39 cflags += [ "-DBINDER_IPC_32BIT" ] 40 } 41} 42 43config("ces_services_public_config") { 44 visibility = [ ":*" ] 45 46 cflags = [] 47 48 include_dirs = [ 49 "${ces_services_path}/include", 50 "${ffrt_path}/interfaces/kits", 51 ] 52 53 if (target_cpu == "arm") { 54 cflags += [ "-DBINDER_IPC_32BIT" ] 55 } 56} 57 58cesfwk_services_sources = [ 59 "${ces_services_path}/src/ability_manager_death_recipient.cpp", 60 "${ces_services_path}/src/ability_manager_helper.cpp", 61 "${ces_services_path}/src/access_token_helper.cpp", 62 "${ces_services_path}/src/bms_death_recipient.cpp", 63 "${ces_services_path}/src/bundle_manager_helper.cpp", 64 "${ces_services_path}/src/common_event_control_manager.cpp", 65 "${ces_services_path}/src/common_event_manager_service.cpp", 66 "${ces_services_path}/src/common_event_manager_service_ability.cpp", 67 "${ces_services_path}/src/common_event_permission_manager.cpp", 68 "${ces_services_path}/src/common_event_sticky_manager.cpp", 69 "${ces_services_path}/src/common_event_subscriber_manager.cpp", 70 "${ces_services_path}/src/common_event_support_mapper.cpp", 71 "${ces_services_path}/src/event_report.cpp", 72 "${ces_services_path}/src/inner_common_event_manager.cpp", 73 "${ces_services_path}/src/ordered_event_handler.cpp", 74 "${ces_services_path}/src/os_account_manager_helper.cpp", 75 "${ces_services_path}/src/publish_manager.cpp", 76 "${ces_services_path}/src/static_subscriber_connection.cpp", 77 "${ces_services_path}/src/static_subscriber_data_manager.cpp", 78 "${ces_services_path}/src/static_subscriber_manager.cpp", 79 "${ces_services_path}/src/subscriber_death_recipient.cpp", 80 "${ces_services_path}/src/system_time.cpp", 81] 82 83ohos_shared_library("cesfwk_services") { 84 sanitize = { 85 integer_overflow = true 86 ubsan = true 87 boundary_sanitize = true 88 cfi = true 89 cfi_cross_dso = true 90 debug = false 91 } 92 branch_protector_ret = "pac_ret" 93 94 shlib_type = "sa" 95 96 cflags_cc = [] 97 defines = [] 98 99 if (build_variant == "user") { 100 defines += [ "BUILD_VARIANT_USER" ] 101 } 102 103 sources = cesfwk_services_sources 104 105 configs = [ ":ces_services_config" ] 106 107 deps = [ 108 "${ces_core_path}:cesfwk_core", 109 "${ces_extension_path}:static_subscriber_ipc", 110 "${ces_native_path}:cesfwk_innerkits", 111 "../services:ces.para", 112 "../services:ces.para.dac", 113 ] 114 115 external_deps = [ 116 "ability_base:want", 117 "ability_runtime:ability_manager", 118 "access_token:libaccesstoken_sdk", 119 "access_token:libprivacy_sdk", 120 "access_token:libtokenid_sdk", 121 "bundle_framework:appexecfwk_base", 122 "bundle_framework:appexecfwk_core", 123 "c_utils:utils", 124 "config_policy:configpolicy_util", 125 "eventhandler:libeventhandler", 126 "ffrt:libffrt", 127 "hicollie:libhicollie", 128 "hilog:libhilog", 129 "hisysevent:libhisysevent", 130 "init:libbegetutil", 131 "ipc:ipc_core", 132 "kv_store:distributeddata_inner", 133 "safwk:system_ability_fwk", 134 "samgr:samgr_proxy", 135 ] 136 137 if (has_os_account_part) { 138 cflags_cc += [ "-DHAS_OS_ACCOUNT_PART" ] 139 external_deps += [ "os_account:os_account_innerkits" ] 140 } 141 142 if (has_hisysevent_part) { 143 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 144 external_deps += [ "hisysevent:libhisysevent" ] 145 } 146 147 if (ces_hitrace_usage) { 148 external_deps += [ "hitrace:hitrace_meter" ] 149 defines += [ "HITRACE_METER_ENABLE" ] 150 } 151 152 if (ces_config_policy_enable) { 153 external_deps += [ "config_policy:configpolicy_util" ] 154 defines += [ "CONFIG_POLICY_ENABLE" ] 155 } 156 157 subsystem_name = "notification" 158 part_name = "common_event_service" 159} 160 161# Note: Just for test 162ohos_static_library("cesfwk_services_static") { 163 cflags_cc = [] 164 defines = [] 165 sources = cesfwk_services_sources 166 167 public_configs = [ ":ces_services_public_config" ] 168 169 deps = [ 170 "${ces_core_path}:cesfwk_core", 171 "${ces_extension_path}:static_subscriber_ipc", 172 "${ces_native_path}:cesfwk_innerkits", 173 "../services:ces.para", 174 "../services:ces.para.dac", 175 ] 176 177 external_deps = [ 178 "ability_base:want", 179 "ability_runtime:ability_connect_callback_stub", 180 "ability_runtime:ability_manager", 181 "access_token:libaccesstoken_sdk", 182 "access_token:libprivacy_sdk", 183 "access_token:libtokenid_sdk", 184 "bundle_framework:appexecfwk_base", 185 "bundle_framework:appexecfwk_core", 186 "c_utils:utils", 187 "eventhandler:libeventhandler", 188 "ffrt:libffrt", 189 "hicollie:libhicollie", 190 "hilog:libhilog", 191 "hisysevent:libhisysevent", 192 "init:libbegetutil", 193 "ipc:ipc_core", 194 "kv_store:distributeddata_inner", 195 "safwk:system_ability_fwk", 196 "samgr:samgr_proxy", 197 ] 198 199 if (has_os_account_part) { 200 cflags_cc += [ "-DHAS_OS_ACCOUNT_PART" ] 201 external_deps += [ "os_account:os_account_innerkits" ] 202 } 203 204 if (has_hisysevent_part) { 205 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 206 external_deps += [ "hisysevent:libhisysevent" ] 207 } 208 209 if (ces_hitrace_usage) { 210 external_deps += [ "hitrace:hitrace_meter" ] 211 defines += [ "HITRACE_METER_ENABLE" ] 212 } 213 214 if (ces_config_policy_enable) { 215 external_deps += [ "config_policy:configpolicy_util" ] 216 defines += [ "CONFIG_POLICY_ENABLE" ] 217 } 218 219 subsystem_name = "notification" 220 part_name = "common_event_service" 221} 222 223ohos_prebuilt_etc("ces.para") { 224 source = "etc/ces.para" 225 relative_install_dir = "param" 226 subsystem_name = "notification" 227 part_name = "common_event_service" 228} 229 230ohos_prebuilt_etc("ces.para.dac") { 231 source = "etc/ces.para.dac" 232 relative_install_dir = "param" 233 subsystem_name = "notification" 234 part_name = "common_event_service" 235} 236