1# Copyright (c) 2021~2024 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("//foundation/communication/netmanager_base/netmanager_base_config.gni")
16
17group("common_target") {
18  deps = [
19    ":net_bundle_utils",
20    ":net_data_share",
21    ":net_manager_common",
22    "napi_utils:napi_utils",
23  ]
24}
25
26config("netmgr_common_config") {
27  include_dirs = [
28    "common_utils/include",
29    "log/include",
30    "errorcode_utils/include",
31    "$INNERKITS_ROOT/include",
32    "$INNERKITS_ROOT/netconnclient/include",
33    "$INNERKITS_ROOT/netpolicyclient/include",
34    "$INNERKITS_ROOT/netstatsclient/include",
35  ]
36
37  cflags = [
38    "-fstack-protector-strong",
39    "-D_FORTIFY_SOURCE=2",
40    "-O2",
41  ]
42
43  cflags_cc = [
44    "-fstack-protector-strong",
45    "-D_FORTIFY_SOURCE=2",
46    "-O2",
47  ]
48}
49
50ohos_shared_library("net_manager_common") {
51  sanitize = {
52    cfi = true
53    cfi_cross_dso = true
54    debug = false
55  }
56
57  branch_protector_ret = "pac_ret"
58
59  sources = [
60    "common_utils/src/base64_utils.cpp",
61    "common_utils/src/event_report.cpp",
62    "common_utils/src/netmanager_base_common_utils.cpp",
63    "common_utils/src/netmanager_base_permission.cpp",
64    "common_utils/src/netmanager_hitrace.cpp",
65    "common_utils/src/tiny_count_down_latch.cpp",
66    "errorcode_utils/src/errorcode_convertor.cpp",
67    "log/src/net_mgr_log_wrapper.cpp",
68  ]
69
70  defines = [
71    "NETMGR_LOG_TAG = \"NetMgrCommon\"",
72    "LOG_DOMAIN = 0xD0015B0",
73  ]
74
75  if (enable_netmgr_debug) {
76    defines += [ "NETMGR_DEBUG" ]
77  }
78
79  if (is_standard_system) {
80    defines += [ "STANDARD_SYSTEM_ENABLE" ]
81  }
82
83  public_configs = [ ":netmgr_common_config" ]
84
85  external_deps = [ "hilog:libhilog" ]
86
87  external_deps += [
88    "access_token:libaccesstoken_sdk",
89    "access_token:libtokenid_sdk",
90    "c_utils:utils",
91    "hisysevent:libhisysevent",
92    "hitrace:hitrace_meter",
93    "ipc:ipc_single",
94  ]
95
96  innerapi_tags = [ "platformsdk" ]
97  part_name = "netmanager_base"
98  subsystem_name = "communication"
99}
100
101config("netmgr_datashare_config") {
102  include_dirs = [
103    "data_share/include",
104    "log/include",
105    "$INNERKITS_ROOT/include",
106  ]
107
108  cflags = [
109    "-fstack-protector-strong",
110    "-D_FORTIFY_SOURCE=2",
111    "-O2",
112  ]
113
114  cflags_cc = [
115    "-fstack-protector-strong",
116    "-D_FORTIFY_SOURCE=2",
117    "-O2",
118  ]
119}
120
121ohos_shared_library("net_data_share") {
122  sanitize = {
123    cfi = true
124    cfi_cross_dso = true
125    debug = false
126  }
127
128  sources = [
129    "data_share/src/net_datashare_utils.cpp",
130    "data_share/src/net_datashare_utils_iface.cpp",
131  ]
132
133  defines = [
134    "NETMGR_LOG_TAG = \"NetMgrDataShare\"",
135    "LOG_DOMAIN = 0xD0015B0",
136  ]
137
138  if (enable_netmgr_debug) {
139    defines += [ "NETMGR_DEBUG" ]
140  }
141
142  if (is_standard_system) {
143    defines += [ "STANDARD_SYSTEM_ENABLE" ]
144  }
145
146  public_configs = [ ":netmgr_datashare_config" ]
147
148  external_deps = [
149    "ability_base:zuri",
150    "ability_runtime:dataobs_manager",
151    "c_utils:utils",
152    "data_share:datashare_common",
153    "data_share:datashare_consumer",
154    "hilog:libhilog",
155    "ipc:ipc_core",
156    "samgr:samgr_proxy",
157  ]
158
159  innerapi_tags = [ "platformsdk" ]
160  part_name = "netmanager_base"
161  subsystem_name = "communication"
162}
163
164ohos_shared_library("net_bundle_utils") {
165  sanitize = {
166    cfi = true
167    cfi_cross_dso = true
168    debug = false
169    blocklist = "./bundle_utils/net_bundle_utils_blocklist.txt"
170  }
171
172  include_dirs = [
173    "bundle_utils/include",
174    "log/include",
175    "$INNERKITS_ROOT/include",
176  ]
177
178  sources = [ "bundle_utils/src/net_bundle_impl.cpp" ]
179
180  defines = [
181    "NETMGR_LOG_TAG = \"NetMgrBundleUtils\"",
182    "LOG_DOMAIN = 0xD0015B0",
183  ]
184
185  if (enable_netmgr_debug) {
186    defines += [ "NETMGR_DEBUG" ]
187  }
188
189  if (is_standard_system) {
190    defines += [ "STANDARD_SYSTEM_ENABLE" ]
191  }
192
193  external_deps = [
194    "bundle_framework:appexecfwk_base",
195    "bundle_framework:appexecfwk_core",
196    "c_utils:utils",
197    "hilog:libhilog",
198    "ipc:ipc_core",
199    "samgr:samgr_proxy",
200  ]
201
202  innerapi_tags = [ "platformsdk" ]
203  part_name = "netmanager_base"
204  subsystem_name = "communication"
205}
206