diff --git a/BUILD.gn b/BUILD.gn index 83a1e2f6374c05f6ca1db96306c13ea7263c9458..40bf3889657e643b4712b015fcf4cad1148e3d17 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -169,12 +169,14 @@ config("ark_toolchain_common_config") { cflags_cc += [ "-O3", "-ggdb3", + "-gdwarf-4", "-fno-omit-frame-pointer", "-D_GLIBCXX_ASSERTIONS", ] cflags_c += [ "-O3", "-ggdb3", + "-gdwarf-4", "-fno-omit-frame-pointer", "-D_GLIBCXX_ASSERTIONS", ] @@ -182,6 +184,7 @@ config("ark_toolchain_common_config") { cflags_cc += [ "-O0", "-ggdb3", + "-gdwarf-4", ] } else { defines += [ "NDEBUG" ] diff --git a/build/compile_script/ark.py b/build/compile_script/ark.py index c3fba73276e37a7aafa0ef242488f934205e5ecd..60035a4c0b7971228062f8891c2edc076541443d 100755 --- a/build/compile_script/ark.py +++ b/build/compile_script/ark.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 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 @@ -228,6 +228,11 @@ class ArkPy: "description": "Compile arkcompiler target and run regresstest with arkcompiler target.", "gn_targets_depend_on": ["default"], }, + "hybrid": { + "flags": ["hybrid", "hybrid_tests"], + "description": "Compile ArkJS and STS parts in hybrid mode.", + "gn_targets_depend_on": [], + }, "gn_target": { "flags": [""], # any other flags "description": @@ -320,6 +325,7 @@ class ArkPy: def libs_dir(is_arm, is_aot, is_pgo, out_dir, x64_out_dir) -> str: if is_arm and is_aot and is_pgo: return (f"--libs-dir ../../{out_dir}/arkcompiler/ets_runtime:" + f"../../{out_dir}/arkcompiler/runtime_core:" f"../../{out_dir}/thirdparty/icu:" f"../../{out_dir}/third_party/icu:" f"../../thirdparty/zlib:" @@ -329,6 +335,7 @@ class ArkPy: f":../../{x64_out_dir}/thirdparty/icu/") if not is_arm and is_aot: return (f"--libs-dir ../../{out_dir}/arkcompiler/ets_runtime" + f":../../{out_dir}/arkcompiler/runtime_core" f":../../{out_dir}/thirdparty/icu:" f"../../{out_dir}/third_party/icu:" f"../../thirdparty/zlib:" @@ -402,6 +409,7 @@ class ArkPy: f" --timeout {timeout}" \ f" --libs-dir ../../{out_path}/arkcompiler/ets_runtime:../../{out_path}/thirdparty/icu:" \ f"../../{out_path}/thirdparty/zlib:../../prebuilts/clang/ohos/linux-x86_64/llvm/lib" \ + f":../../{out_path}/arkcompiler/runtime_core" \ " --ark-arch aarch64" \ f" --ark-arch-root=../../{out_path}/common/common/libc/" \ f" --ark-tool=../../{out_path}/arkcompiler/ets_runtime/ark_js_vm" \ @@ -428,6 +436,7 @@ class ArkPy: f" --timeout {timeout}" \ f" --libs-dir ../../{out_path}/arkcompiler/ets_runtime:../../{out_path}/thirdparty/icu" \ f":../../{out_path}/thirdparty/zlib:../../prebuilts/clang/ohos/linux-x86_64/llvm/lib" \ + f":../../{out_path}/arkcompiler/runtime_core" \ f" --ark-tool=../../{out_path}/arkcompiler/ets_runtime/ark_js_vm" \ f" --ark-aot-tool=../../{out_path}/arkcompiler/ets_runtime/ark_aot_compiler" \ f" --ark-frontend-binary=../../{out_path}/arkcompiler/ets_frontend/es2abc" \ @@ -448,6 +457,7 @@ class ArkPy: f" --libs-dir ../../prebuilts/clang/ohos/linux-x86_64/llvm/lib:../../{out_path}/thirdparty/icu/" \ f":../../{out_path}/thirdparty/bounds_checking_function" \ f":../../{out_path}/arkcompiler/ets_runtime:" \ + f"../../{out_path}/arkcompiler/runtime_core:" \ " --ark-arch aarch64" \ " --run-jit" \ f" --ark-arch-root=../../{out_path}/common/common/libc/" \ @@ -460,6 +470,7 @@ class ArkPy: cmd = f"cd arkcompiler/ets_frontend && python3 {test_script_name} {args_to_cmd} --timeout {timeout}" \ f" --libs-dir ../../{out_path}/arkcompiler/ets_runtime:../../{out_path}/thirdparty/icu" \ f":../../{out_path}/thirdparty/zlib:../../prebuilts/clang/ohos/linux-x86_64/llvm/lib" \ + f":../../{out_path}/arkcompiler/runtime_core" \ " --run-jit" \ f" --ark-tool=../../{out_path}/arkcompiler/ets_runtime/ark_js_vm" \ f" --ark-frontend-binary=../../{out_path}/arkcompiler/ets_frontend/es2abc" \ @@ -1015,6 +1026,12 @@ 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"), arg_list[0]): + targets = arg_list + self.build_for_gn_target(out_path, + gn_args + ["ark_ets_hybrid=true", "ark_js_hybrid=true"], + targets, + 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 0d33dffaf7a8ea872dc85aaab88bdaa786594070..fc7bbe19334e7d6921be854506f7906c586dfc6a 100644 --- a/build/core/gn/BUILD.gn +++ b/build/core/gn/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 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 @@ -75,6 +75,7 @@ group("ets_frontend") { target_os == "mac") { deps = [ "$ets_frontend_root/es2panda:es2panda", + "$ets_frontend_root/ets2panda/lsp:lsp_packages", "$ets_frontend_root/merge_abc:merge_abc", ] } @@ -93,7 +94,26 @@ group("static_core") { "$ark_root/static_core/compiler:libarktscompiler", "$ark_root/static_core/libpandabase:libarktsbase", "$ark_root/static_core/libpandafile:libarktsfile", + "$ark_root/static_core/static_linker:static_linker", ] + 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(${host_toolchain})", + ] + 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/templates/cxx/external_deps_handler.py b/build/templates/cxx/external_deps_handler.py index 6577eae412e82b24e3c19ddb805c5935f8824279..b42f432e1348332ab87c0be8673544a68ab4bc75 100755 --- a/build/templates/cxx/external_deps_handler.py +++ b/build/templates/cxx/external_deps_handler.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 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 diff --git a/build/third_party_gn/libuv/BUILD.gn b/build/third_party_gn/libuv/BUILD.gn index 1866c52c2f17b955e2ae12eb905778f531bde3f6..82c11ea0263e5915f147e7f1232783499013e4cf 100644 --- a/build/third_party_gn/libuv/BUILD.gn +++ b/build/third_party_gn/libuv/BUILD.gn @@ -65,6 +65,10 @@ config("libuv_config") { "-D_GNU_SOURCE", "-D_POSIX_C_SOURCE=200112", ] + + if (!is_debug) { + defines += [ "NDEBUG" ] + } } else if (is_mingw || is_win) { cflags += [ "-Wno-missing-braces", diff --git a/toolchain_config.gni b/toolchain_config.gni index e02bd052a388858f80c789fc5bf48fda87ffb463..9442eb52fa7f025498fb55465140ef9ac36141e6 100644 --- a/toolchain_config.gni +++ b/toolchain_config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 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