# Copyright (c) 2022-2023 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("//foundation/appframework/ability/ability_runtime/ability_runtime.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
ohos_source_set("plugin_log") {
defines = [ "PLUGIN_LOG_TAG=\"Plugins\"" ]
sources = [ "log.cpp" ]
include_dirs = [
"//foundation/arkui/ace_engine/frameworks",
"//foundation/arkui/ace_engine/interfaces/inner_api/ace_kit/include",
]
if (target_os == "android") {
defines += [ "ANDROID_PLATFORM" ]
} else if (target_os == "ios") {
defines += [ "IOS_PLATFORM" ]
}
}
config("plugin_util_config") {
include_dirs = [
"//foundation/appframework/ability/ability_runtime/cross_platform/frameworks/native/base/event_handler/include",
"//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/error",
"//foundation/arkui/ace_engine/interfaces/inner_api/ace_kit/include",
# "//foundation/arkui/ace_engine/interfaces/inner_api/ace",
"//plugins/interfaces/native",
]
}
template("ace_plugin_util_static") {
forward_variables_from(invoker, "*")
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
include_dirs = [
"$ace_root",
"$ace_root/frameworks",
"//third_party/bounds_checking_function/include",
]
public_configs = [ ":plugin_util_config" ]
sources = [
"inner_api/plugin_utils_inner.cpp",
"inner_api/plugin_utils_napi.cpp",
"plugin_utils.cpp",
]
deps = [
":plugin_log",
"//foundation/arkui/napi:ace_napi",
]
subsystem_name = "plugins"
part_name = "plugin_utils"
}
}
foreach(item, ace_platforms) {
ace_plugin_util_static("ace_plugin_util_static_" + item.name) {
defines = []
cflags_cc = []
config = {
}
if (defined(item.config)) {
config = item.config
}
if (defined(config.defines)) {
defines = config.defines
}
if (defined(config.cflags_cc)) {
cflags_cc = config.cflags_cc
}
}
ohos_source_set("ace_plugin_util_inner_" + item.name) {
platform = item.name
public_configs = [ ":plugin_util_config" ]
deps = [ ":ace_plugin_util_static_${platform}" ]
}
ohos_source_set("ace_plugin_util_" + item.name) {
platform = item.name
public_configs = [ ":plugin_util_config" ]
public_deps = [ "//plugins/libs/napi:napi_${platform}" ]
config = {
}
if (defined(item.config)) {
config = item.config
}
if (defined(config.libace_target)) {
deps = [ config.libace_target ]
}
subsystem_name = "plugins"
part_name = "plugin_utils"
}
}
config("napi_common_public_config") {
include_dirs = [
"./",
"${ability_runtime_cross_platform_path}/interfaces/inner_api/want",
]
}
ohos_source_set("napi_common") {
public_configs = [
":napi_common_public_config",
"${ability_runtime_cross_platform_path}/interfaces/inner_api/jsruntime:jsruntime_config",
"${ability_runtime_cross_platform_path}/interfaces/inner_api/hilog:ability_cross_platform_hilog_config",
]
sources = [
"//foundation/appframework/ability/ability_runtime/cross_platform/frameworks/js/napi/napi_common/napi_common_util.cpp",
"//foundation/appframework/ability/ability_runtime/cross_platform/frameworks/js/napi/napi_common/napi_common_want.cpp",
]
deps = [ "${ability_runtime_cross_platform_path}/interfaces/inner_api/want:cross_platform_want" ]
deps += [ "//plugins/libs/napi:napi_${target_os}" ]
if (target_os == "android") {
defines = [ "ANDROID_PLATFORM" ]
} else if (target_os == "ios") {
defines = [ "IOS_PLATFORM" ]
}
subsystem_name = "ability"
part_name = "ability_runtime"
}