1# Copyright (c) 2023 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")
15
16declare_args() {
17  sys_installer_cfg_file = ""
18  sys_installer_absolutely_path = "//base/update/sys_installer"
19}
20
21template("sys_installer_gen") {
22  if (sys_installer_cfg_file != "") {
23    ohos_static_library(target_name) {
24      forward_variables_from(invoker, "*")
25    }
26  } else {
27    ohos_shared_library(target_name) {
28      forward_variables_from(invoker, "*")
29    }
30  }
31}
32
33template("module_update_gen") {
34  if (sys_installer_cfg_file != "") {
35    ohos_static_library(target_name) {
36      forward_variables_from(invoker, "*")
37    }
38  } else {
39    ohos_shared_library(target_name) {
40      forward_variables_from(invoker, "*")
41
42      innerapi_tags = [
43        "platformsdk",
44        "sasdk",
45      ]
46    }
47  }
48}
49
50template("check_module_update_gen") {
51  if (sys_installer_cfg_file != "") {
52    ohos_static_library(target_name) {
53      forward_variables_from(invoker, "*")
54    }
55  } else {
56    ohos_executable(target_name) {
57      forward_variables_from(invoker, "*")
58    }
59  }
60}
61
62template("module_update_service_gen") {
63  if (sys_installer_cfg_file != "") {
64    ohos_source_set(target_name) {
65      forward_variables_from(invoker, "*")
66    }
67  } else {
68    ohos_shared_library(target_name) {
69      forward_variables_from(invoker, "*")
70    }
71  }
72}
73