# 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("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") import("//build/ohos.gni") import("//foundation/arkui/ace_engine/ace_config.gni") import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni") base_output_path = get_label_info(":gen_abc_proxyclass", "target_out_dir") abcstrip_native_min_obj_path = base_output_path + "strip.native.min.abc" es2abc_gen_abc("gen_strip_native_min_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. src_js = rebase_path( "$root_out_dir/obj/third_party/jsframework/dist/strip.native.min.js") dst_file = rebase_path(base_output_path + "/strip.native.min.abc") in_puts = [ "$root_out_dir/obj/third_party/jsframework/dist/strip.native.min.js" ] out_puts = [ base_output_path + "/strip.native.min.abc" ] extra_dependencies = [ "//third_party/jsframework:gen_snapshot" ] } gen_obj("abc_strip_native_min") { input = base_output_path + "/strip.native.min.abc" if (use_mac || use_mingw_win || use_ios || use_linux) { abcstripnativemin_obj_path = base_output_path + "/strip_native_min.c" } else { abcstripnativemin_obj_path = base_output_path + "/strip_native_min.o" } output = abcstripnativemin_obj_path snapshot_dep = [ ":gen_strip_native_min_abc" ] } template("js_engine_ark") { 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 = [ "ark_js_runtime.cpp", "ark_js_value.cpp", "jsi_animation_bridge.cpp", "jsi_animator_bridge.cpp", "jsi_badge_bridge.cpp", "jsi_base_utils.cpp", "jsi_canvas_bridge.cpp", "jsi_chart_bridge.cpp", "jsi_clock_bridge.cpp", "jsi_component_api_bridge.cpp", "jsi_engine.cpp", "jsi_engine_loader.cpp", "jsi_group_js_bridge.cpp", "jsi_image_animator_bridge.cpp", "jsi_input_bridge.cpp", "jsi_list_bridge.cpp", "jsi_offscreen_canvas_bridge.cpp", "jsi_stepper_bridge.cpp", ] cflags_cc = [ "-Wno-thread-safety-attributes" ] # xcomponent components supports phone, TV and wearable except PC Preview if (defined(config.xcomponent_components_support) && config.xcomponent_components_support) { sources += [ "jsi_xcomponent_bridge.cpp" ] } if (defined(config.use_build_in_js_engine) && config.use_build_in_js_engine) { defines += [ "BUILT_IN_JS_ENGINE" ] } external_deps = [] deps = [] if (use_hilog) { external_deps = [ "hilog:libhilog" ] } if (defined(config.build_for_preview) && config.build_for_preview) { deps += [ ":gen_obj_src_abc_strip_native_min" ] external_deps += [ "napi:ace_napi" ] include_dirs = [ "//commonlibrary/c_utils/base/include" ] } else if (defined(config.build_for_android) && config.build_for_android) { deps += [ ":gen_obj_src_abc_strip_native_min", "//third_party/css-what:css_what_sources", "//third_party/jsframework:ark_build", ] } else if (defined(config.build_for_ios) && config.build_for_ios) { deps += [ ":gen_obj_src_abc_strip_native_min" ] external_deps += [ "css-what:css_what_sources", "jsframework:ark_build", "napi:ace_napi", ] } else { external_deps += [ "css-what:css_what_sources", "image_framework:image", "image_framework:image_native", "jsframework:ark_build", "napi:ace_napi", ] } if (target_cpu == "arm64") { defines += [ "APP_USE_ARM64" ] } else if (target_cpu == "arm") { defines += [ "APP_USE_ARM" ] } # add for cross_platfrom_build temporarily, shall be removed after external_deps is supported if (is_arkui_x) { deps += [ "$ark_ets_path:libark_jsruntime_static" ] if (defined(config.pixel_map_support) && config.pixel_map_support) { configs += [ "//foundation/multimedia/image_framework/interfaces/innerkits:image_external_config", "//foundation/arkui/napi:ace_napi_config", ] } } else { external_deps += [ "ets_runtime:libark_jsruntime" ] } } } 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 == "ark") { js_engine_ark("js_engine_bridge_ark_$platform") { defines = engine.engine_defines config = { } if (defined(item.config)) { config = item.config } if (defined(config.defines)) { defines += config.defines } } } } }