• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2025 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/components/idl_tool/idl.gni")
15import("//build/ohos.gni")
16import("//foundation/filemanagement/app_file_service/backup.gni")
17
18idl_gen_interface("backup_idl") {
19  sources = [
20    "IExtension.idl",
21    "IService.idl",
22    "IServiceReverse.idl",
23  ]
24  sources_common = [
25    "ServiceReverseType.idl",
26    "ServiceType.idl",
27  ]
28  hitrace = "HITRACE_TAG_FILEMANAGEMENT"
29  log_domainid = "0xD004313"
30  log_tag = "AppFileService"
31}
32
33config("public_idl_config") {
34  include_dirs = [
35    ".",
36    "${target_gen_dir}/",
37  ]
38}
39
40ohos_source_set("backup_sa_ipc") {
41  sanitize = {
42    cfi = true
43    cfi_cross_dso = true
44    debug = false
45  }
46  output_values = get_target_outputs(":backup_idl")
47
48  sources = []
49
50  sources += filter_include(output_values, [ "*.cpp" ])
51
52  public_configs = [ ":public_idl_config" ]
53
54  deps = [ ":backup_idl" ]
55
56  external_deps = [
57    "c_utils:utils",
58    "hilog:libhilog",
59    "hitrace:hitrace_meter",
60    "ipc:ipc_core",
61    "safwk:system_ability_fwk",
62    "samgr:samgr_proxy",
63  ]
64
65  include_dirs = [
66    ".",
67    "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl",
68    "${target_gen_dir}/",
69  ]
70
71  cflags_cc = [
72    "-fdata-sections",
73    "-ffunction-sections",
74    "-fno-unwind-tables",
75    "-fno-asynchronous-unwind-tables",
76    "-Os",
77    "-fvisibility=hidden",
78  ]
79
80  part_name = "app_file_service"
81
82  subsystem_name = "filemanagement"
83}
84
85ohos_source_set("backup_extension_stub_idl") {
86  sanitize = {
87    cfi = true
88    cfi_cross_dso = true
89    debug = false
90  }
91  sources = [
92    "${target_gen_dir}/extension_stub.cpp"
93  ]
94  public_configs = [ ":public_idl_config" ]
95  deps = [ ":backup_idl" ]
96  external_deps = [
97    "c_utils:utils",
98    "hilog:libhilog",
99    "hitrace:hitrace_meter",
100    "ipc:ipc_core",
101    "safwk:system_ability_fwk",
102    "samgr:samgr_proxy",
103  ]
104  include_dirs = [
105    ".",
106    "${target_gen_dir}/",
107  ]
108  cflags_cc = [
109    "-fdata-sections",
110    "-ffunction-sections",
111    "-fno-unwind-tables",
112    "-fno-asynchronous-unwind-tables",
113    "-Os",
114  ]
115  part_name = "app_file_service"
116  subsystem_name = "filemanagement"
117}
118
119ohos_source_set("backup_reverse_stub_idl") {
120  sanitize = {
121    cfi = true
122    cfi_cross_dso = true
123    debug = false
124  }
125  sources = [
126    "${target_gen_dir}/service_reverse_stub.cpp"
127  ]
128  public_configs = [ ":public_idl_config" ]
129  deps = [ ":backup_idl" ]
130  external_deps = [
131    "c_utils:utils",
132    "hilog:libhilog",
133    "hitrace:hitrace_meter",
134    "ipc:ipc_core",
135    "safwk:system_ability_fwk",
136    "samgr:samgr_proxy",
137  ]
138  include_dirs = [
139    ".",
140    "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl",
141    "${target_gen_dir}/",
142  ]
143  cflags_cc = [
144    "-fdata-sections",
145    "-ffunction-sections",
146    "-fno-unwind-tables",
147    "-fno-asynchronous-unwind-tables",
148    "-Os",
149  ]
150  part_name = "app_file_service"
151  subsystem_name = "filemanagement"
152}
153
154ohos_source_set("backup_service_proxy_idl") {
155  sanitize = {
156    cfi = true
157    cfi_cross_dso = true
158    debug = false
159  }
160  sources = [
161    "${target_gen_dir}/service_proxy.cpp"
162  ]
163  public_configs = [ ":public_idl_config" ]
164  deps = [ ":backup_idl" ]
165  external_deps = [
166    "c_utils:utils",
167    "hilog:libhilog",
168    "hitrace:hitrace_meter",
169    "ipc:ipc_core",
170    "safwk:system_ability_fwk",
171    "samgr:samgr_proxy",
172  ]
173  include_dirs = [
174    ".",
175    "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl",
176    "${target_gen_dir}/",
177  ]
178  cflags_cc = [
179    "-fdata-sections",
180    "-ffunction-sections",
181    "-fno-unwind-tables",
182    "-fno-asynchronous-unwind-tables",
183    "-Os",
184  ]
185  part_name = "app_file_service"
186  subsystem_name = "filemanagement"
187}
188
189ohos_source_set("backup_sa_ipc_stub") {
190  sanitize = {
191    cfi = true
192    cfi_cross_dso = true
193    debug = false
194  }
195  output_values = get_target_outputs(":backup_idl")
196
197  sources = []
198
199  sources += filter_include(output_values, [ "*_type.cpp" ])
200  sources += filter_include(output_values, [ "*_stub.cpp" ])
201  public_configs = [ ":public_idl_config" ]
202
203  deps = [ ":backup_idl" ]
204
205  external_deps = [
206    "c_utils:utils",
207    "hilog:libhilog",
208    "hitrace:hitrace_meter",
209    "ipc:ipc_core",
210    "safwk:system_ability_fwk",
211    "samgr:samgr_proxy",
212  ]
213
214  include_dirs = [
215    ".",
216    "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl",
217    "${target_gen_dir}/",
218  ]
219
220  part_name = "app_file_service"
221
222  subsystem_name = "filemanagement"
223}
224
225config("public_config") {
226  include_dirs = [
227    ".",
228    "${target_gen_dir}/",
229  ]
230}
231
232ohos_shared_library("backup_sa") {
233  branch_protector_ret = "pac_ret"
234
235  sanitize = {
236    integer_overflow = true
237    ubsan = true
238    boundary_sanitize = true
239    cfi = true
240    cfi_cross_dso = true
241    debug = false
242  }
243
244  sources = [
245    "src/module_app_gallery/app_gallery_dispose_proxy.cpp",
246    "src/module_app_gallery/app_gallery_service_connection.cpp",
247    "src/module_external/bms_adapter.cpp",
248    "src/module_external/sms_adapter.cpp",
249    "src/module_ipc/sa_backup_connection.cpp",
250    "src/module_ipc/service.cpp",
251    "src/module_ipc/service_incremental.cpp",
252    "src/module_ipc/sub_service.cpp",
253    "src/module_ipc/svc_backup_connection.cpp",
254    "src/module_ipc/svc_restore_deps_manager.cpp",
255    "src/module_ipc/svc_session_manager.cpp",
256    "src/module_notify/notify_work_service.cpp",
257    "src/module_sched/sched_scheduler.cpp",
258    "src/module_external/storage_manager_service.cpp",
259  ]
260
261  defines = [
262    "LOG_DOMAIN=0xD004303",
263    "LOG_TAG=\"BackupSA\"",
264  ]
265
266  include_dirs = [
267    "include",
268    "include/module_notify",
269    "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl",
270  ]
271
272  deps = [
273    ":backup_sa_ipc",
274    "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner",
275    "${path_backup}/utils:backup_utils",
276    "${path_backup}/interfaces/innerkits/native:sandbox_helper_native",
277    "${path_backup}/interfaces/innerkits/native:fileuri_native",
278  ]
279
280  external_deps = [
281    "ability_base:want",
282    "ability_runtime:ability_connect_callback_stub",
283    "ability_runtime:ability_manager",
284    "access_token:libaccesstoken_sdk",
285    "access_token:libtokenid_sdk",
286    "bundle_framework:appexecfwk_base",
287    "bundle_framework:appexecfwk_core",
288    "c_utils:utils",
289    "common_event_service:cesfwk_innerkits",
290    "hilog:libhilog",
291    "hisysevent:libhisysevent",
292    "hitrace:hitrace_meter",
293    "init:libbegetutil",
294    "ipc:ipc_core",
295    "jsoncpp:jsoncpp",
296    "safwk:system_ability_fwk",
297    "samgr:samgr_proxy",
298    "storage_service:storage_manager_sa_proxy",
299    "data_share:datashare_consumer",
300    "data_share:datashare_common",
301  ]
302
303  cflags_cc = [
304    "-fdata-sections",
305    "-ffunction-sections",
306    "-fno-unwind-tables",
307    "-fno-asynchronous-unwind-tables",
308    "-Os",
309  ]
310
311  use_exceptions = true
312  part_name = "app_file_service"
313  subsystem_name = "filemanagement"
314}
315