From a364876bea55a29615384e3480ee50540cd860e3 Mon Sep 17 00:00:00 2001 From: lordwithcc Date: Thu, 15 Sep 2022 11:37:27 +0800 Subject: [PATCH] Remove Ark templete and modify path Signed-off-by: lordwithcc --- es2panda/BUILD.gn | 38 ++++++++---- ets_frontend_config.gni | 2 +- merge_abc/BUILD.gn | 34 ++++++---- ts2panda/ts2abc/BUILD.gn | 123 +++++++++++++++++-------------------- ts2panda/ts2abc_config.gni | 7 ++- 5 files changed, 108 insertions(+), 96 deletions(-) diff --git a/es2panda/BUILD.gn b/es2panda/BUILD.gn index 17dff9d9cd..59ac014e56 100644 --- a/es2panda/BUILD.gn +++ b/es2panda/BUILD.gn @@ -11,9 +11,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//arkcompiler/ets_frontend/ets_frontend_config.gni") -import("//arkcompiler/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_standalone_build)) { + import("//arkcompiler/ets_frontend/ets_frontend_config.gni") + import("//arkcompiler/runtime_core/ark_config.gni") + import("//build/ohos.gni") + third_party_gn_path = "//third_party" + runtime_core_root = "//arkcompiler/runtime_core" +} else { + import("//ets_frontend/ets_frontend_config.gni") + import("//runtime_core/ark_config.gni") + import("$build_root/ark.gni") + third_party_gn_path = "//toolchain/build/third_party_gn" + runtime_core_root = "//runtime_core" +} es2panda_src = [ "es2panda.cpp", @@ -328,7 +338,7 @@ isa_gen = "${ark_root}/isa/gen.rb" isa_gen_data = "$root_gen_dir/isa/isa.yaml" isa_gen_require = "${ark_root}/isa/isapi.rb" action_foreach("gen_isa_headers") { - deps = [ "//arkcompiler/runtime_core/isa:isa_combine" ] + deps = [ "$runtime_core_root/isa:isa_combine" ] template_files = [ "isa.h.erb", @@ -384,7 +394,7 @@ ohos_static_library("es2panda_lib") { "$ark_root/libpandabase:libarkbase_frontend_static", "$ark_root/libpandafile:libarkfile_frontend_static", "$ark_root/libziparchive:libarkziparchive_frontend_static", - "//third_party/icu/icu4c:static_icuuc", + "$third_party_gn_path/icu/icu4c:static_icuuc", ] if (enable_bytecode_optimizer) { @@ -411,12 +421,12 @@ ohos_executable("es2panda") { configs = [ ":es2abc_config_common", - "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_public_config", + "$ets_frontend_root/merge_abc:panda_assembly_proto_public_config", ] deps = [ ":es2panda_lib", - "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_static", + "$ets_frontend_root/merge_abc:panda_assembly_proto_static", ] ldflags = [] @@ -525,11 +535,13 @@ group("es2panda_build") { } } -group("es2panda_build_win") { - deps = [ ":es2panda(${toolchain_win})" ] -} +if (!defined(ark_standalone_build)) { + group("es2panda_build_win") { + deps = [ ":es2panda(${toolchain_win})" ] + } -group("es2abc_tests") { - deps = [ "./test:es2abc_parser_tests" ] - deps += [ "./test:es2abc_compiler_tests" ] + group("es2abc_tests") { + deps = [ "./test:es2abc_parser_tests" ] + deps += [ "./test:es2abc_compiler_tests" ] + } } diff --git a/ets_frontend_config.gni b/ets_frontend_config.gni index b4a3c1928a..df6b9e1b4f 100644 --- a/ets_frontend_config.gni +++ b/ets_frontend_config.gni @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -if (defined(ark_independent_build)) { +if (defined(ark_standalone_build)) { ets_frontend_root = "//ets_frontend" } else { build_root = "//build" diff --git a/merge_abc/BUILD.gn b/merge_abc/BUILD.gn index 24b6ce5351..5f10118637 100644 --- a/merge_abc/BUILD.gn +++ b/merge_abc/BUILD.gn @@ -11,11 +11,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//arkcompiler/ets_frontend/ets_frontend_config.gni") -import("//arkcompiler/runtime_core/ark_config.gni") -import("//build/config/clang/clang.gni") -import("//build/ohos.gni") -import("//developtools/profiler/build/config.gni") +if (!defined(ark_standalone_build)) { + import("//arkcompiler/ets_frontend/ets_frontend_config.gni") + import("//arkcompiler/runtime_core/ark_config.gni") + import("//build/config/clang/clang.gni") + import("//build/ohos.gni") + import("//developtools/profiler/build/config.gni") +} else { + import("//ets_frontend/ets_frontend_config.gni") + import("//profiler//build/config.gni") + import("//runtime_core/ark_config.gni") + import("$build_root/ark.gni") + import("$build_root/config/clang/clang.gni") +} proto_base_dir = "protos" proto_out_dir = "$target_gen_dir" + "/protos_generated" @@ -50,7 +58,7 @@ config("panda_assembly_proto_public_config") { "//third_party/protobuf/src", "//third_party/protobuf/src/google", "//third_party/protobuf/src/google/protobuf", - "//arkcompiler/ets_frontend/es2panda/util", + "$ets_frontend_root/ets_frontend/es2panda/util", ] } @@ -106,7 +114,7 @@ host_protoc_path = root_out_dir + host_out_path + "/" + protoc_binary_out_path + "/protoc" action("arkcompiler_generate_proto") { - deps = [ "//third_party/protobuf:protoc($host_toolchain)" ] + deps = [ "$ark_third_party_root/protobuf:protoc($host_toolchain)" ] args = [] sources = [] outputs = proto_generated_header + proto_generated_source @@ -137,8 +145,8 @@ ohos_source_set("assembly_proto_static") { deps = [ ":arkcompiler_generate_proto", - "//third_party/protobuf:protobuf_lite_static", - "//third_party/protobuf:protobuf_static", + "$ark_third_party_root/protobuf:protobuf_lite_static", + "$ark_third_party_root/protobuf:protobuf_static", ] sources = proto_generated_header + proto_generated_source + @@ -176,7 +184,7 @@ ohos_executable("merge_abc") { "$ark_root/libpandabase:libarkbase_frontend_static", "$ark_root/libpandafile:libarkfile_frontend_static", "$ark_root/libziparchive:libarkziparchive_frontend_static", - "//third_party/icu/icu4c:static_icuuc", + "$ark_third_party_root/icu/icu4c:static_icuuc", ] ldflags = [] @@ -280,6 +288,8 @@ group("merge_proto_abc_build") { } } -group("merge_proto_abc_build_win") { - deps = [ ":merge_abc(${toolchain_win})" ] +if (!defined(ark_standalone_build)) { + group("merge_proto_abc_build_win") { + deps = [ ":merge_abc(${toolchain_win})" ] + } } diff --git a/ts2panda/ts2abc/BUILD.gn b/ts2panda/ts2abc/BUILD.gn index a6ee96c5ab..074d7ba723 100755 --- a/ts2panda/ts2abc/BUILD.gn +++ b/ts2panda/ts2abc/BUILD.gn @@ -11,13 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -if (!defined(ark_independent_build)) { - import("//arkcompiler/runtime_core/ark_config.gni") - import("//build/ohos.gni") -} else { - import("//runtime_core/ark_config.gni") - import("$build_root/ark.gni") -} +import("//arkcompiler/runtime_core/ark_config.gni") +import("//build/ohos.gni") jsoncpp_root = "$ark_third_party_root/jsoncpp" @@ -69,77 +64,71 @@ source_set("jsoncpp_set_static") { ] } -if (!defined(ark_independent_build)) { - ohos_static_library("jsoncpp_static") { - deps = [ ":jsoncpp_set_static" ] - use_exceptions = true - subsystem_name = "ark" - part_name = "ark_frontend_tool" - } +ohos_static_library("jsoncpp_static") { + deps = [ ":jsoncpp_set_static" ] + use_exceptions = true + subsystem_name = "ark" + part_name = "ark_frontend_tool" +} - ohos_executable("ts2abc") { - sources = [ - "main.cpp", - "ts2abc.cpp", - ] +ohos_executable("ts2abc") { + sources = [ + "main.cpp", + "ts2abc.cpp", + ] - configs = [ ":ts2abc_config" ] + configs = [ ":ts2abc_config" ] - cflags = [ - "-Wno-c++20-designator", - "-Wno-c99-extensions", - "-Wno-unknown-warning-option", - ] + cflags = [ + "-Wno-c++20-designator", + "-Wno-c99-extensions", + "-Wno-unknown-warning-option", + ] - deps = [ - "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_static", - sdk_libc_secshared_dep, - ] + deps = [ + "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_static", + sdk_libc_secshared_dep, + ] - if (is_linux || is_mingw || is_mac) { + if (is_linux || is_mingw || is_mac) { + deps += [ + "$ark_root/assembler:libarkassembler_frontend_static", + "$ark_root/libpandabase:libarkbase_frontend_static", + "$ark_root/libpandafile:libarkfile_frontend_static", + "$ark_root/libziparchive:libarkziparchive_frontend_static", + "//third_party/jsoncpp:jsoncpp_static", + ] + if (enable_bytecode_optimizer) { deps += [ - "$ark_root/assembler:libarkassembler_frontend_static", - "$ark_root/libpandabase:libarkbase_frontend_static", - "$ark_root/libpandafile:libarkfile_frontend_static", - "$ark_root/libziparchive:libarkziparchive_frontend_static", - "//third_party/jsoncpp:jsoncpp_static", + "$ark_root/bytecode_optimizer:libarkbytecodeopt_frontend_static", + "$ark_root/compiler:libarkcompiler_frontend_static", ] - if (enable_bytecode_optimizer) { - deps += [ - "$ark_root/bytecode_optimizer:libarkbytecodeopt_frontend_static", - "$ark_root/compiler:libarkcompiler_frontend_static", - ] - } - } else { + } + } else { + deps += [ + "$ark_root/assembler:libarkassembler", + "$ark_root/libpandabase:libarkbase", + "$ark_root/libpandafile:libarkfile", + "$ark_root/libziparchive:libarkziparchive", + "$jsoncpp_root:jsoncpp", + ] + if (enable_bytecode_optimizer) { deps += [ - "$ark_root/assembler:libarkassembler", - "$ark_root/libpandabase:libarkbase", - "$ark_root/libpandafile:libarkfile", - "$ark_root/libziparchive:libarkziparchive", - "$jsoncpp_root:jsoncpp", + "$ark_root/bytecode_optimizer:libarkbytecodeopt", + "$ark_root/compiler:libarkcompiler", ] - if (enable_bytecode_optimizer) { - deps += [ - "$ark_root/bytecode_optimizer:libarkbytecodeopt", - "$ark_root/compiler:libarkcompiler", - ] - } } + } - if (is_linux) { - if (build_public_version) { - ldflags = [ "-static-libstdc++" ] - } else { - libs = [ libcpp_static_lib ] - } + if (is_linux) { + if (build_public_version) { + ldflags = [ "-static-libstdc++" ] + } else { + libs = [ libcpp_static_lib ] } - - output_name = "js2abc" - install_enable = true - subsystem_name = "ark" - } -} else { - ark_static_library("jsoncpp_static") { - deps = [ ":jsoncpp_set_static" ] } + + output_name = "js2abc" + install_enable = true + subsystem_name = "ark" } diff --git a/ts2panda/ts2abc_config.gni b/ts2panda/ts2abc_config.gni index 01d9002487..3ffb0ef780 100755 --- a/ts2panda/ts2abc_config.gni +++ b/ts2panda/ts2abc_config.gni @@ -10,15 +10,16 @@ # 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. -import("//arkcompiler/ets_frontend/ets_frontend_config.gni") -if (!defined(ark_independent_build)) { +if (!defined(ark_standalone_build)) { + import("//arkcompiler/ets_frontend/ets_frontend_config.gni") import("//build/ohos.gni") import("//build/test.gni") build_root = "//build" ts2abc_root = "//arkcompiler/ets_frontend/ts2panda" } else { + import("//ets_frontend/ets_frontend_config.gni") import("$build_root/ark.gni") - ts2abc_root = "//arkcompiler/ets_frontend/ts2panda" + ts2abc_root = "//ets_frontend/ts2panda" } declare_args() { -- Gitee