1# Copyright (c) 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_ext/netmanager_ext_config.gni")
16
17config("net_vpn_extension_if_config") {
18  visibility = [ ":*" ]
19  include_dirs = [
20    "include",
21    "include/ipc",
22    "$BASE_INNERKITS_ROOT/include",
23    "$BASE_INNERKITS_ROOT/netconnclient/include",
24    "$BASE_INNERKITS_ROOT/netmanagernative/include",
25    "$NETMANAGERNATIVE_ROOT/fwmarkclient/include",
26    "$EXT_INNERKITS_ROOT/include",
27    "$NETMANAGER_EXT_ROOT/utils/log/include",
28    "$ABILITY_RUNTIME_SERVICES_PATH/common/include",
29    "$ABILITY_RUNTIME_NAPI_PATH/inner/napi_common",
30    "$ABILITY_RUNTIME_INNER_API_PATH/dataobs_manager/include",
31    "$ABILITY_RUNTIME_INNER_API_PATH/runtime/include",
32    "$ABILITY_RUNTIME_KITS_PATH/native/appkit/ability_runtime",
33    "$ABILITY_RUNTIME_KITS_PATH/native/ability/ability_runtime",
34    "$ABILITY_RUNTIME_KITS_PATH/native/ability/native",
35    "$ABILITY_DISPLAY_MANAGER/interfaces/innerkits/dm",
36  ]
37
38  defines = []
39  if (is_double_framework) {
40    defines += [ "CONFIG_DUAL_FRAMEWORK" ]
41  }
42  if (target_cpu == "arm") {
43    defines += [ "BINDER_IPC_32BIT" ]
44  }
45  if (is_standard_system) {
46    defines += [ "CONFIG_STANDARD_SYSTEM" ]
47  }
48  if (defined(build_public_version) && build_public_version) {
49    defines += [ "BUILD_PUBLIC_VERSION" ]
50  }
51}
52
53ohos_shared_library("vpn_extension") {
54  sanitize = {
55    cfi = true
56    cfi_cross_dso = true
57    debug = false
58  }
59
60  branch_protector_ret = "pac_ret"
61
62  sources = [
63    "$ABILITY_RUNTIME_PATH/frameworks/native/ability/native/ability_business_error/ability_business_error.cpp",
64    "$VPN_EXTENSION_SOURCE_DIR/src/js_vpn_extension.cpp",
65    "$VPN_EXTENSION_SOURCE_DIR/src/js_vpn_extension_context.cpp",
66    "$VPN_EXTENSION_SOURCE_DIR/src/vpn_extension.cpp",
67    "$VPN_EXTENSION_SOURCE_DIR/src/vpn_extension_context.cpp",
68  ]
69  configs = [ ":net_vpn_extension_if_config" ]
70  public_configs = [ ":net_vpn_extension_if_config" ]
71
72  include_dirs = [
73    "$BASE_INNERKITS_ROOT/include",
74    "$BASE_INNERKITS_ROOT/netconnclient/include",
75    "$EXT_INNERKITS_ROOT/include",
76    "$NETMANAGER_EXT_ROOT/utils/log/include",
77    "$BASE_INNERKITS_ROOT/netvpnclient/include",
78    "${ABILITY_RUNTIME_PATH}/interfaces/kits/native/ability/native",
79    "$NETMANAGER_BASE_ROOT/utils/napi_utils/include",
80  ]
81
82  deps = [
83    "$NETMANAGER_EXT_ROOT/interfaces/innerkits/netvpnclient:net_vpn_manager_if",
84    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
85  ]
86
87  external_deps = [
88    "ability_base:configuration",
89    "ability_base:want",
90    "ability_runtime:ability_connect_callback_stub",
91    "ability_runtime:ability_context_native",
92    "ability_runtime:ability_manager",
93    "ability_runtime:abilitykit_native",
94    "ability_runtime:app_context",
95    "ability_runtime:dataobs_manager",
96    "ability_runtime:extensionkit_native",
97    "ability_runtime:napi_common",
98    "ability_runtime:runtime",
99    "access_token:libaccesstoken_sdk",
100    "access_token:libtokenid_sdk",
101    "c_utils:utils",
102    "common_event_service:cesfwk_innerkits",
103    "eventhandler:libeventhandler",
104    "hilog:libhilog",
105    "hitrace:hitrace_meter",
106    "ipc:ipc_core",
107    "ipc:ipc_napi",
108    "ipc:ipc_single",
109    "napi:ace_napi",
110    "netmanager_base:fwmark_client",
111    "netmanager_base:napi_utils",
112    "netmanager_base:net_conn_parcel",
113    "netmanager_base:net_manager_common",
114    "safwk:system_ability_fwk",
115    "samgr:samgr_proxy",
116    "window_manager:libdm",
117    "window_manager:libwm",
118  ]
119
120  defines = [
121    "NETMGR_LOG_TAG = \"NetworkVpn\"",
122    "LOG_DOMAIN = 0xD0015B0",
123  ]
124
125  if (enable_netmgr_ext_debug) {
126    defines += [ "NETMGR_DEBUG" ]
127  }
128
129  part_name = "netmanager_ext"
130  subsystem_name = "communication"
131}
132
133ohos_shared_library("vpn_extension_module") {
134  sanitize = {
135    cfi = true
136    cfi_cross_dso = true
137    debug = false
138  }
139
140  branch_protector_ret = "pac_ret"
141
142  include_dirs =
143      [ "$VPN_EXTENSION_SOURCE_DIR/interfaces/innerkits/vpnextension" ]
144
145  sources = [ "$VPN_EXTENSION_SOURCE_DIR/src/vpn_extension_module_loader.cpp" ]
146
147  configs = [ ":net_vpn_extension_if_config" ]
148  public_configs = [ ":net_vpn_extension_if_config" ]
149
150  deps = [ ":vpn_extension" ]
151
152  external_deps = [
153    "ability_base:configuration",
154    "ability_base:session_info",
155    "ability_runtime:abilitykit_native",
156    "ability_runtime:runtime",
157    "bundle_framework:appexecfwk_base",
158    "bundle_framework:appexecfwk_core",
159    "c_utils:utils",
160    "hilog:libhilog",
161    "napi:ace_napi",
162  ]
163
164  relative_install_dir = "extensionability/"
165  part_name = "netmanager_ext"
166  subsystem_name = "communication"
167}
168