• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/js_backgroundtask_subscriber.cpp",
88    "napi/src/request_suspend_delay.cpp",
89  ]
90
91  public_configs = [ ":bgtaskmgr_public_config" ]
92
93  deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ]
94
95  external_deps = [
96    "ability_base:want",
97    "ability_runtime:ability_context_native",
98    "ability_runtime:abilitykit_native",
99    "ability_runtime:extensionkit_native",
100    "ability_runtime:napi_base_context",
101    "ability_runtime:runtime",
102    "ability_runtime:wantagent_innerkits",
103    "bundle_framework:appexecfwk_base",
104    "bundle_framework:appexecfwk_core",
105    "c_utils:utils",
106    "common_event_service:cesfwk_innerkits",
107    "hilog:libhilog",
108    "hitrace:hitrace_meter",
109    "ipc:ipc_single",
110    "napi:ace_napi",
111    "samgr:samgr_proxy",
112  ]
113
114  defines = []
115  if (background_task_mgr_jsstack) {
116    defines += [ "SUPPORT_JSSTACK" ]
117    external_deps += [ "hiview:libxpower_event_js" ]
118  }
119
120  relative_install_dir = "module/resourceschedule"
121  subsystem_name = "resourceschedule"
122  part_name = "background_task_mgr"
123}
124
125ohos_shared_library("cj_background_task_mgr_ffi") {
126  sanitize = {
127    cfi = true
128    cfi_cross_dso = true
129    debug = false
130  }
131
132  include_dirs = [ "../innerkits/include" ]
133
134  if (!defined(defines)) {
135    defines = []
136  }
137
138  if (product_name != "ohos-sdk") {
139    deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ]
140    external_deps = [
141      "ability_base:want",
142      "ability_runtime:ability_context_native",
143      "ability_runtime:abilitykit_native",
144      "ability_runtime:napi_base_context",
145      "ability_runtime:wantagent_innerkits",
146      "bundle_framework:appexecfwk_base",
147      "c_utils:utils",
148      "common_event_service:cesfwk_innerkits",
149      "hilog:libhilog",
150      "hitrace:hitrace_meter",
151      "ipc:ipc_single",
152      "napi:ace_napi",
153      "napi:cj_bind_ffi",
154      "napi:cj_bind_native",
155      "samgr:samgr_proxy",
156    ]
157    sources = [ "cj/background_task_mgr/background_task_mgr_ffi.cpp" ]
158  } else {
159    defines += [ "PREVIEWER" ]
160    sources = [ "cj/background_task_mgr/background_task_mock.cpp" ]
161    external_deps = [ "napi:cj_bind_ffi" ]
162  }
163
164  if (current_os == "ohos") {
165    defines += [ "OHOS_PLATFORM" ]
166  }
167
168  if (current_os == "mingw") {
169    defines += [ "WINDOWS_PLATFORM" ]
170  }
171
172  innerapi_tags = [ "platformsdk" ]
173  subsystem_name = "resourceschedule"
174  part_name = "background_task_mgr"
175}
176
177ohos_shared_library("transient_task") {
178  sanitize = {
179    cfi = true
180    cfi_cross_dso = true
181    debug = false
182  }
183
184  branch_protector_ret = "pac_ret"
185
186  output_extension = "so"
187  include_dirs = [ "$bgtaskmgr_root_path/interfaces/kits/c/include" ]
188
189  sources =
190      [ "$bgtaskmgr_root_path/interfaces/kits/c/src/transient_task_api.cpp" ]
191
192  cflags = [
193    "-fstack-protector-strong",
194    "-D_FORTIFY_SOURCE=2",
195    "-O2",
196  ]
197
198  cflags_cc = [
199    "-fstack-protector-strong",
200    "-D_FORTIFY_SOURCE=2",
201    "-O2",
202  ]
203
204  deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ]
205
206  external_deps = [
207    "ability_base:want",
208    "ability_runtime:ability_context_native",
209    "ability_runtime:abilitykit_native",
210    "ability_runtime:napi_base_context",
211    "ability_runtime:wantagent_innerkits",
212    "bundle_framework:appexecfwk_base",
213    "c_utils:utils",
214    "common_event_service:cesfwk_innerkits",
215    "hilog:libhilog",
216    "hitrace:hitrace_meter",
217    "ipc:ipc_single",
218    "napi:ace_napi",
219    "napi:cj_bind_ffi",
220    "napi:cj_bind_native",
221    "samgr:samgr_proxy",
222  ]
223
224  subsystem_name = "resourceschedule"
225  part_name = "background_task_mgr"
226  relative_install_dir = "ndk"
227}
228