15f9996aaSopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd.
25f9996aaSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
35f9996aaSopenharmony_ci# you may not use this file except in compliance with the License.
45f9996aaSopenharmony_ci# You may obtain a copy of the License at
55f9996aaSopenharmony_ci#
65f9996aaSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
75f9996aaSopenharmony_ci#
85f9996aaSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
95f9996aaSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
105f9996aaSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115f9996aaSopenharmony_ci# See the License for the specific language governing permissions and
125f9996aaSopenharmony_ci# limitations under the License.
135f9996aaSopenharmony_ci
145f9996aaSopenharmony_ciimport("//build/config/python.gni")
155f9996aaSopenharmony_ci
165f9996aaSopenharmony_citemplate("kits_check_remove") {
175f9996aaSopenharmony_ci  assert(defined(invoker.subsystem_name), "subsystem_name in required.")
185f9996aaSopenharmony_ci  assert(defined(invoker.sdk_libs_name), "sdk_libs in required.")
195f9996aaSopenharmony_ci  assert(defined(invoker.sign_file_root_dir), "sign_file_root_dir in required.")
205f9996aaSopenharmony_ci  assert(defined(invoker.output_file), "output_file in required.")
215f9996aaSopenharmony_ci
225f9996aaSopenharmony_ci  _deps = []
235f9996aaSopenharmony_ci  if (defined(invoker.deps)) {
245f9996aaSopenharmony_ci    _deps += invoker.deps
255f9996aaSopenharmony_ci  }
265f9996aaSopenharmony_ci
275f9996aaSopenharmony_ci  action_with_pydeps(target_name) {
285f9996aaSopenharmony_ci    script = "//build/ohos/kits/kits_check_remove.py"
295f9996aaSopenharmony_ci    deps = _deps
305f9996aaSopenharmony_ci
315f9996aaSopenharmony_ci    outputs = [ invoker.output_file ]
325f9996aaSopenharmony_ci
335f9996aaSopenharmony_ci    sdk_type = "java"
345f9996aaSopenharmony_ci    if (defined(invoker.sdk_type)) {
355f9996aaSopenharmony_ci      sdk_type = invoker.sdk_type
365f9996aaSopenharmony_ci    }
375f9996aaSopenharmony_ci
385f9996aaSopenharmony_ci    args = [
395f9996aaSopenharmony_ci      "--subsystem-name",
405f9996aaSopenharmony_ci      invoker.subsystem_name,
415f9996aaSopenharmony_ci      "--sign-file-root-dir",
425f9996aaSopenharmony_ci      rebase_path(invoker.sign_file_root_dir, root_build_dir),
435f9996aaSopenharmony_ci      "--output-file",
445f9996aaSopenharmony_ci      rebase_path(invoker.output_file, root_build_dir),
455f9996aaSopenharmony_ci      "--kit-type",
465f9996aaSopenharmony_ci      sdk_type,
475f9996aaSopenharmony_ci    ]
485f9996aaSopenharmony_ci
495f9996aaSopenharmony_ci    if (invoker.sdk_libs_name != []) {
505f9996aaSopenharmony_ci      args += [ "--kit-list" ]
515f9996aaSopenharmony_ci      foreach(sdk_lib_name, invoker.sdk_libs_name) {
525f9996aaSopenharmony_ci        args += [ sdk_lib_name ]
535f9996aaSopenharmony_ci      }
545f9996aaSopenharmony_ci    }
555f9996aaSopenharmony_ci  }
565f9996aaSopenharmony_ci}
57