From 179173b45a3af0067e40983dc9773380a30715b4 Mon Sep 17 00:00:00 2001 From: Petrov Igor Date: Mon, 11 Nov 2024 20:36:36 +0300 Subject: [PATCH] [MM] Support hybrid build for ArkJS and STS Support arkplatform as common library for JS and STS VMs Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IB80F7 Testing: `ark.py x64.debug hybrid` Signed-off-by: Petrov Igor --- BUILD.gn | 15 +++++++++++++++ ecmascript/compiler/BUILD.gn | 8 ++++++++ js_runtime_config.gni | 3 +++ 3 files changed, 26 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index 6fb624ff8d..7aa86e47cb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -227,6 +227,13 @@ config("ark_jsruntime_public_config") { "$js_root", "$js_root/ecmascript/napi/include", ] + + defines = [] + + if (ark_js_hybrid) { + defines += [ "PANDA_JS_ETS_HYBRID_MODE" ] + include_dirs += [ "$arkplatform_root" ] + } } intl_sources = [] @@ -1261,6 +1268,14 @@ ohos_source_set("libark_jsruntime_static") { all_dependent_configs = [ ":ark_jsruntime_public_config" ] } + if (ark_js_hybrid) { + if (is_arkui_x) { + deps += [ "$arkplatform_root:libarkplatform" ] + } else { + external_deps += [ "runtime_core:libarkplatform" ] + } + } + public_configs = [ "$js_root:ark_jsruntime_public_config" ] if (!is_ohos) { diff --git a/ecmascript/compiler/BUILD.gn b/ecmascript/compiler/BUILD.gn index e884ee3ae9..2a4bf6d2f5 100644 --- a/ecmascript/compiler/BUILD.gn +++ b/ecmascript/compiler/BUILD.gn @@ -480,6 +480,14 @@ ohos_executable("ark_aot_compiler") { ] } + if (ark_js_hybrid) { + if (!is_arkui_x) { + external_deps += [ "runtime_core:libarkplatform" ] + } else { + deps += [ "$arkplatform_root:libarkplatform" ] + } + } + # hiviewdfx libraries external_deps += hiviewdfx_ext_deps deps += hiviewdfx_deps diff --git a/js_runtime_config.gni b/js_runtime_config.gni index d4d73a4f71..10563588ef 100644 --- a/js_runtime_config.gni +++ b/js_runtime_config.gni @@ -49,6 +49,8 @@ declare_args() { # Default false. ets_runtime_feature_enable_list = false enable_gc_dfx_options = false + + ark_js_hybrid = false } if (target_cpu == "arm64") { @@ -73,6 +75,7 @@ if (!defined(build_variant)) { } import("$build_root/config/sanitizers/sanitizers.gni") ark_root = "//arkcompiler/runtime_core" +arkplatform_root = "//arkcompiler/runtime_core/arkplatform" js_root = "//arkcompiler/ets_runtime" global_root = "//base/global/i18n" hilog_root = "//base/hiviewdfx/hilog/interfaces/native/innerkits" -- Gitee