• 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("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
69ohos_copy("common_api") {
70  sources = common_api_src
71  outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
72  module_source_dir = target_out_dir + "/$target_name"
73  module_install_name = ""
74}
75
76if (!sdk_build_public) {
77  ohos_copy("bundle_api") {
78    sources = [ "api/bundle/bundleStatusCallback.d.ts" ]
79    outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
80    module_source_dir = target_out_dir + "/$target_name"
81    module_install_name = ""
82  }
83}
84
85template("ohos_declaration_template") {
86  forward_variables_from(invoker, "*")
87  _module_info_target = "/ohos_declaration/${target_name}_info"
88  action_with_pydeps(target_name) {
89    script = "//interface/sdk-js/remove_internal.py"
90    input_api_dir = "//interface/sdk-js/api"
91    inputs = [ "//interface/sdk-js/api" ]
92    outputs = [ root_out_dir + "/ohos_declaration/$target_name" ]
93    if (sdk_build_public || product_name == "ohos-sdk") {
94      script = "//out/sdk-public/public_interface/sdk-js/remove_internal.py"
95      input_api_dir = "//out/sdk-public/public_interface/sdk-js/api"
96    }
97    args = [
98      "--input",
99      rebase_path(input_api_dir, root_build_dir),
100      "--output",
101      rebase_path(root_out_dir + "/ohos_declaration/$target_name/",
102                  root_build_dir),
103    ]
104    if (defined(deps)) {
105      deps += [ ":$_module_info_target" ]
106    } else {
107      deps = [ ":$_module_info_target" ]
108    }
109  }
110  _target_name = target_name
111  generate_module_info(_module_info_target) {
112    module_type = "jsdoc"
113    module_install_name = ""
114    module_name = _target_name
115    module_source_dir = root_out_dir + "/ohos_declaration/$_target_name"
116    install_enable = false
117  }
118}
119
120ohos_declaration_template("ohos_declaration_ets") {
121}
122ohos_declaration_template("ohos_declaration_common") {
123}
124
125ohos_copy_internal("internal_full") {
126  iv_input = "//interface/sdk-js/api/common/full"
127}
128
129ohos_copy_internal("internal_lite") {
130  iv_input = "//interface/sdk-js/api/common/lite"
131}
132
133ohos_copy("syscap_check") {
134  sources = [ "api/syscapCheck/sysCapSchema.json" ]
135  outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
136  module_source_dir = target_out_dir + "/$target_name"
137  module_install_name = ""
138}
139
140ohos_copy("config") {
141  sources = [
142    "api/config/css",
143    "api/config/hml",
144  ]
145  outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
146  module_source_dir = target_out_dir + "/$target_name"
147  module_install_name = ""
148}
149
150ohos_copy("form_declaration") {
151  sources = [
152    "api/form/action",
153    "api/form/css",
154    "api/form/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