# Copyright (c) 2025 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("//build/config/components/ets_frontend/ets2abc_config.gni")
import("../../../../../config.gni")
import("../../../../../web_aafwk.gni")
config("web_ex_cfg") {
include_dirs = [
"include",
]
}
ohos_source_set("connect_info") {
include_dirs = [
"include",
"../../../../../ohos_nweb/include",
"../../../../../sa/web_native_messaging/common",
]
sources = [ "src/web_native_messaging_extension_connect_info.cpp" ]
external_deps = [
"hilog:libhilog",
"ipc:ipc_core",
]
part_name = "webview"
subsystem_name = "web"
}
ohos_shared_library("web_extension") {
sanitize = {
cfi = true
cfi_cross_dso = true
cfi_vcall_icall_only = true
debug = false
}
if (target_cpu == "arm64") {
branch_protector_ret = "pac_ret"
}
include_dirs = [
"include",
"../../../../../ohos_nweb/include",
"../../../../../sa/web_native_messaging/common",
"../../../ani/webnativemessagingextension/ability/include",
"../../../ani/webview/src/common",
"../../../../kits/nativecommon",
]
sources = [
"src/js_web_native_messaging_extension_context.cpp",
"src/js_web_native_messaging_extension.cpp",
"src/web_native_messaging_extension_context.cpp",
"src/web_native_messaging_extension_stub_impl.cpp",
"src/web_native_messaging_extension_stub.cpp",
"src/web_native_messaging_extension.cpp",
"../../../ani/webview/src/common/ani_business_error.cpp",
"../../../ani/webnativemessagingextension/ability/src/ets_web_native_messaging_extension.cpp",
"../../../ani/webnativemessagingextension/ability/src/ets_web_native_messaging_extension_context.cpp",
"../../../../../sa/web_native_messaging/common/web_native_messaging_common.cpp"
]
deps = [
":connect_info",
"../../../../kits/nativecommon:webview_common",
"../../../../../sa/web_native_messaging:web_native_messaging_kit"
]
external_deps = [
"ability_base:want",
"ability_runtime:ani_common",
"ability_runtime:abilitykit_native",
"ability_runtime:ani_base_context",
"ability_runtime:app_context",
"ability_runtime:napi_common",
"ability_runtime:ability_start_options",
"ability_runtime:ability_context_native",
"ability_runtime:extensionkit_native",
"ability_runtime:ability_manager",
"ability_runtime:runtime",
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_core",
"ipc:ipc_napi",
"ipc:ipc_single",
"napi:ace_napi",
"runtime_core:ani",
]
part_name = "webview"
subsystem_name = "web"
}
ohos_shared_library("web_native_messaging_extension_module") {
sanitize = {
cfi = true
cfi_cross_dso = true
cfi_vcall_icall_only = true
debug = false
}
if (target_cpu == "arm64") {
branch_protector_ret = "pac_ret"
}
include_dirs = [
"include",
"../../../../../sa/web_native_messaging/common",
]
sources = [
"src/web_native_messaging_extension_module_loader.cpp"
]
deps = [
":web_extension",
]
external_deps = [
"ability_base:base",
"ability_base:want",
"ability_runtime:abilitykit_native",
"ability_runtime:runtime",
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_core",
"napi:ace_napi",
"ipc:ipc_napi",
"ipc:ipc_single",
]
cflags = [
"-fstack-protector-strong",
"-D_FORTIFY_SOURCE=2",
"-Os",
"-fvisibility=hidden",
"-fdata-sections",
"-ffunction-sections",
"-flto",
]
relative_install_dir = "extensionability/"
part_name = "webview"
subsystem_name = "web"
}