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("//build/config/components/idl_tool/idl.gni") 15import("../time.gni") 16 17config("time_service_gen_config") { 18 include_dirs = [ "${target_gen_dir}" ] 19} 20 21config("time_service_config") { 22 visibility = [ ":*" ] 23 include_dirs = [ 24 "${target_gen_dir}", 25 "${api_path}/include", 26 "../utils/native/include", 27 "time/include", 28 "time/include/inner_api_include", 29 "timer/include", 30 "dfx/include", 31 "${time_service_path}", 32 ] 33 cflags = [ "-fvisibility=hidden" ] 34 cflags_cc = [ 35 "-fvisibility-inlines-hidden", 36 "-fvisibility=hidden", 37 "-ffunction-sections", 38 "-fdata-sections", 39 "-Os", 40 ] 41} 42 43idl_gen_interface("timeservice_interface") { 44 sources = [ "ITimeService.idl" ] 45 sources_callback = [ "ITimerCallback.idl" ] 46 log_domainid = "0xD0001C41" 47 log_tag = "TimeClient" 48 subsystem_name = "time" 49 part_name = "time_service" 50} 51 52ohos_source_set("timeservice_proxy") { 53 configs = [ ":time_service_config" ] 54 sanitize = { 55 cfi = true 56 cfi_cross_dso = true 57 debug = false 58 } 59 output_values = get_target_outputs(":timeservice_interface") 60 sources = filter_include(output_values, [ "*callback_stub.cpp" ]) 61 sources += filter_include(output_values, [ "*service_proxy.cpp" ]) 62 63 deps = [ ":timeservice_interface" ] 64 external_deps = [ 65 "ability_runtime:wantagent_innerkits", 66 "hilog:libhilog", 67 "ipc:ipc_single", 68 "samgr:samgr_proxy", 69 ] 70 branch_protector_ret = "pac_ret" 71 subsystem_name = "time" 72 part_name = "time_service" 73} 74 75ohos_shared_library("time_system_ability") { 76 configs = [ "${time_utils_path}:utils_config" ] 77 configs += [ ":time_service_config" ] 78 configs += [ "//build/config/gcc:symbol_visibility_hidden" ] 79 sources = [ 80 "./time_system_ability.cpp", 81 "dfx/src/time_sysevent.cpp", 82 "time/src/event_manager.cpp", 83 "time/src/itimer_info.cpp", 84 "time/src/ntp_trusted_time.cpp", 85 "time/src/ntp_update_time.cpp", 86 "time/src/simple_timer_info.cpp", 87 "time/src/sntp_client.cpp", 88 "time/src/time_service_notify.cpp", 89 "time/src/time_tick_notify.cpp", 90 "time/src/time_zone_info.cpp", 91 "timer/src/batch.cpp", 92 "timer/src/cjson_helper.cpp", 93 "timer/src/timer_handler.cpp", 94 "timer/src/timer_info.cpp", 95 "timer/src/timer_manager.cpp", 96 "timer/src/timer_proxy.cpp", 97 ] 98 output_values = get_target_outputs(":timeservice_interface") 99 sources += filter_include(output_values, [ "*service_stub.cpp" ]) 100 sources += filter_include(output_values, [ "*callback_proxy.cpp" ]) 101 102 deps = [ 103 ":timeservice_interface", 104 "${time_utils_path}:time_utils", 105 ] 106 external_deps = [ 107 "ability_runtime:wantagent_innerkits", 108 "access_token:libaccesstoken_sdk", 109 "access_token:libtokenid_sdk", 110 "cJSON:cjson", 111 "common_event_service:cesfwk_innerkits", 112 "hilog:libhilog", 113 "hisysevent:libhisysevent", 114 "init:libbeget_proxy", 115 "ipc:ipc_single", 116 "safwk:system_ability_fwk", 117 "samgr:samgr_proxy", 118 ] 119 defines = [] 120 if (time_service_debug_able) { 121 defines += [ "DEBUG_ENABLE" ] 122 } 123 if (time_service_hidumper_able) { 124 defines += [ "HIDUMPER_ENABLE" ] 125 sources += [ 126 "dfx/src/time_cmd_dispatcher.cpp", 127 "dfx/src/time_cmd_parse.cpp", 128 ] 129 } 130 131 if (!is_emulator && time_service_set_auto_reboot) { 132 defines += [ "SET_AUTO_REBOOT_ENABLE" ] 133 } 134 135 if (time_service_multi_account) { 136 defines += [ "MULTI_ACCOUNT_ENABLE" ] 137 external_deps += [ "os_account:os_account_innerkits" ] 138 } 139 140 if (device_standby) { 141 external_deps += [ "device_standby:standby_innerkits" ] 142 defines += [ "DEVICE_STANDBY_ENABLE" ] 143 } 144 if (time_service_rdb_enable) { 145 defines += [ "RDB_ENABLE" ] 146 sources += [ "timer/src/timer_database.cpp" ] 147 external_deps += [ 148 "relational_store:native_dataability", 149 "relational_store:native_rdb", 150 ] 151 } 152 153 if (defined(global_parts_info) && 154 defined(global_parts_info.powermgr_power_manager)) { 155 external_deps += [ "power_manager:powermgr_client" ] 156 defines += [ "POWER_MANAGER_ENABLE" ] 157 } 158 159 branch_protector_ret = "pac_ret" 160 sanitize = { 161 ubsan = true 162 boundary_sanitize = true 163 cfi = true 164 cfi_cross_dso = true 165 debug = time_sanitize_debug 166 } 167 part_name = "time_service" 168 subsystem_name = "time" 169} 170 171ohos_static_library("time_system_ability_static") { 172 configs = [ "${time_utils_path}:utils_config" ] 173 configs += [ ":time_service_config" ] 174 configs += [ "//build/config/gcc:symbol_visibility_hidden" ] 175 sources = [ 176 "./time_system_ability.cpp", 177 "dfx/src/time_sysevent.cpp", 178 "time/src/event_manager.cpp", 179 "time/src/itimer_info.cpp", 180 "time/src/ntp_trusted_time.cpp", 181 "time/src/ntp_update_time.cpp", 182 "time/src/simple_timer_info.cpp", 183 "time/src/sntp_client.cpp", 184 "time/src/time_service_notify.cpp", 185 "time/src/time_tick_notify.cpp", 186 "time/src/time_zone_info.cpp", 187 "timer/src/batch.cpp", 188 "timer/src/cjson_helper.cpp", 189 "timer/src/timer_handler.cpp", 190 "timer/src/timer_info.cpp", 191 "timer/src/timer_manager.cpp", 192 "timer/src/timer_proxy.cpp", 193 ] 194 output_values = get_target_outputs(":timeservice_interface") 195 print("time_system_ability_static output_values:", output_values) 196 sources += filter_include(output_values, [ "*service_stub.cpp" ]) 197 sources += filter_include(output_values, [ "*callback_proxy.cpp" ]) 198 199 deps = [ 200 ":timeservice_interface", 201 "${time_utils_path}:time_utils", 202 ] 203 external_deps = [ 204 "ability_runtime:wantagent_innerkits", 205 "access_token:libaccesstoken_sdk", 206 "access_token:libtokenid_sdk", 207 "cJSON:cjson", 208 "common_event_service:cesfwk_innerkits", 209 "hilog:libhilog", 210 "hisysevent:libhisysevent", 211 "init:libbeget_proxy", 212 "ipc:ipc_single", 213 "safwk:system_ability_fwk", 214 "samgr:samgr_proxy", 215 ] 216 defines = [] 217 if (time_service_debug_able) { 218 defines += [ "DEBUG_ENABLE" ] 219 } 220 if (time_service_hidumper_able) { 221 defines += [ "HIDUMPER_ENABLE" ] 222 sources += [ 223 "dfx/src/time_cmd_dispatcher.cpp", 224 "dfx/src/time_cmd_parse.cpp", 225 ] 226 } 227 228 if (device_standby) { 229 external_deps += [ "device_standby:standby_innerkits" ] 230 defines += [ "DEVICE_STANDBY_ENABLE" ] 231 } 232 233 if (!is_emulator && time_service_set_auto_reboot) { 234 defines += [ "SET_AUTO_REBOOT_ENABLE" ] 235 } 236 237 if (time_service_multi_account) { 238 defines += [ "MULTI_ACCOUNT_ENABLE" ] 239 external_deps += [ "os_account:os_account_innerkits" ] 240 } 241 if (time_service_rdb_enable) { 242 defines += [ "RDB_ENABLE" ] 243 sources += [ "timer/src/timer_database.cpp" ] 244 external_deps += [ 245 "relational_store:native_dataability", 246 "relational_store:native_rdb", 247 ] 248 } 249 250 if (defined(global_parts_info) && 251 defined(global_parts_info.powermgr_power_manager)) { 252 external_deps += [ "power_manager:powermgr_client" ] 253 defines += [ "POWER_MANAGER_ENABLE" ] 254 } 255 256 branch_protector_ret = "pac_ret" 257 sanitize = { 258 ubsan = true 259 boundary_sanitize = true 260 cfi = true 261 cfi_cross_dso = true 262 debug = time_sanitize_debug 263 } 264 part_name = "time_service" 265 subsystem_name = "time" 266} 267