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}/services/accesstokenmanager/main/cpp/include/token",
61      "${access_token_path}/services/common/config_policy/include",
62      "${access_token_path}/services/common/handler/include",
63      "${access_token_path}/services/common/libraryloader/include",
64    ]
65
66    sources = [
67      "src/command/base_remote_command.cpp",
68      "src/command/delete_remote_token_command.cpp",
69      "src/command/sync_remote_hap_token_command.cpp",
70      "src/command/update_remote_hap_token_command.cpp",
71      "src/common/constant.cpp",
72      "src/device/device_info_manager.cpp",
73      "src/device/device_info_repository.cpp",
74      "src/remote/remote_command_executor.cpp",
75      "src/remote/remote_command_factory.cpp",
76      "src/remote/remote_command_manager.cpp",
77      "src/remote/soft_bus_channel.cpp",
78      "src/remote/soft_bus_device_connection_listener.cpp",
79      "src/remote/soft_bus_manager.cpp",
80      "src/remote/soft_bus_socket_listener.cpp",
81      "src/service/token_sync_manager_service.cpp",
82      "src/service/token_sync_manager_stub.cpp",
83    ]
84
85    cflags_cc = [
86      "-DHILOG_ENABLE",
87      "-DDEBUG_API_PERFORMANCE",
88      "-fvisibility=hidden",
89    ]
90
91    if (build_variant == "user") {
92      cflags_cc += [ "-DATM_BUILD_VARIANT_USER_ENABLE" ]
93    }
94
95    configs = [
96      "${access_token_path}/config:access_token_compile_flags",
97      "${access_token_path}/config:coverage_flags",
98    ]
99
100    deps = [
101      "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx",
102      "${access_token_path}/frameworks/common:accesstoken_common_cxx",
103      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
104      "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
105      "${access_token_path}/services/common:accesstoken_service_common",
106      "${access_token_path}/services/tokensyncmanager:token_sync.rc",
107    ]
108
109    external_deps = [
110      "c_utils:utils",
111      "dsoftbus:softbus_client",
112      "hilog:libhilog",
113      "ipc:ipc_single",
114      "json:nlohmann_json_static",
115      "safwk:system_ability_fwk",
116      "samgr:samgr_proxy",
117      "zlib:shared_libz",
118    ]
119
120    if (ohos_indep_compiler_enable) {
121      external_deps += [ "bounds_checking_function:libsec_shared" ]
122    }
123
124    if (eventhandler_enable == true) {
125      cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
126      external_deps += [ "eventhandler:libeventhandler" ]
127    }
128
129    if (token_sync_enable == true) {
130      cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ]
131      external_deps += [ "device_manager:devicemanagersdk" ]
132    }
133  }
134}
135