mirror of
https://gitee.com/openharmony/startup_appspawn
synced 2024-11-23 15:10:44 +00:00
19f2046db2
Merge pull request !677 from zhangdengyu/webTokenId_0625
254 lines
7.2 KiB
Plaintext
254 lines
7.2 KiB
Plaintext
# Copyright (c) 2021-2022 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("//base/startup/appspawn/appspawn.gni")
|
|
import("//build/ohos.gni")
|
|
|
|
config("appspawn_config") {
|
|
visibility = [ "./*" ]
|
|
include_dirs = [
|
|
"common",
|
|
"standard",
|
|
"adapter",
|
|
"interfaces/innerkits/include",
|
|
"//commonlibrary/c_utils/base/include",
|
|
"util/include",
|
|
"${ability_runtime_path}/interfaces/kits/native/appkit/app",
|
|
"//base/global/resource_management/interfaces/inner_api/include",
|
|
"//base/security/access_token/interfaces/innerkits/token_setproc/include",
|
|
"//base/startup/init/services/log",
|
|
"//base/startup/init/services/include",
|
|
"//base/startup/init/services/include/param",
|
|
"//base/startup/init/services/loopevent/include",
|
|
"//base/startup/init/interfaces/innerkits/include",
|
|
"//third_party/json/include",
|
|
"//base/notification/eventhandler/interfaces/inner_api",
|
|
"//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
|
|
"//foundation/arkui/napi",
|
|
"//third_party/libuv/include",
|
|
]
|
|
|
|
if (build_selinux) {
|
|
cflags = [ "-DWITH_SELINUX" ]
|
|
}
|
|
}
|
|
|
|
ohos_executable("appspawn") {
|
|
sources = [
|
|
"${appspawn_path}/adapter/appspawn_ace.cpp",
|
|
"${appspawn_path}/standard/main.c",
|
|
]
|
|
if (asan_detector || is_asan) {
|
|
defines = [ "ASAN_DETECTOR" ]
|
|
}
|
|
configs = [ ":appspawn_config" ]
|
|
deps = [ "${appspawn_path}:appspawn_server" ]
|
|
external_deps = [
|
|
"ability_base:want",
|
|
"ability_runtime:app_manager",
|
|
"ability_runtime:appkit_native",
|
|
"ability_runtime:runtime",
|
|
"c_utils:utils",
|
|
"common_event_service:cesfwk_innerkits",
|
|
"config_policy:configpolicy_util",
|
|
"hilog:libhilog",
|
|
"hitrace:hitrace_meter",
|
|
"init:libbegetutil",
|
|
"resource_management:global_resmgr",
|
|
]
|
|
|
|
install_enable = true
|
|
subsystem_name = "${subsystem_name}"
|
|
part_name = "${part_name}"
|
|
}
|
|
|
|
ohos_prebuilt_etc("asan.options") {
|
|
source = "asan.options"
|
|
subsystem_name = "${subsystem_name}"
|
|
part_name = "${part_name}"
|
|
}
|
|
|
|
ohos_shared_library("appspawn_helper") {
|
|
sources = [ "${appspawn_path}/common/appspawn_server.c" ]
|
|
configs = [ ":appspawn_config" ]
|
|
defines = [ "APPSPAWN_HELPER" ]
|
|
cflags = [
|
|
"-fvisibility=hidden",
|
|
"-fstack-protector-all",
|
|
]
|
|
external_deps = [ "hilog:libhilog" ]
|
|
|
|
install_enable = true
|
|
subsystem_name = "${subsystem_name}"
|
|
part_name = "${part_name}"
|
|
}
|
|
|
|
ohos_static_library("appspawn_server") {
|
|
sources = [
|
|
"${appspawn_path}/adapter/appspawn_adapter.cpp",
|
|
"${appspawn_path}/adapter/appspawn_sandbox.cpp",
|
|
"${appspawn_path}/common/appspawn_server.c",
|
|
"${appspawn_path}/interfaces/innerkits/src/appspawn_mount_permission.cpp",
|
|
"${appspawn_path}/standard/appspawn_process.c",
|
|
"${appspawn_path}/standard/appspawn_service.c",
|
|
"${appspawn_path}/util/src/json_utils.cpp",
|
|
"${appspawn_path}/util/src/sandbox_utils.cpp",
|
|
]
|
|
defines = [
|
|
"GRAPHIC_PERMISSION_CHECK",
|
|
"INIT_AGENT",
|
|
"APPSPAWN_CHECK_GID_UID",
|
|
]
|
|
|
|
if (asan_detector || is_asan) {
|
|
defines += [ "ASAN_DETECTOR" ]
|
|
}
|
|
configs = [ ":appspawn_config" ]
|
|
ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64z" ]
|
|
deps = [
|
|
":asan.options",
|
|
"//foundation/communication/netmanager_base/services/netmanagernative/netsys_client:netsys_client",
|
|
]
|
|
external_deps = [
|
|
"access_token:libtoken_setproc",
|
|
"c_utils:utils",
|
|
"config_policy:configpolicy_util",
|
|
"hilog:libhilog",
|
|
"init:libbegetutil",
|
|
"init:libbegetutil",
|
|
]
|
|
|
|
if (!defined(global_parts_info) ||
|
|
defined(global_parts_info.security_security_component)) {
|
|
defines += [ "SECURITY_COMPONENT_ENABLE" ]
|
|
external_deps += [ "security_component:libsecurity_component_enhance_sdk" ]
|
|
}
|
|
|
|
if (build_selinux) {
|
|
external_deps += [ "selinux_adapter:libhap_restorecon" ]
|
|
}
|
|
|
|
cflags = []
|
|
if (build_seccomp) {
|
|
cflags += [ "-DWITH_SECCOMP" ]
|
|
external_deps += [ "init:seccomp" ]
|
|
}
|
|
|
|
if (appspawn_report_event) {
|
|
cflags += [ "-DREPORT_EVENT" ]
|
|
deps += [ "adapter/sysevent:event_reporter" ]
|
|
}
|
|
|
|
subsystem_name = "${subsystem_name}"
|
|
part_name = "${part_name}"
|
|
}
|
|
|
|
ohos_prebuilt_etc("appspawn.rc") {
|
|
source = "appspawn.cfg"
|
|
relative_install_dir = "init"
|
|
subsystem_name = "${subsystem_name}"
|
|
part_name = "${part_name}"
|
|
}
|
|
|
|
ohos_static_library("nwebspawn_server") {
|
|
sources = [
|
|
"${appspawn_path}/adapter/appspawn_adapter.cpp",
|
|
"${appspawn_path}/adapter/appspawn_sandbox.cpp",
|
|
"${appspawn_path}/common/appspawn_server.c",
|
|
"${appspawn_path}/interfaces/innerkits/src/appspawn_mount_permission.cpp",
|
|
"${appspawn_path}/standard/appspawn_process.c",
|
|
"${appspawn_path}/standard/appspawn_service.c",
|
|
"${appspawn_path}/util/src/json_utils.cpp",
|
|
"${appspawn_path}/util/src/sandbox_utils.cpp",
|
|
]
|
|
defines = [
|
|
"GRAPHIC_PERMISSION_CHECK",
|
|
"INIT_AGENT",
|
|
"NWEB_SPAWN",
|
|
"APPSPAWN_CHECK_GID_UID",
|
|
"APPSPAWN_LABEL=\"NWEBSPAWN\"",
|
|
]
|
|
configs = [ ":appspawn_config" ]
|
|
ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64z" ]
|
|
deps = [ "//foundation/communication/netmanager_base/services/netmanagernative/netsys_client:netsys_client" ]
|
|
external_deps = [
|
|
"access_token:libtoken_setproc",
|
|
"access_token:libtokenid_sdk",
|
|
"c_utils:utils",
|
|
"config_policy:configpolicy_util",
|
|
"hilog:libhilog",
|
|
"init:libbegetutil",
|
|
]
|
|
if (build_selinux) {
|
|
external_deps += [ "selinux_adapter:libhap_restorecon" ]
|
|
}
|
|
|
|
cflags = []
|
|
if (build_seccomp) {
|
|
cflags += [ "-DWITH_SECCOMP" ]
|
|
external_deps += [ "init:seccomp" ]
|
|
}
|
|
|
|
subsystem_name = "${subsystem_name}"
|
|
part_name = "${part_name}"
|
|
}
|
|
|
|
ohos_executable("nwebspawn") {
|
|
defines = [
|
|
"NWEB_SPAWN",
|
|
"APPSPAWN_LABEL=\"NWEBSPAWN\"",
|
|
]
|
|
if (target_cpu == "arm64") {
|
|
defines += [ "webview_arm64" ]
|
|
}
|
|
if (target_cpu == "x86_64") {
|
|
defines += [ "webview_x86_64" ]
|
|
}
|
|
sources = [
|
|
"${appspawn_path}/adapter/appspawn_nweb.cpp",
|
|
"${appspawn_path}/interfaces/innerkits/src/appspawn_mount_permission.cpp",
|
|
"${appspawn_path}/standard/main.c",
|
|
"${appspawn_path}/util/src/json_utils.cpp",
|
|
"${appspawn_path}/util/src/sandbox_utils.cpp",
|
|
]
|
|
configs = [ ":appspawn_config" ]
|
|
deps = [ "${appspawn_path}:nwebspawn_server" ]
|
|
external_deps = [
|
|
"config_policy:configpolicy_util",
|
|
"hilog:libhilog",
|
|
]
|
|
if (build_selinux) {
|
|
external_deps += [ "selinux_adapter:libhap_restorecon" ]
|
|
}
|
|
|
|
install_enable = true
|
|
subsystem_name = "${subsystem_name}"
|
|
part_name = "${part_name}"
|
|
}
|
|
|
|
ohos_prebuilt_etc("nwebspawn.rc") {
|
|
source = "nwebspawn.cfg"
|
|
relative_install_dir = "init"
|
|
subsystem_name = "${subsystem_name}"
|
|
part_name = "${part_name}"
|
|
}
|
|
|
|
group("nweb") {
|
|
deps = []
|
|
if (appspawn_support_nweb) {
|
|
deps += [
|
|
":nwebspawn",
|
|
":nwebspawn.rc",
|
|
]
|
|
}
|
|
}
|