1# Copyright (c) 2022 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("../config.gni") 16import("../web_aafwk.gni") 17import("//build/config/components/ets_frontend/ets2abc_config.gni") 18 19webview_root_path = webview_path 20if (target_cpu == "arm64") { 21 web_source = "prebuilts/arm64/ArkWebCore.hap" 22 defines = [ "webview_arm64" ] 23} else if (target_cpu == "arm") { 24 web_source = "prebuilts/arm/ArkWebCore.hap" 25 defines = [] 26} else if (target_cpu == "x86_64") { 27 web_source = "prebuilts/arm64/ArkWebCore.hap" 28 defines = [ "webview_x86_64" ] 29} 30 31defines += [ 32 "WEBVIEW_PACKAGE_NAME=\"${webview_package_name}\"", 33 "WEBVIEW_SANDBOX_LIB_PATH=\"${webview_sandbox_lib_path}\"", 34 "LEGACY_WEBVIEW_SANDBOX_LIB_PATH=\"${legacy_webview_sandbox_lib_path}\"", 35 "WEBVIEW_CRASHPAD_HANDLER_SO=\"${webview_crashpad_handler_so}\"", 36 "WEBVIEW_SANDBOX_RELATIVE_LIB_PATH=\"${webview_sandbox_relative_lib_path}\"", 37 "WEBVIEW_ENGINE_SO=\"${webview_engine_so}\"", 38] 39 40config("nweb_config") { 41 include_dirs = [ "${target_gen_dir}/include" ] 42 include_dirs += [ "include" ] 43 44 cflags = [ 45 "-Wall", 46 "-Werror", 47 "-g3", 48 ] 49} 50 51config("nweb_public_interface") { 52 include_dirs = [ "${target_gen_dir}/include" ] 53 include_dirs += [ "include" ] 54} 55 56config("nweb_glue_interface") { 57 include_dirs = [ 58 "${target_gen_dir}/../ohos_glue", 59 "${target_gen_dir}/../ohos_glue/ohos_nweb/bridge", 60 ] 61} 62 63ohos_shared_library("web_configs") { 64 include_dirs = [ 65 "${target_gen_dir}/include", 66 "../ohos_interface/include/ohos_nweb", 67 "include", 68 ] 69 sources = [ "src/nweb_config_helper.cpp" ] 70 71 deps = [ ":web_config" ] 72 73 external_deps = [ 74 "ability_runtime:app_context", 75 "bundle_framework:appexecfwk_base", 76 "bundle_framework:appexecfwk_core", 77 "config_policy:configpolicy_util", 78 "c_utils:utils", 79 "hilog:libhilog", 80 "init:libbegetutil", 81 "ipc:ipc_core", 82 "libxml2:libxml2", 83 "ability_runtime:ability_connect_callback_stub", 84 ] 85 86 part_name = "webview" 87 subsystem_name = "web" 88} 89 90ohos_shared_library("libnweb") { 91 output_name = "arkweb_core_loader" 92 if (target_cpu == "arm64") { 93 branch_protector_ret = "pac_ret" 94 } 95 96 configs = [ 97 ":nweb_config", 98 ":nweb_glue_interface", 99 ] 100 public_configs = [ ":nweb_public_interface" ] 101 sources = [ 102 "src/nweb_enhance_surface_adapter.cpp", 103 "src/nweb_helper.cpp", 104 "src/nweb_hisysevent.cpp", 105 "src/nweb_surface_adapter.cpp", 106 "src/webview_value.cpp", 107 ] 108 109 deps = [ 110 ":alias", 111 ":context-menu", 112 ":web.para", 113 ":web.para.dac", 114 ":web_config", 115 ":web_configs", 116 "${webview_path}/ohos_glue:ohos_adapter_glue_source", 117 "${webview_path}/ohos_glue:ohos_base_glue_source", 118 "${webview_path}/ohos_glue:ohos_nweb_glue_source", 119 "${webview_path}/sa:app_fwk_update", 120 "${webview_path}/arkweb_utils:libarkweb_utils", 121 ] 122 123 external_deps = [ 124 "ability_runtime:ability_manager", 125 "ability_runtime:app_context", 126 "ability_runtime:app_manager", 127 "bundle_framework:appexecfwk_base", 128 "bundle_framework:appexecfwk_core", 129 "c_utils:utils", 130 "config_policy:configpolicy_util", 131 "graphic_2d:libcomposer", 132 "graphic_2d:librender_service_client", 133 "graphic_surface:surface", 134 "hilog:libhilog", 135 "hisysevent:libhisysevent", 136 "i18n:intl_util", 137 "init:libbegetutil", 138 "input:libmmi-client", 139 "ipc:ipc_core", 140 "libxml2:libxml2", 141 "window_manager:libwm", 142 ] 143 144 innerapi_tags = [ "platformsdk" ] 145 part_name = "webview" 146 subsystem_name = "web" 147} 148 149ohos_prebuilt_etc("nweb_hap") { 150 source = web_source 151 module_install_dir = "app/${webview_package_name}" 152 part_name = "webview" 153 subsystem_name = "web" 154 license_file = "./prebuilts/NOTICE" 155} 156 157ohos_prebuilt_etc("web_config") { 158 source = "${webview_root_path}/ohos_nweb/etc/web_config.xml" 159 subsystem_name = "web" 160 part_name = "webview" 161 module_install_dir = "etc/web" 162} 163 164ohos_prebuilt_etc("web.para") { 165 source = "${webview_root_path}/ohos_nweb/etc/para/web.para" 166 subsystem_name = "web" 167 part_name = "webview" 168 module_install_dir = "etc/param" 169} 170 171ohos_prebuilt_etc("web.para.dac") { 172 source = "${webview_root_path}/ohos_nweb/etc/para/web.para.dac" 173 subsystem_name = "web" 174 part_name = "webview" 175 module_install_dir = "etc/param" 176} 177 178ohos_prebuilt_etc("alias") { 179 source = "${webview_root_path}/ohos_nweb/etc/alias.svg" 180 subsystem_name = "web" 181 part_name = "webview" 182 relative_install_dir = "webview/ohos_nweb" 183} 184 185ohos_prebuilt_etc("context-menu") { 186 source = "${webview_root_path}/ohos_nweb/etc/context-menu.svg" 187 subsystem_name = "web" 188 part_name = "webview" 189 relative_install_dir = "webview/ohos_nweb" 190} 191 192ohos_executable("chrome_crashpad_handler") { 193 output_name = "arkweb_crashpad_handler" 194 195 install_enable = true 196 197 include_dirs = [ "${target_gen_dir}/include" ] 198 include_dirs += [ "include" ] 199 200 sources = [ "src/nweb_crashpad_handler_main.cpp" ] 201 202 external_deps = [ "hilog:libhilog" ] 203 204 if (target_cpu == "arm64") { 205 branch_protector_ret = "pac_ret" 206 defines += [ "webview_arm64" ] 207 } else if (target_cpu == "arm") { 208 defines += [ "webview_arm" ] 209 } else if (target_cpu == "x86_64") { 210 defines += [ "webview_x86_64" ] 211 } 212 213 subsystem_name = "web" 214 part_name = "webview" 215} 216