From a9329b3495d5657daf9f390e3ea34fbb06363da4 Mon Sep 17 00:00:00 2001 From: Petrov Igor Date: Mon, 11 Nov 2024 18:38:39 +0300 Subject: [PATCH] [MM] Support arkplatform library Support arkplatform as common library for JS and STS VMs Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IB3L56 Testing: `ark.py` Signed-off-by: Petrov Igor --- build/compile_script/ark.py | 10 ++++++++++ build/core/gn/BUILD.gn | 18 ++++++++++++++++++ build/third_party_gn/libuv/BUILD.gn | 21 ++++++++++----------- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/build/compile_script/ark.py b/build/compile_script/ark.py index c3fba732..55619152 100755 --- a/build/compile_script/ark.py +++ b/build/compile_script/ark.py @@ -228,6 +228,11 @@ class ArkPy: "description": "Compile arkcompiler target and run regresstest with arkcompiler target.", "gn_targets_depend_on": ["default"], }, + "hybrid_vms": { + "flags": ["hybrid", "hybrid_vms", "hybridvms"], + "description": "Compile ArkJS and STS VMs in hybrid mode.", + "gn_targets_depend_on": ["hybrid"], + }, "gn_target": { "flags": [""], # any other flags "description": @@ -1015,6 +1020,11 @@ class ArkPy: self.build_for_runtime_core_unittest(out_path, gn_args, self.RUNTIME_CORE_UNITTEST_LOG_FILE_NAME) elif self.is_dict_flags_match_arg(self.ARG_DICT.get("target").get("regresstest"), arg_list[0]): self.build_for_regress_test(out_path, gn_args, arg_list) + elif self.is_dict_flags_match_arg(self.ARG_DICT.get("target").get("hybrid_vms"), arg_list[0]): + self.build_for_gn_target(out_path, + gn_args + ["ark_js_ets_hybrid=true"], + self.ARG_DICT.get("target").get("hybrid_vms").get("gn_targets_depend_on"), + self.GN_TARGET_LOG_FILE_NAME) else: self.build_for_gn_target(out_path, gn_args, arg_list, self.GN_TARGET_LOG_FILE_NAME) return diff --git a/build/core/gn/BUILD.gn b/build/core/gn/BUILD.gn index 8281cdfa..7d5161dc 100644 --- a/build/core/gn/BUILD.gn +++ b/build/core/gn/BUILD.gn @@ -91,6 +91,24 @@ group("static_core") { "$ark_root/static_core/libpandabase:libarktsbase", "$ark_root/static_core/libpandafile:libarktsfile", ] + if (target_os != "mingw") { + deps += [ "$ark_root/static_core/runtime:libarkruntime" ] + } +} + +group("hybrid") { + deps = [ + ":ets_frontend", + ":ets_runtime", + ":static_core", + "$ark_root/static_core/plugins/ets:etsstdlib", + ] + if (target_os != "mingw") { + deps += [ + "$ark_root/static_core/plugins/ets/runtime/interop_js:ets_interop_js_napi", + "$ark_root/static_core/tools/ark_js_napi_cli:ark_js_napi_cli", + ] + } } group("toolchain") { diff --git a/build/third_party_gn/libuv/BUILD.gn b/build/third_party_gn/libuv/BUILD.gn index 5bb82bb0..183cd2b4 100644 --- a/build/third_party_gn/libuv/BUILD.gn +++ b/build/third_party_gn/libuv/BUILD.gn @@ -66,10 +66,9 @@ config("libuv_config") { "-D_POSIX_C_SOURCE=200112", ] - # Adding NDEBUG macro manually to avoid compilation - # error in debug version, FIX ME - # https://gitee.com/openharmony/build/pulls/1206/files - defines += [ "NDEBUG" ] + if (!is_debug) { + defines += [ "NDEBUG" ] + } } else if (is_mingw || is_win) { cflags += [ "-Wno-missing-braces", @@ -127,13 +126,13 @@ ohos_source_set("libuv_source") { if (is_mac || (defined(is_ios) && is_ios)) { sources += nonwin_srcs + [ "//third_party/libuv/src/unix/bsd-ifaddrs.c", - "//third_party/libuv/src/unix/kqueue.c", - "//third_party/libuv/src/unix/random-getentropy.c", "//third_party/libuv/src/unix/darwin-proctitle.c", "//third_party/libuv/src/unix/darwin.c", "//third_party/libuv/src/unix/fsevents.c", - "//third_party/libuv/src/unix/os390-proctitle.c", + "//third_party/libuv/src/unix/kqueue.c", "//third_party/libuv/src/unix/log_unix.c", + "//third_party/libuv/src/unix/os390-proctitle.c", + "//third_party/libuv/src/unix/random-getentropy.c", "//third_party/libuv/src/unix/trace_unix.c", ] } else if (is_mingw || is_win) { @@ -170,10 +169,10 @@ ohos_source_set("libuv_source") { sources += nonwin_srcs + [ "//third_party/libuv/src/unix/linux.c", "//third_party/libuv/src/unix/procfs-exepath.c", + "//third_party/libuv/src/unix/proctitle.c", "//third_party/libuv/src/unix/random-getentropy.c", "//third_party/libuv/src/unix/random-getrandom.c", "//third_party/libuv/src/unix/random-sysctl-linux.c", - "//third_party/libuv/src/unix/proctitle.c", ] sources += [ "src/log_ohos.c", @@ -182,20 +181,20 @@ ohos_source_set("libuv_source") { } else if (is_linux) { sources += nonwin_srcs + [ "//third_party/libuv/src/unix/linux.c", + "//third_party/libuv/src/unix/log_unix.c", "//third_party/libuv/src/unix/procfs-exepath.c", + "//third_party/libuv/src/unix/proctitle.c", "//third_party/libuv/src/unix/random-getrandom.c", "//third_party/libuv/src/unix/random-sysctl-linux.c", - "//third_party/libuv/src/unix/proctitle.c", - "//third_party/libuv/src/unix/log_unix.c", "//third_party/libuv/src/unix/trace_unix.c", ] } else { sources += nonwin_srcs + [ "//third_party/libuv/src/unix/linux.c", "//third_party/libuv/src/unix/procfs-exepath.c", + "//third_party/libuv/src/unix/proctitle.c", "//third_party/libuv/src/unix/random-getrandom.c", "//third_party/libuv/src/unix/random-sysctl-linux.c", - "//third_party/libuv/src/unix/proctitle.c", ] } subsystem_name = "thirdparty" -- Gitee