123b3eb3cSopenharmony_ci# Copyright (c) 2022 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_ci 1723b3eb3cSopenharmony_ciinstall_path = "SADialog" 1823b3eb3cSopenharmony_citemplate("gen_sa_dialog_js") { 1923b3eb3cSopenharmony_ci forward_variables_from(invoker, "*") 2023b3eb3cSopenharmony_ci 2123b3eb3cSopenharmony_ci action("build_dialog_js") { 2223b3eb3cSopenharmony_ci nodejs_path = "//prebuilts/build-tools/common/nodejs/current/bin" 2323b3eb3cSopenharmony_ci 2423b3eb3cSopenharmony_ci project_path = invoker.project_path 2523b3eb3cSopenharmony_ci script = "//foundation/arkui/ace_engine/build/tools/build_js.py" 2623b3eb3cSopenharmony_ci outputs = [ 2723b3eb3cSopenharmony_ci target_out_dir + "/default/app.js", 2823b3eb3cSopenharmony_ci target_out_dir + "/default/pages/index/index.js", 2923b3eb3cSopenharmony_ci target_out_dir + "/default/manifest.json", 3023b3eb3cSopenharmony_ci ] 3123b3eb3cSopenharmony_ci 3223b3eb3cSopenharmony_ci if (defined(i18n_files)) { 3323b3eb3cSopenharmony_ci foreach(i18n_file, i18n_files) { 3423b3eb3cSopenharmony_ci outputs += [ target_out_dir + "/default/" + i18n_file ] 3523b3eb3cSopenharmony_ci } 3623b3eb3cSopenharmony_ci } 3723b3eb3cSopenharmony_ci 3823b3eb3cSopenharmony_ci if (defined(common_files)) { 3923b3eb3cSopenharmony_ci foreach(common_file, common_files) { 4023b3eb3cSopenharmony_ci outputs += [ target_out_dir + "/default/" + common_file ] 4123b3eb3cSopenharmony_ci } 4223b3eb3cSopenharmony_ci } 4323b3eb3cSopenharmony_ci 4423b3eb3cSopenharmony_ci args = [ 4523b3eb3cSopenharmony_ci rebase_path(project_path, root_build_dir), 4623b3eb3cSopenharmony_ci rebase_path(target_out_dir, root_build_dir), 4723b3eb3cSopenharmony_ci rebase_path(nodejs_path, root_build_dir), 4823b3eb3cSopenharmony_ci rebase_path("//developtools/ace_js2bundle", root_build_dir), 4923b3eb3cSopenharmony_ci rebase_path("//interface", root_build_dir), 5023b3eb3cSopenharmony_ci rebase_path("//third_party/parse5", root_build_dir), 5123b3eb3cSopenharmony_ci rebase_path("//third_party/weex-loader", root_build_dir), 5223b3eb3cSopenharmony_ci ] 5323b3eb3cSopenharmony_ci } 5423b3eb3cSopenharmony_ci 5523b3eb3cSopenharmony_ci ohos_prebuilt_etc("dialog_js_files_app") { 5623b3eb3cSopenharmony_ci deps = [ ":build_dialog_js" ] 5723b3eb3cSopenharmony_ci relative_install_dir = "$install_path/$dialog_name" 5823b3eb3cSopenharmony_ci source = target_out_dir + "/default/app.js" 5923b3eb3cSopenharmony_ci } 6023b3eb3cSopenharmony_ci 6123b3eb3cSopenharmony_ci ohos_prebuilt_etc("dialog_js_files_index") { 6223b3eb3cSopenharmony_ci deps = [ ":build_dialog_js" ] 6323b3eb3cSopenharmony_ci relative_install_dir = "$install_path/$dialog_name/pages/index" 6423b3eb3cSopenharmony_ci source = target_out_dir + "/default/pages/index/index.js" 6523b3eb3cSopenharmony_ci } 6623b3eb3cSopenharmony_ci 6723b3eb3cSopenharmony_ci if (defined(i18n_files)) { 6823b3eb3cSopenharmony_ci foreach(i18n_file, i18n_files) { 6923b3eb3cSopenharmony_ci name = string_replace(i18n_file, "/", "_") 7023b3eb3cSopenharmony_ci ohos_prebuilt_etc("dialog_js_files_$name") { 7123b3eb3cSopenharmony_ci deps = [ ":build_dialog_js" ] 7223b3eb3cSopenharmony_ci relative_install_dir = "$install_path/$dialog_name/i18n" 7323b3eb3cSopenharmony_ci source = target_out_dir + "/default/$i18n_file" 7423b3eb3cSopenharmony_ci } 7523b3eb3cSopenharmony_ci } 7623b3eb3cSopenharmony_ci } 7723b3eb3cSopenharmony_ci 7823b3eb3cSopenharmony_ci if (defined(common_files)) { 7923b3eb3cSopenharmony_ci foreach(common_file, common_files) { 8023b3eb3cSopenharmony_ci name = string_replace(common_file, "/", "_") 8123b3eb3cSopenharmony_ci ohos_prebuilt_etc("dialog_js_files_$name") { 8223b3eb3cSopenharmony_ci deps = [ ":build_dialog_js" ] 8323b3eb3cSopenharmony_ci relative_install_dir = "$install_path/$dialog_name/common" 8423b3eb3cSopenharmony_ci source = target_out_dir + "/default/$common_file" 8523b3eb3cSopenharmony_ci } 8623b3eb3cSopenharmony_ci } 8723b3eb3cSopenharmony_ci } 8823b3eb3cSopenharmony_ci 8923b3eb3cSopenharmony_ci ohos_prebuilt_etc("dialog_js_files_manifest") { 9023b3eb3cSopenharmony_ci deps = [ ":build_dialog_js" ] 9123b3eb3cSopenharmony_ci relative_install_dir = "$install_path/$dialog_name" 9223b3eb3cSopenharmony_ci source = target_out_dir + "/default/manifest.json" 9323b3eb3cSopenharmony_ci } 9423b3eb3cSopenharmony_ci 9523b3eb3cSopenharmony_ci group(target_name) { 9623b3eb3cSopenharmony_ci deps = [ 9723b3eb3cSopenharmony_ci ":dialog_js_files_app", 9823b3eb3cSopenharmony_ci ":dialog_js_files_index", 9923b3eb3cSopenharmony_ci ":dialog_js_files_manifest", 10023b3eb3cSopenharmony_ci ] 10123b3eb3cSopenharmony_ci if (defined(i18n_files)) { 10223b3eb3cSopenharmony_ci foreach(i18n_file, i18n_files) { 10323b3eb3cSopenharmony_ci name = string_replace(i18n_file, "/", "_") 10423b3eb3cSopenharmony_ci deps += [ ":dialog_js_files_$name" ] 10523b3eb3cSopenharmony_ci } 10623b3eb3cSopenharmony_ci } 10723b3eb3cSopenharmony_ci if (defined(common_files)) { 10823b3eb3cSopenharmony_ci foreach(common_file, common_files) { 10923b3eb3cSopenharmony_ci name = string_replace(common_file, "/", "_") 11023b3eb3cSopenharmony_ci deps += [ ":dialog_js_files_$name" ] 11123b3eb3cSopenharmony_ci } 11223b3eb3cSopenharmony_ci } 11323b3eb3cSopenharmony_ci } 11423b3eb3cSopenharmony_ci} 115