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("//foundation/resourceschedule/device_standby/standby_service.gni")
15
16config("standby_utils_policy_config") {
17  include_dirs = [ "include" ]
18}
19
20StandbyUtilsPolicy = [
21  "src/json_utils.cpp",
22  "src/standby_config_manager.cpp",
23]
24
25StandbyUtilsPolicyExternalDeps = [
26  "c_utils:utils",
27  "hilog:libhilog",
28  "ipc:ipc_single",
29  "json:nlohmann_json_static",
30]
31
32ohos_shared_library("standby_utils_policy") {
33  branch_protector_ret = "pac_ret"
34  sanitize = {
35    cfi = true
36    cfi_cross_dso = true
37    debug = false
38  }
39  sources = StandbyUtilsPolicy
40
41  public_configs = [ ":standby_utils_policy_config" ]
42
43  deps = [ "${standby_utils_common_path}:standby_utils_common" ]
44
45  external_deps = StandbyUtilsPolicyExternalDeps
46
47  defines = []
48  if (enable_standby_configpolicy) {
49    external_deps += [ "config_policy:configpolicy_util" ]
50    defines += [ "STANDBY_CONFIG_POLICY_ENABLE" ]
51  }
52
53  subsystem_name = "resourceschedule"
54  part_name = "${standby_service_part_name}"
55  version_script = "libstandby_utils_policy.versionscript"
56}
57
58ohos_static_library("standby_utils_policy_static") {
59  branch_protector_ret = "pac_ret"
60  sanitize = {
61    cfi = true
62    cfi_cross_dso = true
63    debug = false
64  }
65  sources = StandbyUtilsPolicy
66
67  public_configs = [ ":standby_utils_policy_config" ]
68
69  deps = [ "${standby_utils_common_path}:standby_utils_common" ]
70
71  external_deps = StandbyUtilsPolicyExternalDeps
72
73  defines = []
74  if (enable_standby_configpolicy) {
75    external_deps += [ "config_policy:configpolicy_util" ]
76    defines += [ "STANDBY_CONFIG_POLICY_ENABLE" ]
77  }
78
79  subsystem_name = "resourceschedule"
80  part_name = "${standby_service_part_name}"
81}
82
83ohos_prebuilt_etc("stancby_service_policy_config_device_standby") {
84  source = "configs/device_standby_config.json"
85  install_enable = true
86  subsystem_name = "resourceschedule"
87  part_name = "${standby_service_part_name}"
88  module_install_dir = "etc/standby_service"
89}
90
91ohos_prebuilt_etc("stancby_service_policy_config_resource_config") {
92  source = "configs/standby_strategy_config.json"
93  install_enable = true
94  subsystem_name = "resourceschedule"
95  part_name = "${standby_service_part_name}"
96  module_install_dir = "etc/standby_service"
97}
98
99group("standby_service_config") {
100  deps = [
101    ":stancby_service_policy_config_device_standby",
102    ":stancby_service_policy_config_resource_config",
103  ]
104}
105