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("//build/test.gni")
15import("../../../../../../dsoftbus.gni")
16
17module_output_path = "dsoftbus/transmission"
18dsoftbus_root_path = "../../../../../.."
19
20if (defined(ohos_lite)) {
21  executable("dsoftbus_app_dfile") {
22    sources = [ "dsoftbus_app_dfile.c" ]
23    include_dirs = [
24      "../../../../../../interfaces/kits/common",
25      "../../../../../../interfaces/kits/bus_center",
26      "../../../../../../interfaces/kits/common",
27      "$dsoftbus_root_path/interfaces/kits/transport",
28      "$dsoftbus_root_path//core/common/include",
29      "//third_party/bounds_checking_function/include",
30    ]
31    deps = [
32      "$dsoftbus_root_path/core/common:softbus_utils",
33      "$dsoftbus_root_path/tests/sdk:softbus_client_static",
34      "//third_party/bounds_checking_function:libsec_shared",
35    ]
36  }
37} else {
38  import("//build/ohos.gni")
39
40  ###########################palTest###########################
41  ohos_executable("dsoftbus_app_dfile") {
42    sanitize = {
43      cfi = true
44      cfi_cross_dso = true
45      debug = false
46    }
47    branch_protector_ret = "pac_ret"
48
49    install_enable = true
50    sources = [ "dsoftbus_app_dfile.cpp" ]
51
52    include_dirs = [
53      "../../../../../../interfaces/kits/common",
54      "../../../../../../interfaces/kits/bus_center",
55      "../../../../../../interfaces/kits/common",
56      "$dsoftbus_root_path/interfaces/kits/transport",
57    ]
58
59    deps = [
60      "$dsoftbus_root_path/core/common:softbus_utils",
61      "$dsoftbus_root_path/tests/sdk:softbus_client_static",
62    ]
63
64    if (is_standard_system) {
65      external_deps = [
66        "c_utils:utils",
67        "hilog:libhilog",
68      ]
69      part_name = "dsoftbus"
70    }
71    subsystem_name = "communication"
72  }
73
74  ohos_unittest("TransSdkFileTest") {
75    module_out_path = module_output_path
76    sources = [ "trans_sdk_file_test.cpp" ]
77
78    include_dirs = [
79      "$dsoftbus_root_path/interfaces/kits/transport",
80      "dsoftbus_root_path/sdk/transmission/trans_channel/udp/stream/include",
81      "dsoftbus_root_path/sdk/transmission/trans_channel/udp/stream/src",
82      "$dsoftbus_root_path/sdk/transmission/session/cpp/include",
83      "$dsoftbus_root_path/sdk/transmission/trans_channel/statistics/include",
84      "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/include",
85      "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/src",
86      "$dsoftbus_root_path/sdk/transmission/session/include",
87      "$dsoftbus_root_path/adapter/common/include",
88      "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/core",
89      "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/include",
90      "$dsoftbus_root_path/core/common/include",
91      "$dsoftbus_root_path/adapter/common/include/OS_adapter_define/linux",
92      "$dsoftbus_root_path/adapter/common/include",
93      "$dsoftbus_root_path/components/nstackx/nstackx_util/interface",
94      "$dsoftbus_root_path/interfaces/kits/transport",
95      "$dsoftbus_root_path/core/transmission/trans_channel/udp_negotiation/include",
96      "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/stream/include",
97      "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/src",
98      "$dsoftbus_root_path/sdk/transmission/ipc/include",
99      "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface",
100      "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/core",
101    ]
102
103    deps = [
104      "$dsoftbus_root_path/core/common:softbus_utils",
105      "$dsoftbus_root_path/core/frame:softbus_server",
106      "$dsoftbus_root_path/tests/sdk:softbus_client_static",
107    ]
108
109    native_source_path = rebase_path("$dsoftbus_root_path")
110    dep_file = "components/nstackx_enhanced/nstackx_core/dfile/BUILD.gn"
111    enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py",
112                           [
113                             "$native_source_path",
114                             "$dep_file",
115                           ],
116                           "value")
117
118    if (enhanced) {
119      deps += [ "$dsoftbus_root_path/components/nstackx_enhanced/nstackx_core/dfile:nstackx_dfile" ]
120    } else {
121      deps += [ "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile:nstackx_dfile.open" ]
122    }
123
124    external_deps = [
125      "bounds_checking_function:libsec_static",
126      "c_utils:utils",
127      "hilog:libhilog",
128    ]
129  }
130
131  group("unittest") {
132    testonly = true
133    deps = [ ":TransSdkFileTest" ]
134  }
135}
136