123b3eb3cSopenharmony_ci# Copyright (c) 2021-2023 Huawei Device Co., Ltd. 223b3eb3cSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 323b3eb3cSopenharmony_ci# you may not use this file except in compliance with the License. 423b3eb3cSopenharmony_ci# You may obtain a copy of the License at 523b3eb3cSopenharmony_ci# 623b3eb3cSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 723b3eb3cSopenharmony_ci# 823b3eb3cSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 923b3eb3cSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1023b3eb3cSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1123b3eb3cSopenharmony_ci# See the License for the specific language governing permissions and 1223b3eb3cSopenharmony_ci# limitations under the License. 1323b3eb3cSopenharmony_ci 1423b3eb3cSopenharmony_ciimport("//build/ohos.gni") 1523b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/ace_config.gni") 1623b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/build/ace_lib.gni") 1723b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/interfaces/napi/kits/napi_lib.gni") 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ciif (is_ohos_standard_system) { 2023b3eb3cSopenharmony_ci system_resource_hap_path = 2123b3eb3cSopenharmony_ci get_label_info("//base/global/system_resources/systemres:systemres_hap", 2223b3eb3cSopenharmony_ci "target_out_dir") + "/SystemResources.hap" 2323b3eb3cSopenharmony_ci system_resource_path = 2423b3eb3cSopenharmony_ci get_label_info("//base/global/system_resources/systemres:systemres_hap", 2523b3eb3cSopenharmony_ci "target_out_dir") + "/resources" 2623b3eb3cSopenharmony_ci system_resource_index_path = 2723b3eb3cSopenharmony_ci get_label_info("//base/global/system_resources/systemres:systemres_hap", 2823b3eb3cSopenharmony_ci "target_gen_dir") + "/main_res/gen/resources.index" 2923b3eb3cSopenharmony_ci system_resource_value_path = 3023b3eb3cSopenharmony_ci get_label_info("//base/global/system_resources/systemres:systemres_hap", 3123b3eb3cSopenharmony_ci "target_out_dir") + "/resources/entry/resources.txt" 3223b3eb3cSopenharmony_ci} else { 3323b3eb3cSopenharmony_ci system_resource_hap_path = 3423b3eb3cSopenharmony_ci get_label_info("//base/global/system_resources/systemres:systemres_hap", 3523b3eb3cSopenharmony_ci "target_gen_dir") + "/SystemResources.hap" 3623b3eb3cSopenharmony_ci system_resource_path = 3723b3eb3cSopenharmony_ci get_label_info("//base/global/system_resources/systemres:systemres_hap", 3823b3eb3cSopenharmony_ci "target_gen_dir") + "/resources" 3923b3eb3cSopenharmony_ci system_resource_index_path = 4023b3eb3cSopenharmony_ci get_label_info("//base/global/system_resources/systemres:systemres_hap", 4123b3eb3cSopenharmony_ci "target_gen_dir") + "/main_res/gen/resources.index" 4223b3eb3cSopenharmony_ci system_resource_value_path = 4323b3eb3cSopenharmony_ci get_label_info("//base/global/system_resources/systemres:systemres_hap", 4423b3eb3cSopenharmony_ci "target_gen_dir") + "/resources/entry/resources.txt" 4523b3eb3cSopenharmony_ci} 4623b3eb3cSopenharmony_ci 4723b3eb3cSopenharmony_ciaction("get_system_resource") { 4823b3eb3cSopenharmony_ci script = "get_system_resources.sh" 4923b3eb3cSopenharmony_ci deps = [ "//base/global/system_resources/systemres:systemres_hap($current_toolchain)" ] 5023b3eb3cSopenharmony_ci args = [ 5123b3eb3cSopenharmony_ci rebase_path(system_resource_hap_path), 5223b3eb3cSopenharmony_ci rebase_path(system_resource_path), 5323b3eb3cSopenharmony_ci ] 5423b3eb3cSopenharmony_ci inputs = [ system_resource_hap_path ] 5523b3eb3cSopenharmony_ci outputs = [ system_resource_path ] 5623b3eb3cSopenharmony_ci} 5723b3eb3cSopenharmony_ci 5823b3eb3cSopenharmony_ciaction("extra_system_resource") { 5923b3eb3cSopenharmony_ci script = "./dump/dump.py" 6023b3eb3cSopenharmony_ci deps = [ "//base/global/system_resources/systemres:main_res" ] 6123b3eb3cSopenharmony_ci args = [ 6223b3eb3cSopenharmony_ci rebase_path(system_resource_index_path), 6323b3eb3cSopenharmony_ci rebase_path(system_resource_value_path), 6423b3eb3cSopenharmony_ci ] 6523b3eb3cSopenharmony_ci outputs = [ system_resource_value_path ] 6623b3eb3cSopenharmony_ci} 6723b3eb3cSopenharmony_ci 6823b3eb3cSopenharmony_ci# Triggered only when the SDK is compiled 6923b3eb3cSopenharmony_ciif (is_ohos_standard_system) { 7023b3eb3cSopenharmony_ci import("sharedlib_config.gni") 7123b3eb3cSopenharmony_ci 7223b3eb3cSopenharmony_ci foreach(module, napi_modules) { 7323b3eb3cSopenharmony_ci ohos_copy("copy_napi_${module.prefix}libs") { 7423b3eb3cSopenharmony_ci deps = [] 7523b3eb3cSopenharmony_ci sources = [] 7623b3eb3cSopenharmony_ci foreach(shard_lib, module.shard_libs) { 7723b3eb3cSopenharmony_ci subsystem_name = shard_lib.subsystem_name 7823b3eb3cSopenharmony_ci part_name = shard_lib.part_name 7923b3eb3cSopenharmony_ci deps += [ shard_lib.label ] 8023b3eb3cSopenharmony_ci out_path = get_label_info(shard_lib.label, "root_out_dir") 8123b3eb3cSopenharmony_ci lib_names = [] 8223b3eb3cSopenharmony_ci if (defined(shard_lib.lib_names)) { 8323b3eb3cSopenharmony_ci lib_names += shard_lib.lib_names 8423b3eb3cSopenharmony_ci } else { 8523b3eb3cSopenharmony_ci cur_lib = get_label_info(shard_lib.label, "name") 8623b3eb3cSopenharmony_ci lib_names += [ string_replace(cur_lib, "lib", "", 1) ] 8723b3eb3cSopenharmony_ci } 8823b3eb3cSopenharmony_ci foreach(lib_name, lib_names) { 8923b3eb3cSopenharmony_ci sources += [ "${out_path}/${subsystem_name}/${part_name}/lib${lib_name}${dylib_suffix}" ] 9023b3eb3cSopenharmony_ci } 9123b3eb3cSopenharmony_ci } 9223b3eb3cSopenharmony_ci 9323b3eb3cSopenharmony_ci # Set the output directory for all dynamic libraries. 9423b3eb3cSopenharmony_ci if (module.prefix == "") { 9523b3eb3cSopenharmony_ci module_source_dir = "${target_out_dir}/previewer/common/bin/module/" 9623b3eb3cSopenharmony_ci } else { 9723b3eb3cSopenharmony_ci module_source_dir = 9823b3eb3cSopenharmony_ci "${target_out_dir}/previewer/common/bin/module/${module.prefix}/" 9923b3eb3cSopenharmony_ci } 10023b3eb3cSopenharmony_ci outputs = [ "${module_source_dir}{{source_file_part}}" ] 10123b3eb3cSopenharmony_ci module_install_name = "" 10223b3eb3cSopenharmony_ci } 10323b3eb3cSopenharmony_ci } 10423b3eb3cSopenharmony_ci 10523b3eb3cSopenharmony_ci ohos_copy("copy_abc_library") { 10623b3eb3cSopenharmony_ci deps = [ 10723b3eb3cSopenharmony_ci "$ace_root/frameworks/bridge/declarative_frontend:ark_modifier", 10823b3eb3cSopenharmony_ci "$ace_root/frameworks/bridge/declarative_frontend:ark_theme_control", 10923b3eb3cSopenharmony_ci "$ace_root/frameworks/bridge/declarative_frontend:shape", 11023b3eb3cSopenharmony_ci "$ace_root/frameworks/bridge/declarative_frontend:uicontext", 11123b3eb3cSopenharmony_ci "$ace_root/frameworks/bridge/declarative_frontend:x_node", 11223b3eb3cSopenharmony_ci ] 11323b3eb3cSopenharmony_ci out_path = get_label_info( 11423b3eb3cSopenharmony_ci "$ace_root/frameworks/bridge/declarative_frontend:ark_modifier", 11523b3eb3cSopenharmony_ci "root_out_dir") 11623b3eb3cSopenharmony_ci sources = [ 11723b3eb3cSopenharmony_ci "${out_path}/arkui/ace_engine/modifier.abc", 11823b3eb3cSopenharmony_ci "${out_path}/arkui/ace_engine/node.abc", 11923b3eb3cSopenharmony_ci "${out_path}/arkui/ace_engine/shape.abc", 12023b3eb3cSopenharmony_ci "${out_path}/arkui/ace_engine/theme.abc", 12123b3eb3cSopenharmony_ci "${out_path}/arkui/ace_engine/uicontext.abc", 12223b3eb3cSopenharmony_ci ] 12323b3eb3cSopenharmony_ci 12423b3eb3cSopenharmony_ci outputs = [ target_out_dir + 12523b3eb3cSopenharmony_ci "/previewer/common/bin/module/arkui/{{source_file_part}}" ] 12623b3eb3cSopenharmony_ci module_source_dir = target_out_dir + "/previewer/common/bin/module/arkui" 12723b3eb3cSopenharmony_ci module_install_name = "" 12823b3eb3cSopenharmony_ci } 12923b3eb3cSopenharmony_ci 13023b3eb3cSopenharmony_ci # All dynamic libraries to be copied to the path "/previewer/common/bin/", 13123b3eb3cSopenharmony_ci # which are related to the previewer, can be added to this script. 13223b3eb3cSopenharmony_ci ohos_copy("copy_preview_shared_library") { 13323b3eb3cSopenharmony_ci deps = [] 13423b3eb3cSopenharmony_ci foreach(module, napi_modules) { 13523b3eb3cSopenharmony_ci if (!(host_os == "linux" && host_cpu == "arm64")) { 13623b3eb3cSopenharmony_ci deps += [ ":copy_napi_${module.prefix}libs" ] 13723b3eb3cSopenharmony_ci } 13823b3eb3cSopenharmony_ci } 13923b3eb3cSopenharmony_ci 14023b3eb3cSopenharmony_ci # The dynamic library here is used for local testing of the previewer. 14123b3eb3cSopenharmony_ci if (enable_glfw_window) { 14223b3eb3cSopenharmony_ci deps += [ "$ace_root/adapter/preview/entrance/samples:previewer_demo" ] 14323b3eb3cSopenharmony_ci } 14423b3eb3cSopenharmony_ci 14523b3eb3cSopenharmony_ci sources = [ 14623b3eb3cSopenharmony_ci "//third_party/icu/ohos_icu4j/data/icudt72l.dat", 14723b3eb3cSopenharmony_ci "//third_party/skia/src/ports/skia_ohos/config/fontconfig.json", 14823b3eb3cSopenharmony_ci ] 14923b3eb3cSopenharmony_ci 15023b3eb3cSopenharmony_ci foreach(item, common_bin) { 15123b3eb3cSopenharmony_ci subsystem_name = item.subsystem_name 15223b3eb3cSopenharmony_ci part_name = item.part_name 15323b3eb3cSopenharmony_ci deps += [ item.label ] 15423b3eb3cSopenharmony_ci out_path = get_label_info(item.label, "root_out_dir") 15523b3eb3cSopenharmony_ci lib_names = [] 15623b3eb3cSopenharmony_ci if (defined(item.lib_names)) { 15723b3eb3cSopenharmony_ci lib_names += item.lib_names 15823b3eb3cSopenharmony_ci } else { 15923b3eb3cSopenharmony_ci lib_names += 16023b3eb3cSopenharmony_ci [ string_replace(get_label_info(item.label, "name"), "lib", "", 1) ] 16123b3eb3cSopenharmony_ci } 16223b3eb3cSopenharmony_ci foreach(lib_name, lib_names) { 16323b3eb3cSopenharmony_ci sources += [ "${out_path}/${subsystem_name}/${part_name}/lib${lib_name}${dylib_suffix}" ] 16423b3eb3cSopenharmony_ci } 16523b3eb3cSopenharmony_ci } 16623b3eb3cSopenharmony_ci 16723b3eb3cSopenharmony_ci # Set the output directory for all dynamic libraries. 16823b3eb3cSopenharmony_ci outputs = [ target_out_dir + "/previewer/common/bin/{{source_file_part}}" ] 16923b3eb3cSopenharmony_ci module_source_dir = target_out_dir + "/previewer/common/bin/" 17023b3eb3cSopenharmony_ci module_install_name = "" 17123b3eb3cSopenharmony_ci } 17223b3eb3cSopenharmony_ci 17323b3eb3cSopenharmony_ci if (use_mingw_win) { 17423b3eb3cSopenharmony_ci ohos_copy("copy_preview_curl_cacert") { 17523b3eb3cSopenharmony_ci sources = [ "//third_party/curl/cacert.pem" ] 17623b3eb3cSopenharmony_ci outputs = [ target_out_dir + "/previewer/resources/cacert.pem" ] 17723b3eb3cSopenharmony_ci module_source_dir = target_out_dir + "/previewer/resources" 17823b3eb3cSopenharmony_ci module_install_name = "" 17923b3eb3cSopenharmony_ci } 18023b3eb3cSopenharmony_ci } 18123b3eb3cSopenharmony_ci 18223b3eb3cSopenharmony_ci ohos_copy("copy_system_resource_standard") { 18323b3eb3cSopenharmony_ci deps = [ 18423b3eb3cSopenharmony_ci ":extra_system_resource", 18523b3eb3cSopenharmony_ci ":get_system_resource", 18623b3eb3cSopenharmony_ci ] 18723b3eb3cSopenharmony_ci 18823b3eb3cSopenharmony_ci sources = [ system_resource_path ] 18923b3eb3cSopenharmony_ci 19023b3eb3cSopenharmony_ci outputs = [ target_out_dir + "/previewer/common/{{source_file_part}}" ] 19123b3eb3cSopenharmony_ci module_source_dir = target_out_dir + "/previewer/common" 19223b3eb3cSopenharmony_ci module_install_name = "" 19323b3eb3cSopenharmony_ci } 19423b3eb3cSopenharmony_ci} else { 19523b3eb3cSopenharmony_ci ohos_copy("copy_system_resource") { 19623b3eb3cSopenharmony_ci if (use_mac) { 19723b3eb3cSopenharmony_ci sources = [ "//prebuilts/ace-toolkit/preview/rich/resources" ] 19823b3eb3cSopenharmony_ci outputs = [ target_out_dir + "/tv_resources/{{source_file_part}}" ] 19923b3eb3cSopenharmony_ci module_source_dir = target_out_dir + "/tv_resources/" 20023b3eb3cSopenharmony_ci module_install_name = "" 20123b3eb3cSopenharmony_ci } else { 20223b3eb3cSopenharmony_ci deps = [ 20323b3eb3cSopenharmony_ci ":extra_system_resource", 20423b3eb3cSopenharmony_ci ":get_system_resource", 20523b3eb3cSopenharmony_ci ] 20623b3eb3cSopenharmony_ci 20723b3eb3cSopenharmony_ci sources = [ system_resource_path ] 20823b3eb3cSopenharmony_ci outputs = [ target_out_dir + "/tv_resources/{{source_file_part}}" ] 20923b3eb3cSopenharmony_ci module_source_dir = target_out_dir + "/tv_resources/" 21023b3eb3cSopenharmony_ci module_install_name = "" 21123b3eb3cSopenharmony_ci } 21223b3eb3cSopenharmony_ci } 21323b3eb3cSopenharmony_ci 21423b3eb3cSopenharmony_ci ohos_copy("copy_system_resource_wearable") { 21523b3eb3cSopenharmony_ci if (use_mac) { 21623b3eb3cSopenharmony_ci sources = [ "//prebuilts/ace-toolkit/preview/rich/resources" ] 21723b3eb3cSopenharmony_ci outputs = [ target_out_dir + "/wearable_resources/{{source_file_part}}" ] 21823b3eb3cSopenharmony_ci module_source_dir = target_out_dir + "/wearable_resources/" 21923b3eb3cSopenharmony_ci module_install_name = "" 22023b3eb3cSopenharmony_ci } else { 22123b3eb3cSopenharmony_ci deps = [ 22223b3eb3cSopenharmony_ci ":extra_system_resource", 22323b3eb3cSopenharmony_ci ":get_system_resource", 22423b3eb3cSopenharmony_ci ] 22523b3eb3cSopenharmony_ci 22623b3eb3cSopenharmony_ci sources = [ system_resource_path ] 22723b3eb3cSopenharmony_ci outputs = [ target_out_dir + "/wearable_resources/{{source_file_part}}" ] 22823b3eb3cSopenharmony_ci module_source_dir = target_out_dir + "/wearable_resources/" 22923b3eb3cSopenharmony_ci module_install_name = "" 23023b3eb3cSopenharmony_ci } 23123b3eb3cSopenharmony_ci } 23223b3eb3cSopenharmony_ci} 233