From d66f15d5296ba4a21f5d5c290359becead2a282d Mon Sep 17 00:00:00 2001 From: lijunru Date: Wed, 25 Jun 2025 18:08:29 +0800 Subject: [PATCH] Fix ohos independent build error Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICHSZV Signed-off-by: lijunru Change-Id: I4f367000f535c8cd0c4e366c964adc017d0b8aa6 --- ets2panda/BUILD.gn | 25 +++++++++++++++---- ets2panda/aot/BUILD.gn | 20 ++++++++++++--- ets2panda/bindings/BUILD.gn | 18 +++++++++++-- ets2panda/declgen_ets2ts/BUILD.gn | 20 ++++++++++++--- ets2panda/driver/dependency_analyzer/BUILD.gn | 22 +++++++++++----- ets2panda/lsp/BUILD.gn | 19 +++++++++++--- 6 files changed, 100 insertions(+), 24 deletions(-) diff --git a/ets2panda/BUILD.gn b/ets2panda/BUILD.gn index a7d027eff5..e85549d061 100644 --- a/ets2panda/BUILD.gn +++ b/ets2panda/BUILD.gn @@ -11,7 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//arkcompiler/runtime_core/static_core/ark_config.gni") +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") +} if (ark_standalone_build) { import("$build_root/ark.gni") @@ -1095,18 +1101,27 @@ config("libes2panda_config") { ] } -libes2panda_configs = [ +if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + libes2panda_configs = [ "$ark_root:ark_config" ] + libes2panda_public_configs = [ "$ark_root:ark_config" ] +} else { + libes2panda_configs = + [ "//build/config/components/runtime_core/static_core:ark_common_config" ] + libes2panda_public_configs = + [ "//build/config/components/runtime_core/static_core:ark_common_config" ] +} + +libes2panda_configs += [ "$ark_root/assembler:arkassembler_public_config", - "$ark_root:ark_config", ":libes2panda_public_config", ":libes2panda_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", ] -libes2panda_public_configs = [ +libes2panda_public_configs += [ "$ark_root/assembler:arkassembler_public_config", - "$ark_root:ark_config", ":libes2panda_public_config", ":libes2panda_config", "$ark_root/libpandabase:arkbase_public_config", diff --git a/ets2panda/aot/BUILD.gn b/ets2panda/aot/BUILD.gn index 0a8d75cffd..7c369987eb 100644 --- a/ets2panda/aot/BUILD.gn +++ b/ets2panda/aot/BUILD.gn @@ -11,7 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//arkcompiler/runtime_core/static_core/ark_config.gni") +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") +} if (ark_standalone_build) { import("$build_root/ark.gni") @@ -26,9 +32,15 @@ ohos_executable("ets2panda") { "$target_gen_dir", "$target_gen_dir/include", ] - - configs = [ - "$ark_root:ark_config", + if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + configs = [ "$ark_root:ark_config" ] + } else { + configs = [ + "//build/config/components/runtime_core/static_core:ark_common_config", + ] + } + configs += [ "$ark_root/assembler:arkassembler_public_config", "$ark_es2panda_root:libes2panda_public_config", "$ark_root/libpandafile:arkfile_public_config", diff --git a/ets2panda/bindings/BUILD.gn b/ets2panda/bindings/BUILD.gn index e6dbc5c5f4..4a86840448 100644 --- a/ets2panda/bindings/BUILD.gn +++ b/ets2panda/bindings/BUILD.gn @@ -11,7 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//arkcompiler/runtime_core/static_core/ark_config.gni") +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") +} + if (ark_standalone_build) { import("$build_root/ark.gni") } else { @@ -27,9 +34,16 @@ shared_library("ts_bindings") { "./native/src/convertors-napi.cpp", "./native/src/lsp.cpp", ] + if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + configs += [ "$ark_root:ark_config" ] + } else { + configs += [ + "//build/config/components/runtime_core/static_core:ark_common_config", + ] + } configs += [ "$ark_root/assembler:arkassembler_public_config", - "$ark_root:ark_config", "../:libes2panda_public_config", "../:libes2panda_config", "$ark_root/libpandabase:arkbase_public_config", diff --git a/ets2panda/declgen_ets2ts/BUILD.gn b/ets2panda/declgen_ets2ts/BUILD.gn index 165a35a81f..7b6d95b385 100644 --- a/ets2panda/declgen_ets2ts/BUILD.gn +++ b/ets2panda/declgen_ets2ts/BUILD.gn @@ -11,8 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//arkcompiler/runtime_core/static_core/ark_config.gni") import("//build/ohos.gni") +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") +} ohos_executable("declgen_ets2ts") { sources = [ @@ -21,9 +27,15 @@ ohos_executable("declgen_ets2ts") { ] include_dirs = [ "$target_gen_dir" ] - - configs = [ - "$ark_root:ark_config", + if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + configs = [ "$ark_root:ark_config" ] + } else { + configs = [ + "//build/config/components/runtime_core/static_core:ark_common_config", + ] + } + configs += [ "$ark_es2panda_root:libes2panda_public_config", "$ark_root/assembler:arkassembler_public_config", "$ark_root/libpandafile:arkfile_public_config", diff --git a/ets2panda/driver/dependency_analyzer/BUILD.gn b/ets2panda/driver/dependency_analyzer/BUILD.gn index 8fc5e7492f..11142fd797 100644 --- a/ets2panda/driver/dependency_analyzer/BUILD.gn +++ b/ets2panda/driver/dependency_analyzer/BUILD.gn @@ -11,8 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//arkcompiler/runtime_core/static_core/ark_config.gni") import("//build/ohos.gni") +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") +} ohos_executable("dependency_analyzer") { sources = [ @@ -21,11 +27,15 @@ ohos_executable("dependency_analyzer") { ] include_dirs = [ "$target_gen_dir" ] - - configs = [ - "$ark_root:ark_config", - "$ark_es2panda_root:libes2panda_public_config", - ] + if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + configs = [ "$ark_root:ark_config" ] + } else { + configs = [ + "//build/config/components/runtime_core/static_core:ark_common_config", + ] + } + configs += [ "$ark_es2panda_root:libes2panda_public_config" ] deps = [ "$ark_es2panda_root:libes2panda_frontend_static", diff --git a/ets2panda/lsp/BUILD.gn b/ets2panda/lsp/BUILD.gn index 08ec8fd1b9..b9082e4bc7 100644 --- a/ets2panda/lsp/BUILD.gn +++ b/ets2panda/lsp/BUILD.gn @@ -11,7 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//arkcompiler/runtime_core/static_core/ark_config.gni") +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") +} if (ark_standalone_build) { import("$build_root/ark.gni") @@ -58,9 +64,16 @@ ohos_source_set("libes2panda_lsp_static") { "src/string_completions.cpp", "src/suggestion_diagnostics.cpp", ] - configs = [ + if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + configs = [ "$ark_root:ark_config" ] + } else { + configs = [ + "//build/config/components/runtime_core/static_core:ark_common_config", + ] + } + configs += [ "$ark_root/assembler:arkassembler_public_config", - "$ark_root:ark_config", "../:libes2panda_public_config", "../:libes2panda_config", "$ark_root/libpandabase:arkbase_public_config", -- Gitee