1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//build/ohos/notice/notice.gni") 16import("//build/ohos_var.gni") 17import("//build/templates/metadata/module_info.gni") 18import("interface_config.gni") 19 20template("ohos_copy_internal") { 21 forward_variables_from(invoker, "*") 22 iv_input = invoker.iv_input 23 ohos_copy(target_name) { 24 process_script = "//interface/sdk-js/process_internal.py" 25 process_arguments = [ 26 "--input", 27 rebase_path(iv_input, root_build_dir), 28 "--remove", 29 rebase_path("//interface/sdk-js/remove_list.json", root_build_dir), 30 "--ispublic", 31 "${sdk_build_public}", 32 "--name", 33 "$target_name", 34 ] 35 sources = exec_script(process_script, process_arguments, "value") 36 outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] 37 module_source_dir = target_out_dir + "/$target_name" 38 module_install_name = "" 39 } 40} 41 42ohos_copy("bundle_kits") { 43 if (sdk_build_public || product_name == "ohos-sdk") { 44 sources = [ "//out/sdk-public/public_interface/sdk-js/kits" ] 45 } else { 46 sources = [ "//interface/sdk-js/kits" ] 47 } 48 outputs = [ target_out_dir + "/$target_name" ] 49 module_source_dir = target_out_dir + "/$target_name" 50 module_install_name = "" 51} 52 53ohos_copy("bundle_arkts") { 54 sources = [ "//interface/sdk-js/arkts" ] 55 outputs = [ target_out_dir + "/$target_name" ] 56 module_source_dir = target_out_dir + "/$target_name" 57 module_install_name = "" 58 license_file = "./LICENCE.md" 59} 60 61ohos_copy_internal("ets_internal_api") { 62 iv_input = "//interface/sdk-js/api/@internal/ets" 63} 64 65ohos_copy_internal("ets_component") { 66 iv_input = "//interface/sdk-js/api/@internal/component/ets" 67} 68 69if (!(defined(is_arkui_x) && is_arkui_x)) { 70 ohos_copy("device_define_common") { 71 process_script = "//developtools/syscap_codec/tools/syscap_collector.py" 72 exec_script(process_script) 73 sources = [ "//interface/sdk-js/api/device-define-common" ] 74 outputs = [ target_out_dir + "/$target_name" ] 75 module_source_dir = target_out_dir + "/$target_name" 76 module_install_name = "" 77 } 78} 79 80ohos_copy("common_api") { 81 sources = common_api_src 82 outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] 83 module_source_dir = target_out_dir + "/$target_name" 84 module_install_name = "" 85} 86 87if (!sdk_build_public) { 88 ohos_copy("bundle_api") { 89 sources = [ "api/bundle/bundleStatusCallback.d.ts" ] 90 outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] 91 module_source_dir = target_out_dir + "/$target_name" 92 module_install_name = "" 93 } 94} 95 96template("ohos_declaration_template") { 97 forward_variables_from(invoker, "*") 98 _module_info_target = "/ohos_declaration/${target_name}_info" 99 action_with_pydeps(target_name) { 100 script = "//interface/sdk-js/remove_internal.py" 101 input_api_dir = "//interface/sdk-js/api" 102 inputs = [ "//interface/sdk-js/api" ] 103 outputs = [ root_out_dir + "/ohos_declaration/$target_name" ] 104 if (sdk_build_public || product_name == "ohos-sdk") { 105 script = "//out/sdk-public/public_interface/sdk-js/remove_internal.py" 106 input_api_dir = "//out/sdk-public/public_interface/sdk-js/api" 107 } 108 args = [ 109 "--input", 110 rebase_path(input_api_dir, root_build_dir), 111 "--output", 112 rebase_path(root_out_dir + "/ohos_declaration/$target_name/", 113 root_build_dir), 114 ] 115 if (defined(deps)) { 116 deps += [ ":$_module_info_target" ] 117 } else { 118 deps = [ ":$_module_info_target" ] 119 } 120 } 121 _target_name = target_name 122 generate_module_info(_module_info_target) { 123 module_type = "jsdoc" 124 module_install_name = "" 125 module_name = _target_name 126 module_source_dir = root_out_dir + "/ohos_declaration/$_target_name" 127 install_enable = false 128 } 129} 130 131ohos_declaration_template("ohos_declaration_ets") { 132} 133ohos_declaration_template("ohos_declaration_common") { 134} 135 136ohos_copy_internal("internal_full") { 137 iv_input = "//interface/sdk-js/api/common/full" 138} 139 140ohos_copy_internal("internal_lite") { 141 iv_input = "//interface/sdk-js/api/common/lite" 142} 143 144ohos_copy("syscap_check") { 145 sources = [ "api/syscapCheck/sysCapSchema.json" ] 146 outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] 147 module_source_dir = target_out_dir + "/$target_name" 148 module_install_name = "" 149} 150 151ohos_copy("config") { 152 sources = [ 153 "api/config/css", 154 "api/config/hml", 155 ] 156 outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] 157 module_source_dir = target_out_dir + "/$target_name" 158 module_install_name = "" 159} 160 161ohos_copy("form_declaration") { 162 sources = [ 163 "api/form/action", 164 "api/form/css", 165 "api/form/hml", 166 ] 167 outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] 168 module_source_dir = target_out_dir + "/$target_name" 169 module_install_name = "" 170} 171