# 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("//build/ohos.gni") import("//foundation/arkui/ace_engine/ace_config.gni") template("js_engine_qjs") { forward_variables_from(invoker, "*") ohos_source_set(target_name) { subsystem_name = ace_engine_subsystem part_name = ace_engine_part defines += invoker.defines configs = [ "$ace_root:ace_config" ] sources = [ "animation_bridge.cpp", "animator_bridge.cpp", "badge_bridge.cpp", "canvas_bridge.cpp", "chart_bridge.cpp", "clock_bridge.cpp", "component_api_bridge.cpp", "image_animator_bridge.cpp", "list_bridge.cpp", "offscreen_canvas_bridge.cpp", "qjs_engine.cpp", "qjs_engine_loader.cpp", "qjs_group_js_bridge.cpp", "qjs_utils.cpp", "qjs_xcomponent_bridge.cpp", "stepper_bridge.cpp", ] deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code", "//third_party/jsframework:jsf", ] if (use_js_debug) { deps += [ "//foundation/arkui/napi:ace_napi_quickjs_debug", "//third_party/quickjs:qjs_debugger", ] defines += [ "ENABLE_JS_DEBUG" ] configs += [ "//third_party/quickjs:qjs_debug_config" ] } else { deps += [ "//foundation/arkui/napi:ace_napi_quickjs", "//third_party/quickjs:qjs", ] } if (defined(config.use_build_in_js_engine) && config.use_build_in_js_engine) { defines += [ "BUILT_IN_JS_ENGINE" ] } if (platform == "windows" || platform == "mac" || platform == "linux") { defines += [ "ENABLE_JS_DEBUG_PREVIEW" ] configs += [ "$ace_flutter_engine_root:flutter_config" ] } } } foreach(item, ace_platforms) { platform = item.name engine_config = { } engine_config = item.config support_engines = [] support_engines = engine_config.js_engines foreach(engine, support_engines) { if (engine.engine_name == "qjs") { js_engine_qjs("js_engine_bridge_qjs_$platform") { platform = item.name defines = engine.engine_defines use_js_debug = false config = { } if (defined(item.config)) { config = item.config } if (defined(config.defines)) { defines += config.defines } } if (defined(engine.have_debug) && engine.have_debug) { js_engine_qjs("js_engine_bridge_qjs_debug_$platform") { platform = item.name defines = engine.engine_defines use_js_debug = true config = { } if (defined(item.config)) { config = item.config } if (defined(config.defines)) { defines += config.defines } } } } } }