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/ohos.gni") 15import("../../access_token.gni") 16 17ohos_prebuilt_etc("token_sync.rc") { 18 source = "token_sync.cfg" 19 relative_install_dir = "init" 20 subsystem_name = "security" 21 part_name = "access_token" 22} 23 24group("tokensyncmanager") { 25 if (is_standard_system && token_sync_enable == true) { 26 deps = [ 27 ":token_sync_manager_service", 28 "sa_profile:tokensync_sa_profile_standard", 29 ] 30 } 31} 32 33if (token_sync_enable == true) { 34 ohos_shared_library("token_sync_manager_service") { 35 subsystem_name = "security" 36 part_name = "access_token" 37 sanitize = { 38 cfi = true 39 cfi_cross_dso = true 40 debug = false 41 } 42 branch_protector_ret = "pac_ret" 43 44 if (!use_clang_coverage) { 45 version_script = "tokensync_manager_service.map" 46 shlib_type = "sa" 47 } 48 49 include_dirs = [ 50 "include/service", 51 "include/remote", 52 "include/command", 53 "include/common", 54 "include/device", 55 "include/protocol", 56 "${access_token_path}/frameworks/common/include", 57 "${access_token_path}/frameworks/accesstoken/include", 58 "${access_token_path}/frameworks/tokensync/include", 59 "${access_token_path}/interfaces/innerkits/accesstoken/include", 60 "${access_token_path}/interfaces/innerkits/tokensync/include", 61 "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", 62 "${access_token_path}/frameworks/json_adapter/include", 63 "${access_token_path}/services/common/json_parse/include", 64 "${access_token_path}/services/common/handler/include", 65 "${access_token_path}/services/common/libraryloader/include", 66 ] 67 68 sources = [ 69 "src/command/base_remote_command.cpp", 70 "src/command/delete_remote_token_command.cpp", 71 "src/command/sync_remote_hap_token_command.cpp", 72 "src/command/update_remote_hap_token_command.cpp", 73 "src/common/constant.cpp", 74 "src/device/device_info_manager.cpp", 75 "src/device/device_info_repository.cpp", 76 "src/remote/remote_command_executor.cpp", 77 "src/remote/remote_command_factory.cpp", 78 "src/remote/remote_command_manager.cpp", 79 "src/remote/soft_bus_channel.cpp", 80 "src/remote/soft_bus_device_connection_listener.cpp", 81 "src/remote/soft_bus_manager.cpp", 82 "src/remote/soft_bus_socket_listener.cpp", 83 "src/service/token_sync_manager_service.cpp", 84 "src/service/token_sync_manager_stub.cpp", 85 ] 86 87 cflags_cc = [ 88 "-DHILOG_ENABLE", 89 "-DDEBUG_API_PERFORMANCE", 90 "-fvisibility=hidden", 91 ] 92 93 if (build_variant == "user") { 94 cflags_cc += [ "-DATM_BUILD_VARIANT_USER_ENABLE" ] 95 } 96 97 configs = [ 98 "${access_token_path}/config:access_token_compile_flags", 99 "${access_token_path}/config:coverage_flags", 100 ] 101 102 deps = [ 103 "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx", 104 "${access_token_path}/frameworks/common:accesstoken_common_cxx", 105 "${access_token_path}/frameworks/json_adapter:accesstoken_cjson_utils", 106 "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", 107 "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", 108 "${access_token_path}/services/common:accesstoken_service_common", 109 "${access_token_path}/services/tokensyncmanager:token_sync.rc", 110 ] 111 112 external_deps = [ 113 "cJSON:cjson", 114 "c_utils:utils", 115 "dsoftbus:softbus_client", 116 "hilog:libhilog", 117 "ipc:ipc_single", 118 "safwk:system_ability_fwk", 119 "samgr:samgr_proxy", 120 "zlib:shared_libz", 121 ] 122 123 if (ohos_indep_compiler_enable) { 124 external_deps += [ "bounds_checking_function:libsec_shared" ] 125 } 126 127 if (eventhandler_enable == true) { 128 cflags_cc += [ "-DEVENTHANDLER_ENABLE" ] 129 external_deps += [ "eventhandler:libeventhandler" ] 130 } 131 132 if (token_sync_enable == true) { 133 cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ] 134 external_deps += [ "device_manager:devicemanagersdk" ] 135 } 136 137 if (memory_manager_enable == true) { 138 cflags_cc += [ "-DMEMORY_MANAGER_ENABLE" ] 139 external_deps += [ "memmgr:memmgrclient" ] 140 } 141 } 142} 143