1# Copyright (c) 2021 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("../../../../dsoftbus.gni")
15
16native_source_path = rebase_path("$dsoftbus_root_path")
17lnn_dep_dir = "dsoftbus_enhance/core/bus_center/lnn/net_builder"
18enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py",
19                       [
20                         "$native_source_path",
21                         "$lnn_dep_dir",
22                       ],
23                       "value")
24
25if (dsoftbus_feature_lnn_net) {
26  bus_center_builder_src = [
27    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_battery_info.c",
28    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_connection_fsm.c",
29    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_net_builder.c",
30    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_net_builder_init.c",
31    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_net_builder_process.c",
32    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_node_weight.c",
33    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_p2p_info.c",
34    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_sync_info_manager.c",
35    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_topo_manager.c",
36    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_network_info.c",
37    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_devicename_info.c",
38    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_sync_item_info.c",
39  ]
40  if (!enhanced) {
41    bus_center_builder_src += [
42      "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_fast_offline_virtual.c",
43      "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_cipherkey_manager_virtual.c",
44      "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_device_info_recovery_virtual.c",
45      "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_ptk_info_virtual.c",
46      "$dsoftbus_root_path/core/bus_center/utils/src/lnn_secure_storage.c",
47    ]
48    bus_center_builder_inc = []
49  } else {
50    import(
51        "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/net_builder/cipherkey/cipherkey.gni")
52    import(
53        "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/net_builder/ptk/ptk.gni")
54
55    bus_center_builder_src += cipherkey_sources + ptk_sources
56    bus_center_builder_src += [
57      "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/net_builder/fast_online/lnn_device_info_recovery.c",
58      "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/net_builder/fast_online/lnn_secure_storage.c",
59    ]
60    bus_center_builder_inc =
61        [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/common/mlps/include" ]
62  }
63} else {
64  bus_center_builder_src = [
65    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_net_builder_virtual.c",
66    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_cipherkey_manager_virtual.c",
67    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_ptk_info_virtual.c",
68  ]
69}
70bus_center_builder_inc += [
71  "$dsoftbus_root_path/core/adapter/common/net/bluetooth/include",
72  "$dsoftbus_root_path/core/adapter/bus_center/include",
73  "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
74  "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
75  "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
76  "$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface",
77]
78bus_center_builder_deps = []
79
80if (dsoftbus_feature_lnn_net && enhanced) {
81  bus_center_builder_deps += [ "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/net_builder/fast_offline:fast_offline" ]
82}
83
84if (dsoftbus_feature_lnn_cloud_sync) {
85  bus_center_builder_src += [ "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_data_cloud_sync.c" ]
86  bus_center_builder_inc +=
87      [ "$dsoftbus_root_path/core/adapter/bus_center/include" ]
88} else {
89  bus_center_builder_src += [ "$dsoftbus_root_path/core/bus_center/lnn/net_builder/src/lnn_data_cloud_sync_virtual.c" ]
90}
91