From b2d56664405248a2e88dbcec8975fd1bad554a46 Mon Sep 17 00:00:00 2001 From: dongchao Date: Wed, 20 Aug 2025 15:42:53 +0800 Subject: [PATCH] modularization cherry-pick Issue: https://gitee.com/openharmony/vendor_hihope/issues/ICTTZY Signed-off-by: dongchao --- arkguard/BUILD.gn | 19 ++++++++++++++++++- bundle.json | 12 ++++++++++-- ets2panda/BUILD.gn | 22 +++++++++++++++++++--- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/arkguard/BUILD.gn b/arkguard/BUILD.gn index 9a76b306ea..66e5c5af55 100644 --- a/arkguard/BUILD.gn +++ b/arkguard/BUILD.gn @@ -13,6 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + import("//arkcompiler/runtime_core/static_core/ark_config.gni") +} else { + import( + "//build/config/components/runtime_core/static_core/ark_common_config.gni") +} + typescript_dir = get_label_info("//third_party/typescript:build_typescript", "target_out_dir") @@ -50,7 +58,7 @@ action("build_arkguard") { "src/utils/TypeUtils.ts", ] - deps = [ "//third_party/typescript:build_typescript" ] + external_deps = [ "typescript:build_typescript_etc" ] script = "compile_arkguard.py" args = [ rebase_path(get_path_info("./", "abspath")), @@ -60,3 +68,12 @@ action("build_arkguard") { outputs = [ "${target_out_dir}/arkguard-1.1.3.tgz" ] } + +if (!(defined(ark_static_standalone_build) && ark_static_standalone_build)) { + ohos_shared_headers("build_arkguard_etc") { + include_dirs = [] + deps = [ ":build_arkguard" ] + part_name = "ets_frontend" + subsystem_name = "arkcompiler" + } +} diff --git a/bundle.json b/bundle.json index 3ea4b67716..d33dbc81d8 100644 --- a/bundle.json +++ b/bundle.json @@ -24,13 +24,15 @@ "bounds_checking_function", "protobuf", "icu", - "abseil-cpp" + "abseil-cpp", + "typescript" ], "third_party": [] }, "build": { "sub_component": [ - "//arkcompiler/ets_frontend:ets_frontend_build" + "//arkcompiler/ets_frontend:ets_frontend_build", + "//arkcompiler/ets_frontend/ets2panda:libes2panda_public(//build/toolchain/linux:clang_x64)" ], "inner_kits": [ { @@ -44,6 +46,12 @@ }, { "name": "//arkcompiler/ets_frontend/ets2panda:libes2panda_public" + }, + { + "name": "//arkcompiler/ets_frontend/ets2panda:libes2panda_public_headers" + }, + { + "name": "//arkcompiler/ets_frontend/arkguard:build_arkguard_etc" } ], "test": [ diff --git a/ets2panda/BUILD.gn b/ets2panda/BUILD.gn index 056ee80391..1661dce2dc 100644 --- a/ets2panda/BUILD.gn +++ b/ets2panda/BUILD.gn @@ -32,7 +32,7 @@ config("libes2panda_public_config") { "$ark_es2panda_root", ] if (ark_standalone_build || ark_static_standalone_build) { - include_dirs += [ + include_dirs += [ "$target_gen_dir/generated", "//third_party/icu/icu4c/source/common", "//third_party/icu/icu4c/source/i18n", @@ -116,6 +116,7 @@ libes2panda_sources = [ "checker/types/ets/etsAnyType.cpp", "checker/types/ets/etsArrayType.cpp", "checker/types/ets/etsAsyncFuncReturnType.cpp", + "checker/types/ets/etsAwaitedType.cpp", "checker/types/ets/etsBigIntType.cpp", "checker/types/ets/etsBooleanType.cpp", "checker/types/ets/etsEnumType.cpp", @@ -127,7 +128,6 @@ libes2panda_sources = [ "checker/types/ets/etsObjectType.cpp", "checker/types/ets/etsPartialTypeParameter.cpp", "checker/types/ets/etsReadonlyType.cpp", - "checker/types/ets/etsAwaitedType.cpp", "checker/types/ets/etsResizableArrayType.cpp", "checker/types/ets/etsStringType.cpp", "checker/types/ets/etsTupleType.cpp", @@ -1266,6 +1266,22 @@ ohos_shared_library("libes2panda_public") { subsystem_name = "arkcompiler" } +if (!(defined(ark_static_standalone_build) && ark_static_standalone_build)) { + ohos_shared_headers("libes2panda_public_headers") { + include_dirs = [ "$ark_es2panda_root/public" ] + deps = [ + ":gen_${LIB_NAME}_decl_inc", + ":gen_${LIB_NAME}_enums_inc", + ":gen_${LIB_NAME}_idl", + ":gen_${LIB_NAME}_impl_inc", + ":gen_${LIB_NAME}_include_inc", + ":gen_${LIB_NAME}_list_inc", + ] + part_name = "ets_frontend" + subsystem_name = "arkcompiler" + } +} + action("generate_ets2panda_info") { script = "$ark_root/gn/build/es2panda_info.sh" outputs = [ "$target_gen_dir/generated/es2panda_build_info.h" ] @@ -1299,8 +1315,8 @@ ohos_source_set("libes2panda_public_frontend_static") { "$ark_root/assembler:libarktsassembler", "$ark_root/bytecode_optimizer:libarktsbytecodeopt_package", "$ark_root/compiler:libarktscompiler", - "$ark_root/libpandabase:libarktsbase", "$ark_root/libarkfile:libarktsfile", + "$ark_root/libpandabase:libarktsbase", ] } else { external_deps += [ -- Gitee