1# Copyright (c) 2024 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") 15import("//foundation/resourceschedule/background_task_mgr/bgtaskmgr.gni") 16 17cflags = [] 18 19config("bgtaskmgr_public_config") { 20 include_dirs = [ "napi/include" ] 21} 22 23ohos_shared_library("backgroundtaskmanager") { 24 branch_protector_ret = "pac_ret" 25 sanitize = { 26 cfi = true 27 cfi_cross_dso = true 28 debug = false 29 } 30 sources = [ 31 "napi/src/bg_continuous_task_napi_module.cpp", 32 "napi/src/cancel_suspend_delay.cpp", 33 "napi/src/common.cpp", 34 "napi/src/efficiency_resources_operation.cpp", 35 "napi/src/get_remaining_delay_time.cpp", 36 "napi/src/init.cpp", 37 "napi/src/request_suspend_delay.cpp", 38 ] 39 40 public_configs = [ ":bgtaskmgr_public_config" ] 41 42 deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] 43 44 external_deps = [ 45 "ability_base:want", 46 "ability_runtime:ability_context_native", 47 "ability_runtime:abilitykit_native", 48 "ability_runtime:extensionkit_native", 49 "ability_runtime:napi_base_context", 50 "ability_runtime:wantagent_innerkits", 51 "bundle_framework:appexecfwk_base", 52 "bundle_framework:appexecfwk_core", 53 "c_utils:utils", 54 "common_event_service:cesfwk_innerkits", 55 "hilog:libhilog", 56 "hitrace:hitrace_meter", 57 "ipc:ipc_single", 58 "napi:ace_napi", 59 "samgr:samgr_proxy", 60 ] 61 62 defines = [] 63 if (background_task_mgr_jsstack) { 64 defines += [ "SUPPORT_JSSTACK" ] 65 external_deps += [ "hiview:libxpower_event_js" ] 66 } 67 68 relative_install_dir = "module" 69 subsystem_name = "resourceschedule" 70 part_name = "background_task_mgr" 71} 72 73ohos_shared_library("backgroundtaskmanager_napi") { 74 branch_protector_ret = "pac_ret" 75 sanitize = { 76 cfi = true 77 cfi_cross_dso = true 78 debug = false 79 } 80 sources = [ 81 "napi/src/bg_continuous_task_napi_module.cpp", 82 "napi/src/cancel_suspend_delay.cpp", 83 "napi/src/common.cpp", 84 "napi/src/efficiency_resources_operation.cpp", 85 "napi/src/get_remaining_delay_time.cpp", 86 "napi/src/init_bgtaskmgr.cpp", 87 "napi/src/request_suspend_delay.cpp", 88 ] 89 90 public_configs = [ ":bgtaskmgr_public_config" ] 91 92 deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] 93 94 external_deps = [ 95 "ability_base:want", 96 "ability_runtime:ability_context_native", 97 "ability_runtime:abilitykit_native", 98 "ability_runtime:extensionkit_native", 99 "ability_runtime:napi_base_context", 100 "ability_runtime:wantagent_innerkits", 101 "bundle_framework:appexecfwk_base", 102 "bundle_framework:appexecfwk_core", 103 "c_utils:utils", 104 "common_event_service:cesfwk_innerkits", 105 "hilog:libhilog", 106 "hitrace:hitrace_meter", 107 "ipc:ipc_single", 108 "napi:ace_napi", 109 "samgr:samgr_proxy", 110 ] 111 112 defines = [] 113 if (background_task_mgr_jsstack) { 114 defines += [ "SUPPORT_JSSTACK" ] 115 external_deps += [ "hiview:libxpower_event_js" ] 116 } 117 118 relative_install_dir = "module/resourceschedule" 119 subsystem_name = "resourceschedule" 120 part_name = "background_task_mgr" 121} 122 123ohos_shared_library("cj_background_task_mgr_ffi") { 124 sanitize = { 125 cfi = true 126 cfi_cross_dso = true 127 debug = false 128 } 129 130 include_dirs = [ "../innerkits/include" ] 131 132 if (!defined(defines)) { 133 defines = [] 134 } 135 136 if (product_name != "ohos-sdk") { 137 deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] 138 external_deps = [ 139 "ability_base:want", 140 "ability_runtime:ability_context_native", 141 "ability_runtime:abilitykit_native", 142 "ability_runtime:napi_base_context", 143 "ability_runtime:wantagent_innerkits", 144 "bundle_framework:appexecfwk_base", 145 "c_utils:utils", 146 "common_event_service:cesfwk_innerkits", 147 "hilog:libhilog", 148 "hitrace:hitrace_meter", 149 "ipc:ipc_single", 150 "napi:ace_napi", 151 "napi:cj_bind_ffi", 152 "napi:cj_bind_native", 153 "samgr:samgr_proxy", 154 ] 155 sources = [ "cj/background_task_mgr/background_task_mgr_ffi.cpp" ] 156 } else { 157 defines += [ "PREVIEWER" ] 158 sources = [ "cj/background_task_mgr/background_task_mock.cpp" ] 159 external_deps = [ "napi:cj_bind_ffi" ] 160 } 161 162 if (current_os == "ohos") { 163 defines += [ "OHOS_PLATFORM" ] 164 } 165 166 if (current_os == "mingw") { 167 defines += [ "WINDOWS_PLATFORM" ] 168 } 169 170 innerapi_tags = [ "platformsdk" ] 171 subsystem_name = "resourceschedule" 172 part_name = "background_task_mgr" 173} 174 175ohos_shared_library("transient_task") { 176 sanitize = { 177 cfi = true 178 cfi_cross_dso = true 179 debug = false 180 } 181 182 branch_protector_ret = "pac_ret" 183 184 output_extension = "so" 185 include_dirs = [ "$bgtaskmgr_root_path/interfaces/kits/c/include" ] 186 187 sources = 188 [ "$bgtaskmgr_root_path/interfaces/kits/c/src/transient_task_api.cpp" ] 189 190 cflags = [ 191 "-fstack-protector-strong", 192 "-D_FORTIFY_SOURCE=2", 193 "-O2", 194 ] 195 196 cflags_cc = [ 197 "-fstack-protector-strong", 198 "-D_FORTIFY_SOURCE=2", 199 "-O2", 200 ] 201 202 deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] 203 204 external_deps = [ 205 "ability_base:want", 206 "ability_runtime:ability_context_native", 207 "ability_runtime:abilitykit_native", 208 "ability_runtime:napi_base_context", 209 "ability_runtime:wantagent_innerkits", 210 "bundle_framework:appexecfwk_base", 211 "c_utils:utils", 212 "common_event_service:cesfwk_innerkits", 213 "hilog:libhilog", 214 "hitrace:hitrace_meter", 215 "ipc:ipc_single", 216 "napi:ace_napi", 217 "napi:cj_bind_ffi", 218 "napi:cj_bind_native", 219 "samgr:samgr_proxy", 220 ] 221 222 subsystem_name = "resourceschedule" 223 part_name = "background_task_mgr" 224 relative_install_dir = "ndk" 225} 226