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