• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_internal("ets_internal_api") {
54  iv_input = "//interface/sdk-js/api/@internal/ets"
55}
56
57ohos_copy_internal("ets_component") {
58  iv_input = "//interface/sdk-js/api/@internal/component/ets"
59}
60
61if (!(defined(is_arkui_x) && is_arkui_x)) {
62  ohos_copy("device_define_common") {
63    process_script = "//developtools/syscap_codec/tools/syscap_collector.py"
64    exec_script(process_script)
65    sources = [ "//interface/sdk-js/api/device-define-common" ]
66    outputs = [ target_out_dir + "/$target_name" ]
67    module_source_dir = target_out_dir + "/$target_name"
68    module_install_name = ""
69  }
70}
71
72ohos_copy("common_api") {
73  sources = common_api_src
74  outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
75  module_source_dir = target_out_dir + "/$target_name"
76  module_install_name = ""
77}
78
79if (!sdk_build_public) {
80  ohos_copy("bundle_api") {
81    sources = [ "api/bundle/bundleStatusCallback.d.ts" ]
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}
87
88template("ohos_declaration_template") {
89  forward_variables_from(invoker, "*")
90  _module_info_target = "/ohos_declaration/${target_name}_info"
91  action_with_pydeps(target_name) {
92    script = "//interface/sdk-js/remove_internal.py"
93    input_api_dir = "//interface/sdk-js/api"
94    inputs = [ "//interface/sdk-js/api" ]
95    outputs = [ root_out_dir + "/ohos_declaration/$target_name" ]
96    if (sdk_build_public || product_name == "ohos-sdk") {
97      script = "//out/sdk-public/public_interface/sdk-js/remove_internal.py"
98      input_api_dir = "//out/sdk-public/public_interface/sdk-js/api"
99    }
100    args = [
101      "--input",
102      rebase_path(input_api_dir, root_build_dir),
103      "--output",
104      rebase_path(root_out_dir + "/ohos_declaration/$target_name/",
105                  root_build_dir),
106    ]
107    if (defined(deps)) {
108      deps += [ ":$_module_info_target" ]
109    } else {
110      deps = [ ":$_module_info_target" ]
111    }
112  }
113  _target_name = target_name
114  generate_module_info(_module_info_target) {
115    module_type = "jsdoc"
116    module_install_name = ""
117    module_name = _target_name
118    module_source_dir = root_out_dir + "/ohos_declaration/$_target_name"
119    install_enable = false
120  }
121}
122
123ohos_declaration_template("ohos_declaration_ets") {
124}
125ohos_declaration_template("ohos_declaration_common") {
126}
127
128ohos_copy_internal("internal_full") {
129  iv_input = "//interface/sdk-js/api/common/full"
130}
131
132ohos_copy_internal("internal_lite") {
133  iv_input = "//interface/sdk-js/api/common/lite"
134}
135
136ohos_copy("syscap_check") {
137  sources = [ "api/syscapCheck/sysCapSchema.json" ]
138  outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
139  module_source_dir = target_out_dir + "/$target_name"
140  module_install_name = ""
141}
142
143ohos_copy("config") {
144  sources = [
145    "api/config/css",
146    "api/config/hml",
147  ]
148  outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
149  module_source_dir = target_out_dir + "/$target_name"
150  module_install_name = ""
151}
152
153ohos_copy("form_declaration") {
154  sources = [
155    "api/form/action",
156    "api/form/css",
157    "api/form/hml",
158  ]
159  outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
160  module_source_dir = target_out_dir + "/$target_name"
161  module_install_name = ""
162}
163