• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//foundation/communication/netmanager_base/netmanager_base_config.gni")
16
17config("net_stats_manager_config") {
18  include_dirs = [
19    "$INNERKITS_ROOT/include",
20    "$INNERKITS_ROOT/netconnclient/include",
21    "$INNERKITS_ROOT/netmanagernative/include",
22    "$INNERKITS_ROOT/netstatsclient/include",
23    "$INNERKITS_ROOT/netstatsclient/include/proxy",
24    "$NETCONNMANAGER_COMMON_DIR/include",
25    "$NETMANAGER_BASE_ROOT/utils/log/include",
26    "include",
27    "include/stub",
28    "include/common",
29    "$NETSYSBPFMAP_SOURCE_DIR/include",
30    "$NETSYSCONTROLLER_ROOT_DIR/include",
31    "$NETSYSNATIVE_SOURCE_DIR/include/manager",
32    "$NETSYSNATIVE_SOURCE_DIR/include/netsys/wrapper",
33    "$SAMGR_MANAGER_ROOT/interfaces/innerkits/samgr_proxy/include",
34    "$NETMANAGER_BASE_ROOT/utils/common_utils/include",
35    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
36    "$NETMANAGER_BASE_ROOT/services/netmanagernative/bpf/include",
37  ]
38}
39
40ohos_shared_library("net_stats_manager") {
41  sanitize = {
42    cfi = true
43    cfi_cross_dso = true
44    boundary_sanitize = true
45    all_ubsan = true
46    debug = false
47  }
48
49  sources = [
50    "src/common/net_stats_service_common.cpp",
51    "src/net_stats_cached.cpp",
52    "src/net_stats_callback.cpp",
53    "src/net_stats_data_handler.cpp",
54    "src/net_stats_database_helper.cpp",
55    "src/net_stats_history.cpp",
56    "src/net_stats_listener.cpp",
57    "src/net_stats_service.cpp",
58    "src/net_stats_sqlite_statement.cpp",
59    "src/stub/net_stats_callback_proxy.cpp",
60    "src/stub/net_stats_service_stub.cpp",
61  ]
62
63  configs = [ ":net_stats_manager_config" ]
64
65  deps = [
66    "$INNERKITS_ROOT/netstatsclient:net_stats_parcel",
67    "$NETCONNMANAGER_COMMON_DIR:net_service_common",
68    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
69    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
70    "$THIRD_PARTY_ROOT/sqlite:sqlite",
71  ]
72
73  cflags = [
74    "-fvisibility=hidden",
75    "-fdata-sections",
76    "-ffunction-sections",
77    "-Os",
78    "-fstack-protector-strong",
79    "-D_FORTIFY_SOURCE=2",
80    "-O2",
81  ]
82
83  cflags_cc = [
84    "-fvisibility-inlines-hidden",
85    "-Os",
86    "-fstack-protector-strong",
87    "-D_FORTIFY_SOURCE=2",
88    "-O2",
89  ]
90
91  ldflags = [
92    "-Wl,--exclude-libs=ALL",
93    "-Wl,--gc-sections",
94  ]
95
96  external_deps = [
97    "ability_base:want",
98    "common_event_service:cesfwk_innerkits",
99    "hitrace:hitrace_meter",
100    "ipc:ipc_core",
101    "safwk:system_ability_fwk",
102  ]
103
104  defines = [
105    "USE_SQLITE_SYMBOLS",
106    "NETMGR_LOG_TAG = \"NetStatsClient\"",
107    "LOG_DOMAIN = 0xD0015B0",
108  ]
109
110  if (enable_netmgr_debug) {
111    defines += [ "NETMGR_DEBUG" ]
112  }
113
114  external_deps += [ "hilog:libhilog" ]
115
116  part_name = "netmanager_base"
117  subsystem_name = "communication"
118}
119
120ohos_static_library("net_stats_manager_static") {
121  testonly = true
122  sanitize = {
123    cfi = true
124    cfi_cross_dso = true
125    debug = false
126  }
127  sources = [
128    "src/common/net_stats_service_common.cpp",
129    "src/net_stats_cached.cpp",
130    "src/net_stats_callback.cpp",
131    "src/net_stats_data_handler.cpp",
132    "src/net_stats_database_helper.cpp",
133    "src/net_stats_history.cpp",
134    "src/net_stats_listener.cpp",
135    "src/net_stats_service.cpp",
136    "src/net_stats_sqlite_statement.cpp",
137    "src/stub/net_stats_callback_proxy.cpp",
138    "src/stub/net_stats_service_stub.cpp",
139  ]
140
141  configs = [ ":net_stats_manager_config" ]
142
143  deps = [
144    "$INNERKITS_ROOT/netstatsclient:net_stats_parcel",
145    "$NETCONNMANAGER_COMMON_DIR:net_service_common",
146    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
147    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
148    "$THIRD_PARTY_ROOT/sqlite:sqlite",
149  ]
150
151  external_deps = [
152    "ability_base:want",
153    "common_event_service:cesfwk_innerkits",
154    "hitrace:hitrace_meter",
155    "ipc:ipc_core",
156    "safwk:system_ability_fwk",
157  ]
158
159  defines = [
160    "USE_SQLITE_SYMBOLS",
161    "NETMGR_LOG_TAG = \"NetStatsClient\"",
162    "LOG_DOMAIN = 0xD0015B0",
163  ]
164
165  if (enable_netmgr_debug) {
166    defines += [ "NETMGR_DEBUG" ]
167  }
168
169  external_deps += [ "hilog:libhilog" ]
170
171  part_name = "netmanager_base"
172  subsystem_name = "communication"
173}
174