1fc0b0055Sopenharmony_ci# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
2fc0b0055Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3fc0b0055Sopenharmony_ci# you may not use this file except in compliance with the License.
4fc0b0055Sopenharmony_ci# You may obtain a copy of the License at
5fc0b0055Sopenharmony_ci#
6fc0b0055Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7fc0b0055Sopenharmony_ci#
8fc0b0055Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9fc0b0055Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10fc0b0055Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11fc0b0055Sopenharmony_ci# See the License for the specific language governing permissions and
12fc0b0055Sopenharmony_ci# limitations under the License.
13fc0b0055Sopenharmony_ci
14fc0b0055Sopenharmony_ciimport("//build/ohos.gni")
15fc0b0055Sopenharmony_ciimport("../../access_token.gni")
16fc0b0055Sopenharmony_ci
17fc0b0055Sopenharmony_ciohos_prebuilt_etc("token_sync.rc") {
18fc0b0055Sopenharmony_ci  source = "token_sync.cfg"
19fc0b0055Sopenharmony_ci  relative_install_dir = "init"
20fc0b0055Sopenharmony_ci  subsystem_name = "security"
21fc0b0055Sopenharmony_ci  part_name = "access_token"
22fc0b0055Sopenharmony_ci}
23fc0b0055Sopenharmony_ci
24fc0b0055Sopenharmony_cigroup("tokensyncmanager") {
25fc0b0055Sopenharmony_ci  if (is_standard_system && token_sync_enable == true) {
26fc0b0055Sopenharmony_ci    deps = [
27fc0b0055Sopenharmony_ci      ":token_sync_manager_service",
28fc0b0055Sopenharmony_ci      "sa_profile:tokensync_sa_profile_standard",
29fc0b0055Sopenharmony_ci    ]
30fc0b0055Sopenharmony_ci  }
31fc0b0055Sopenharmony_ci}
32fc0b0055Sopenharmony_ci
33fc0b0055Sopenharmony_ciif (token_sync_enable == true) {
34fc0b0055Sopenharmony_ci  ohos_shared_library("token_sync_manager_service") {
35fc0b0055Sopenharmony_ci    subsystem_name = "security"
36fc0b0055Sopenharmony_ci    part_name = "access_token"
37fc0b0055Sopenharmony_ci    sanitize = {
38fc0b0055Sopenharmony_ci      cfi = true
39fc0b0055Sopenharmony_ci      cfi_cross_dso = true
40fc0b0055Sopenharmony_ci      debug = false
41fc0b0055Sopenharmony_ci    }
42fc0b0055Sopenharmony_ci    branch_protector_ret = "pac_ret"
43fc0b0055Sopenharmony_ci
44fc0b0055Sopenharmony_ci    if (!use_clang_coverage) {
45fc0b0055Sopenharmony_ci      version_script = "tokensync_manager_service.map"
46fc0b0055Sopenharmony_ci      shlib_type = "sa"
47fc0b0055Sopenharmony_ci    }
48fc0b0055Sopenharmony_ci
49fc0b0055Sopenharmony_ci    include_dirs = [
50fc0b0055Sopenharmony_ci      "include/service",
51fc0b0055Sopenharmony_ci      "include/remote",
52fc0b0055Sopenharmony_ci      "include/command",
53fc0b0055Sopenharmony_ci      "include/common",
54fc0b0055Sopenharmony_ci      "include/device",
55fc0b0055Sopenharmony_ci      "include/protocol",
56fc0b0055Sopenharmony_ci      "${access_token_path}/frameworks/common/include",
57fc0b0055Sopenharmony_ci      "${access_token_path}/frameworks/accesstoken/include",
58fc0b0055Sopenharmony_ci      "${access_token_path}/frameworks/tokensync/include",
59fc0b0055Sopenharmony_ci      "${access_token_path}/interfaces/innerkits/accesstoken/include",
60fc0b0055Sopenharmony_ci      "${access_token_path}/services/accesstokenmanager/main/cpp/include/token",
61fc0b0055Sopenharmony_ci      "${access_token_path}/services/common/config_policy/include",
62fc0b0055Sopenharmony_ci      "${access_token_path}/services/common/handler/include",
63fc0b0055Sopenharmony_ci      "${access_token_path}/services/common/libraryloader/include",
64fc0b0055Sopenharmony_ci    ]
65fc0b0055Sopenharmony_ci
66fc0b0055Sopenharmony_ci    sources = [
67fc0b0055Sopenharmony_ci      "src/command/base_remote_command.cpp",
68fc0b0055Sopenharmony_ci      "src/command/delete_remote_token_command.cpp",
69fc0b0055Sopenharmony_ci      "src/command/sync_remote_hap_token_command.cpp",
70fc0b0055Sopenharmony_ci      "src/command/update_remote_hap_token_command.cpp",
71fc0b0055Sopenharmony_ci      "src/common/constant.cpp",
72fc0b0055Sopenharmony_ci      "src/device/device_info_manager.cpp",
73fc0b0055Sopenharmony_ci      "src/device/device_info_repository.cpp",
74fc0b0055Sopenharmony_ci      "src/remote/remote_command_executor.cpp",
75fc0b0055Sopenharmony_ci      "src/remote/remote_command_factory.cpp",
76fc0b0055Sopenharmony_ci      "src/remote/remote_command_manager.cpp",
77fc0b0055Sopenharmony_ci      "src/remote/soft_bus_channel.cpp",
78fc0b0055Sopenharmony_ci      "src/remote/soft_bus_device_connection_listener.cpp",
79fc0b0055Sopenharmony_ci      "src/remote/soft_bus_manager.cpp",
80fc0b0055Sopenharmony_ci      "src/remote/soft_bus_socket_listener.cpp",
81fc0b0055Sopenharmony_ci      "src/service/token_sync_manager_service.cpp",
82fc0b0055Sopenharmony_ci      "src/service/token_sync_manager_stub.cpp",
83fc0b0055Sopenharmony_ci    ]
84fc0b0055Sopenharmony_ci
85fc0b0055Sopenharmony_ci    cflags_cc = [
86fc0b0055Sopenharmony_ci      "-DHILOG_ENABLE",
87fc0b0055Sopenharmony_ci      "-DDEBUG_API_PERFORMANCE",
88fc0b0055Sopenharmony_ci      "-fvisibility=hidden",
89fc0b0055Sopenharmony_ci    ]
90fc0b0055Sopenharmony_ci
91fc0b0055Sopenharmony_ci    if (build_variant == "user") {
92fc0b0055Sopenharmony_ci      cflags_cc += [ "-DATM_BUILD_VARIANT_USER_ENABLE" ]
93fc0b0055Sopenharmony_ci    }
94fc0b0055Sopenharmony_ci
95fc0b0055Sopenharmony_ci    configs = [
96fc0b0055Sopenharmony_ci      "${access_token_path}/config:access_token_compile_flags",
97fc0b0055Sopenharmony_ci      "${access_token_path}/config:coverage_flags",
98fc0b0055Sopenharmony_ci    ]
99fc0b0055Sopenharmony_ci
100fc0b0055Sopenharmony_ci    deps = [
101fc0b0055Sopenharmony_ci      "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx",
102fc0b0055Sopenharmony_ci      "${access_token_path}/frameworks/common:accesstoken_common_cxx",
103fc0b0055Sopenharmony_ci      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
104fc0b0055Sopenharmony_ci      "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
105fc0b0055Sopenharmony_ci      "${access_token_path}/services/common:accesstoken_service_common",
106fc0b0055Sopenharmony_ci      "${access_token_path}/services/tokensyncmanager:token_sync.rc",
107fc0b0055Sopenharmony_ci    ]
108fc0b0055Sopenharmony_ci
109fc0b0055Sopenharmony_ci    external_deps = [
110fc0b0055Sopenharmony_ci      "c_utils:utils",
111fc0b0055Sopenharmony_ci      "dsoftbus:softbus_client",
112fc0b0055Sopenharmony_ci      "hilog:libhilog",
113fc0b0055Sopenharmony_ci      "ipc:ipc_single",
114fc0b0055Sopenharmony_ci      "json:nlohmann_json_static",
115fc0b0055Sopenharmony_ci      "safwk:system_ability_fwk",
116fc0b0055Sopenharmony_ci      "samgr:samgr_proxy",
117fc0b0055Sopenharmony_ci      "zlib:shared_libz",
118fc0b0055Sopenharmony_ci    ]
119fc0b0055Sopenharmony_ci
120fc0b0055Sopenharmony_ci    if (ohos_indep_compiler_enable) {
121fc0b0055Sopenharmony_ci      external_deps += [ "bounds_checking_function:libsec_shared" ]
122fc0b0055Sopenharmony_ci    }
123fc0b0055Sopenharmony_ci
124fc0b0055Sopenharmony_ci    if (eventhandler_enable == true) {
125fc0b0055Sopenharmony_ci      cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
126fc0b0055Sopenharmony_ci      external_deps += [ "eventhandler:libeventhandler" ]
127fc0b0055Sopenharmony_ci    }
128fc0b0055Sopenharmony_ci
129fc0b0055Sopenharmony_ci    if (token_sync_enable == true) {
130fc0b0055Sopenharmony_ci      cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ]
131fc0b0055Sopenharmony_ci      external_deps += [ "device_manager:devicemanagersdk" ]
132fc0b0055Sopenharmony_ci    }
133fc0b0055Sopenharmony_ci  }
134fc0b0055Sopenharmony_ci}
135