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("../../../core/adapter/core_adapter.gni") 16import("../../../core/authentication/authentication.gni") 17import("../../../core/broadcast/broadcast.gni") 18import("../../../core/bus_center/bus_center_server.gni") 19import("../../../core/common/security/permission/permission.gni") 20import("../../../core/connection/conn.gni") 21import("../../../core/discovery/disc.gni") 22import("../../../core/transmission/trans.gni") 23import("../../../dsoftbus.gni") 24 25dsoftbus_root_path = "../../.." 26dsoftbus_feature_product_config_path = 27 "${dsoftbus_root_path}/adapter/default_config" 28softbus_adapter_config = "${dsoftbus_root_path}/adapter/default_config" 29 30dsoftbus_server_common_src = 31 auth_server_src + bus_center_server_src + conn_manager_src + 32 disc_server_src + trans_session_src + softbus_permission_src + broadcast_src 33dsoftbus_server_common_inc = 34 auth_server_inc + bus_center_server_inc + conn_manager_inc + 35 disc_server_inc + trans_session_inc + softbus_permission_inc + broadcast_inc 36dsoftbus_server_common_deps = 37 auth_server_deps + bus_center_server_deps + disc_server_deps + 38 conn_manager_common_deps + trans_session_deps + softbus_permission_deps + 39 broadcast_deps 40 41config("softbus_frame_test_config") { 42 include_dirs = [ 43 "$dsoftbus_root_path/service/softbus_server/include", 44 "$dsoftbus_root_path/core/common/inner_communication", 45 "$dsoftbus_root_path/core/common/include", 46 "$dsoftbus_root_path/sdk/frame/include", 47 ] 48} 49 50ohos_executable("softbus_test") { 51 sanitize = { 52 cfi = true 53 cfi_cross_dso = true 54 debug = false 55 } 56 branch_protector_ret = "pac_ret" 57 58 install_enable = true 59 sources = [ "softbus_test.c" ] 60 configs = [ ":softbus_frame_test_config" ] 61 62 if (is_standard_system) { 63 defines += [ "STANDARD_SYSTEM_ENABLE" ] 64 65 deps = [ "$dsoftbus_root_path/tests/sdk:softbus_client_static" ] 66 part_name = "softbus_L2" 67 } 68 subsystem_name = "communication" 69} 70 71copy("softbus_permission_json_test") { 72 sources = [ "$dsoftbus_core_path/common/security/permission/softbus_trans_permission.json" ] 73 outputs = [ "$root_out_dir/etc/softbus_trans_permission.json" ] 74} 75 76copy("softbus_server.rc.test") { 77 if (use_musl) { 78 sources = [ "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server_musl.cfg" ] 79 outputs = [ "$root_out_dir/etc/softbus_server_musl.cfg" ] 80 } else { 81 sources = [ 82 "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server.cfg", 83 ] 84 outputs = [ "$root_out_dir/etc/softbus_server.cfg" ] 85 } 86} 87 88ohos_static_library("softbus_server_static") { 89 sanitize = { 90 cfi = true 91 cfi_cross_dso = true 92 debug = false 93 } 94 branch_protector_ret = "pac_ret" 95 96 defines += AUTH_SERVER_DEFINES 97 defines += DISC_SERVER_DEFINES 98 defines += [ "__STDC_FORMAT_MACROS" ] 99 include_dirs = dsoftbus_server_common_inc 100 include_dirs += [ 101 "$dsoftbus_dfx_path/interface/include", 102 "$dsoftbus_root_path/core/frame/common/include", 103 "$dsoftbus_root_path/core/frame/$os_type/client_manager/include", 104 "$dsoftbus_root_path/core/frame/$os_type/init/include", 105 "$dsoftbus_root_path/core/common/include", 106 "$dsoftbus_root_path/interfaces/inner_kits/lnn", 107 "$dsoftbus_root_path/interfaces/kits/bus_center", 108 "$dsoftbus_root_path/interfaces/kits/common", 109 "$dsoftbus_root_path/interfaces/kits/transport", 110 "$dsoftbus_root_path/core/common/include", 111 "$dsoftbus_feature_product_config_path/spec_config", 112 ] 113 sources = dsoftbus_server_common_src 114 sources += [ 115 "$dsoftbus_root_path/core/frame/$os_type/client_manager/src/softbus_client_info_manager.cpp", 116 "$dsoftbus_root_path/core/frame/$os_type/init/src/if_softbus_server.cpp", 117 "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server.cpp", 118 "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server_death_recipient.cpp", 119 "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server_stub.cpp", 120 "$dsoftbus_root_path/core/frame/common/src/softbus_server_frame.c", 121 "$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp", 122 ] 123 deps = dsoftbus_server_common_deps 124 deps += [ 125 ":softbus_permission_json_test", 126 ":softbus_server.rc.test", 127 "$dsoftbus_dfx_path/dumper/legacy:softbus_dfx_dump", 128 "$dsoftbus_root_path/adapter:softbus_adapter", 129 "$dsoftbus_root_path/core/common:softbus_utils", 130 "$dsoftbus_root_path/core/connection/wifi_direct_cpp:wifi_direct", 131 ] 132 external_deps = [ "cJSON:cjson" ] 133 external_deps += auth_server_ex_deps 134 public_deps = [ "$dsoftbus_dfx_path:softbus_dfx" ] 135 dsoftbus_server_common_external_deps = 136 bus_center_server_external_deps + disc_server_external_deps + 137 softbus_permission_external_deps + trans_session_external_deps + 138 conn_manager_external_deps 139 if (is_standard_system) { 140 external_deps += dsoftbus_server_common_external_deps 141 external_deps += [ 142 "device_auth:deviceauth_sdk", 143 "hilog:libhilog", 144 "ipc:ipc_single", 145 "kv_store:distributeddata_inner", 146 "netmanager_base:net_conn_manager_if", 147 "safwk:system_ability_fwk", 148 "samgr:samgr_proxy", 149 ] 150 if (dsoftbus_access_token_feature) { 151 external_deps += [ 152 "access_token:libaccesstoken_sdk", 153 "access_token:libprivacy_sdk", 154 "access_token:libtokenid_sdk", 155 ] 156 } 157 if (!defined(global_parts_info) || 158 defined(global_parts_info.deviceprofile_device_info_manager)) { 159 external_deps += [ 160 "device_info_manager:distributed_device_profile_common", 161 "device_info_manager:distributed_device_profile_sdk", 162 ] 163 } 164 if (!defined(global_parts_info) || 165 defined(global_parts_info.bundlemanager_bundle_framework)) { 166 external_deps += [ 167 "bundle_framework:appexecfwk_base", 168 "bundle_framework:appexecfwk_core", 169 ] 170 cflags = [ "-DSUPPORT_BUNDLENAME" ] 171 } 172 if (!defined(global_parts_info) || 173 defined(global_parts_info.ability_ability_runtime)) { 174 cflags += [ "-DSUPPORT_ABILITY_RUNTIME" ] 175 } 176 if (enhanced) { 177 cflags += [ "-DENHANCED_FLAG" ] 178 external_deps += [ 179 "device_certificate_manager:device_cert_mgr_sdk", 180 "zlib:libz", 181 ] 182 } 183 } 184 if (defined(global_parts_info) && 185 defined(global_parts_info.hmoshiviewdfx_hiview_xcommradar_plugin)) { 186 include_dirs += [ 187 "$dsoftbus_root_path/../../../vendor/huawei/base/hiviewdfx/hiview_plugins/communication_radar_plugin/interfaces/inner_api/communication_radar", 188 "$dsoftbus_dfx_path/statistics/include", 189 ] 190 sources += [ 191 "$dsoftbus_dfx_path/statistics/instant/bt_statistic.cpp", 192 "$dsoftbus_dfx_path/statistics/instant/instant_statistics.cpp", 193 "$dsoftbus_dfx_path/statistics/instant/wifi_statistic.cpp", 194 ] 195 external_deps += [ "hiview_xcommradar_plugin:communication_radar_client" ] 196 } else { 197 sources += [ 198 "$dsoftbus_dfx_path/statistics/instant/instant_statistics_virtual.cpp", 199 ] 200 } 201 part_name = "dsoftbus" 202 subsystem_name = "communication" 203} 204 205group("unittest") { 206 testonly = true 207 deps = [ "unittest:unittest" ] 208} 209 210group("fuzztest") { 211 testonly = true 212 deps = [ "fuzztest:fuzztest" ] 213} 214