# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("//foundation/resourceschedule/background_task_mgr/bgtaskmgr.gni") cflags = [] config("bgtaskmgr_public_config") { include_dirs = [ "napi/include" ] } ohos_shared_library("backgroundtaskmanager") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } sources = [ "napi/src/bg_continuous_task_napi_module.cpp", "napi/src/cancel_suspend_delay.cpp", "napi/src/common.cpp", "napi/src/efficiency_resources_operation.cpp", "napi/src/get_remaining_delay_time.cpp", "napi/src/init.cpp", "napi/src/request_suspend_delay.cpp", ] public_configs = [ ":bgtaskmgr_public_config" ] deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] external_deps = [ "ability_base:want", "ability_runtime:ability_context_native", "ability_runtime:abilitykit_native", "ability_runtime:napi_base_context", "ability_runtime:wantagent_innerkits", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_single", "napi:ace_napi", "samgr:samgr_proxy", ] defines = [] if (background_task_mgr_jsstack) { defines += [ "SUPPORT_JSSTACK" ] external_deps += [ "hiview:libxpower_event_js" ] } relative_install_dir = "module" subsystem_name = "resourceschedule" part_name = "background_task_mgr" } ohos_shared_library("backgroundtaskmanager_napi") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } sources = [ "napi/src/bg_continuous_task_napi_module.cpp", "napi/src/cancel_suspend_delay.cpp", "napi/src/common.cpp", "napi/src/efficiency_resources_operation.cpp", "napi/src/get_remaining_delay_time.cpp", "napi/src/init_bgtaskmgr.cpp", "napi/src/request_suspend_delay.cpp", ] public_configs = [ ":bgtaskmgr_public_config" ] deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] external_deps = [ "ability_base:want", "ability_runtime:ability_context_native", "ability_runtime:abilitykit_native", "ability_runtime:napi_base_context", "ability_runtime:wantagent_innerkits", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_single", "napi:ace_napi", "samgr:samgr_proxy", ] defines = [] if (background_task_mgr_jsstack) { defines += [ "SUPPORT_JSSTACK" ] external_deps += [ "hiview:libxpower_event_js" ] } relative_install_dir = "module/resourceschedule" subsystem_name = "resourceschedule" part_name = "background_task_mgr" } ohos_shared_library("cj_background_task_mgr_ffi") { sanitize = { cfi = true cfi_cross_dso = true debug = false } include_dirs = [ "../innerkits/include" ] if (!defined(defines)) { defines = [] } if (product_name != "ohos-sdk") { deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] external_deps = [ "ability_base:want", "ability_runtime:ability_context_native", "ability_runtime:abilitykit_native", "ability_runtime:napi_base_context", "ability_runtime:wantagent_innerkits", "bundle_framework:appexecfwk_base", "c_utils:utils", "common_event_service:cesfwk_innerkits", "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_single", "napi:ace_napi", "napi:cj_bind_ffi", "napi:cj_bind_native", "samgr:samgr_proxy", ] sources = [ "cj/background_task_mgr/background_task_mgr_ffi.cpp" ] } else { defines += [ "PREVIEWER" ] sources = [ "cj/background_task_mgr/background_task_mock.cpp" ] external_deps = [ "napi:cj_bind_ffi" ] } if (current_os == "ohos") { defines += [ "OHOS_PLATFORM" ] } if (current_os == "mingw") { defines += [ "WINDOWS_PLATFORM" ] } innerapi_tags = [ "platformsdk" ] subsystem_name = "resourceschedule" part_name = "background_task_mgr" } ohos_shared_library("transient_task") { sanitize = { cfi = true cfi_cross_dso = true debug = false } branch_protector_ret = "pac_ret" output_extension = "so" include_dirs = [ "$bgtaskmgr_root_path/interfaces/kits/c/include" ] sources = [ "$bgtaskmgr_root_path/interfaces/kits/c/src/transient_task_api.cpp" ] cflags = [ "-fstack-protector-strong", "-D_FORTIFY_SOURCE=2", "-O2", ] cflags_cc = [ "-fstack-protector-strong", "-D_FORTIFY_SOURCE=2", "-O2", ] deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] external_deps = [ "ability_base:want", "ability_runtime:ability_context_native", "ability_runtime:abilitykit_native", "ability_runtime:napi_base_context", "ability_runtime:wantagent_innerkits", "bundle_framework:appexecfwk_base", "c_utils:utils", "common_event_service:cesfwk_innerkits", "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_single", "napi:ace_napi", "napi:cj_bind_ffi", "napi:cj_bind_native", "samgr:samgr_proxy", ] subsystem_name = "resourceschedule" part_name = "background_task_mgr" relative_install_dir = "ndk" }