1# Copyright (c) 2021 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/config/python.gni")
15
16template("kits_check_remove") {
17  assert(defined(invoker.subsystem_name), "subsystem_name in required.")
18  assert(defined(invoker.sdk_libs_name), "sdk_libs in required.")
19  assert(defined(invoker.sign_file_root_dir), "sign_file_root_dir in required.")
20  assert(defined(invoker.output_file), "output_file in required.")
21
22  _deps = []
23  if (defined(invoker.deps)) {
24    _deps += invoker.deps
25  }
26
27  action_with_pydeps(target_name) {
28    script = "//build/ohos/kits/kits_check_remove.py"
29    deps = _deps
30
31    outputs = [ invoker.output_file ]
32
33    sdk_type = "java"
34    if (defined(invoker.sdk_type)) {
35      sdk_type = invoker.sdk_type
36    }
37
38    args = [
39      "--subsystem-name",
40      invoker.subsystem_name,
41      "--sign-file-root-dir",
42      rebase_path(invoker.sign_file_root_dir, root_build_dir),
43      "--output-file",
44      rebase_path(invoker.output_file, root_build_dir),
45      "--kit-type",
46      sdk_type,
47    ]
48
49    if (invoker.sdk_libs_name != []) {
50      args += [ "--kit-list" ]
51      foreach(sdk_lib_name, invoker.sdk_libs_name) {
52        args += [ sdk_lib_name ]
53      }
54    }
55  }
56}
57