diff --git a/ets2panda/BUILD.gn b/ets2panda/BUILD.gn index 18f112daff077f695d9b7a2b13170291490e1a6f..26cfe696d5910618e974307a75a62c9eaaf4f955 100644 --- a/ets2panda/BUILD.gn +++ b/ets2panda/BUILD.gn @@ -18,6 +18,7 @@ if ((defined(ark_standalone_build) && ark_standalone_build) || import( "//build/config/components/runtime_core/static_core/ark_common_config.gni") } +import("//arkcompiler/ets_frontend/ets2panda/ets2abc_template.gni") if (ark_standalone_build) { import("$build_root/ark.gni") @@ -1192,7 +1193,7 @@ libes2panda_public_configs += [ ":libes2panda_config", ] -ohos_shared_library("libes2panda") { +ark_frontend_shared_library("libes2panda") { deps = [ ":libes2panda_frontend_static" ] output_extension = "so" part_name = "ets_frontend" @@ -1248,7 +1249,7 @@ ohos_source_set("libes2panda_frontend_static") { subsystem_name = "arkcompiler" } -ohos_shared_library("libes2panda_public") { +ark_frontend_shared_library("libes2panda_public") { configs = [ ":libes2panda_config" ] deps = [ ":libes2panda_public_frontend_static" ] if (is_mingw || is_win) { diff --git a/ets2panda/aot/BUILD.gn b/ets2panda/aot/BUILD.gn index a861d7d1a4751dc7daa6d89d5dceff79f7fda1e0..4c2c4b08c2c046658cc74e496422de59efdf55bc 100644 --- a/ets2panda/aot/BUILD.gn +++ b/ets2panda/aot/BUILD.gn @@ -18,6 +18,7 @@ if ((defined(ark_standalone_build) && ark_standalone_build) || import( "//build/config/components/runtime_core/static_core/ark_common_config.gni") } +import("//arkcompiler/ets_frontend/ets2panda/ets2abc_template.gni") if (ark_standalone_build) { import("$build_root/ark.gni") @@ -25,7 +26,7 @@ if (ark_standalone_build) { import("//build/ohos.gni") } -ohos_executable("ets2panda") { +ark_frontend_executable("ets2panda") { sources = [ "main.cpp" ] include_dirs = [ diff --git a/ets2panda/declgen_ets2ts/BUILD.gn b/ets2panda/declgen_ets2ts/BUILD.gn index 6fdca2dbfb45ed3f26ba8ca3421a2dc8248957aa..457387e6364a81a0145381e018bde5414b8df194 100644 --- a/ets2panda/declgen_ets2ts/BUILD.gn +++ b/ets2panda/declgen_ets2ts/BUILD.gn @@ -19,8 +19,9 @@ if ((defined(ark_standalone_build) && ark_standalone_build) || import( "//build/config/components/runtime_core/static_core/ark_common_config.gni") } +import("//arkcompiler/ets_frontend/ets2panda/ets2abc_template.gni") -ohos_executable("declgen_ets2ts") { +ark_frontend_executable("declgen_ets2ts") { sources = [ "isolatedDeclgenChecker.cpp", "declgenEts2Ts.cpp", diff --git a/ets2panda/driver/dependency_analyzer/BUILD.gn b/ets2panda/driver/dependency_analyzer/BUILD.gn index 0dedd66e582f20dc7cdbef64e224e50068f2b4fd..d98ae3f6e9638ac87307f85e5c343aab01c537ff 100644 --- a/ets2panda/driver/dependency_analyzer/BUILD.gn +++ b/ets2panda/driver/dependency_analyzer/BUILD.gn @@ -19,8 +19,9 @@ if ((defined(ark_standalone_build) && ark_standalone_build) || import( "//build/config/components/runtime_core/static_core/ark_common_config.gni") } +import("//arkcompiler/ets_frontend/ets2panda/ets2abc_template.gni") -ohos_executable("dependency_analyzer") { +ark_frontend_executable("dependency_analyzer") { sources = [ "dep_analyzer.cpp", "main.cpp", diff --git a/ets2panda/ets2abc_template.gni b/ets2panda/ets2abc_template.gni new file mode 100644 index 0000000000000000000000000000000000000000..de3f2a37b99dc88e9af89c8c76b80daaf6ef0849 --- /dev/null +++ b/ets2panda/ets2abc_template.gni @@ -0,0 +1,57 @@ +# Copyright (c) 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# 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") +} + +declare_args() { + if (!defined(ark_frontend_rebuild)) { + ark_frontend_rebuild = false + } +} + +template("ark_frontend_shared_library") { + if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + ark_shared_library(target_name) { + forward_variables_from(invoker, "*") + force_rebuild = false + if (ark_frontend_rebuild) { + force_rebuild = true + } + } + } else { + ohos_shared_library(target_name) { + forward_variables_from(invoker, "*") + } + } +} + +template("ark_frontend_executable") { + if ((defined(ark_standalone_build) && ark_standalone_build) || + (defined(ark_static_standalone_build) && ark_static_standalone_build)) { + ark_executable(target_name) { + forward_variables_from(invoker, "*") + force_rebuild = false + if (ark_frontend_rebuild) { + force_rebuild = true + } + } + } else { + ohos_executable(target_name) { + forward_variables_from(invoker, "*") + } + } +} diff --git a/ets2panda/lsp/BUILD.gn b/ets2panda/lsp/BUILD.gn index 5927ee5e6810eedf918db2d3578f072f8c86fcb8..9eab7115dc48d37a0fd2e0e6ab676c1fe18b7cb1 100644 --- a/ets2panda/lsp/BUILD.gn +++ b/ets2panda/lsp/BUILD.gn @@ -18,6 +18,7 @@ if ((defined(ark_standalone_build) && ark_standalone_build) || import( "//build/config/components/runtime_core/static_core/ark_common_config.gni") } +import("//arkcompiler/ets_frontend/ets2panda/ets2abc_template.gni") if (ark_standalone_build) { import("$build_root/ark.gni") @@ -147,7 +148,7 @@ ohos_source_set("libes2panda_lsp_static") { subsystem_name = "arkcompiler" } -ohos_shared_library("libes2panda_lsp") { +ark_frontend_shared_library("libes2panda_lsp") { deps = [ ":libes2panda_lsp_static" ] output_extension = "so" part_name = "ets_frontend"