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")
15import("//build/ohos/build_var.gni")
16import("//build/ohos_var.gni")
17
18template("ohos_hisysevent_install_info") {
19  assert(defined(invoker.system_install_info_file))
20  assert(defined(invoker.hisysevent_install_info_file))
21
22  forward_variables_from(invoker,
23                         [
24                           "system_install_info_file",
25                           "hisysevent_install_info_file",
26                         ])
27
28  _deps = []
29  if (defined(invoker.deps)) {
30    _deps += invoker.deps
31  }
32
33  if (is_system_component) {
34    config_install_dir = "${system_base_dir}/etc/hiview"
35  } else {
36    config_install_dir = "${vendor_base_dir}/etc/hiview"
37  }
38
39  action_with_pydeps(target_name) {
40    deps = _deps
41    script = "//build/ohos/hisysevent/hisysevent_process.py"
42    hisysevent_config_file =
43        "${build_configs_path}/parts_info/hisysevent_configs.json"
44    sources = [ system_install_info_file ]
45    outputs = [ hisysevent_install_info_file ]
46    depfile = "$target_gen_dir/$target_name.d"
47    args = [
48      "--parts-config-file",
49      rebase_path(hisysevent_config_file, root_build_dir),
50      "--system-install-info-file",
51      rebase_path(system_install_info_file, root_build_dir),
52      "--config-install-dest-dir",
53      config_install_dir,
54      "--hisysevent-install-info-file",
55      rebase_path(hisysevent_install_info_file, root_build_dir),
56      "--depfile",
57      rebase_path(depfile, root_build_dir),
58      "--source-root-dir",
59      rebase_path("//"),
60      "--gn-root-build-dir",
61      rebase_path(root_build_dir),
62    ]
63  }
64}
65