1# Copyright (c) 2022-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/filemanagement/app_file_service/backup.gni")
16
17config("utils_private_config") {
18  defines = [
19    "LOG_DOMAIN=0xD004305",
20    "LOG_TAG=\"BackupUtils\"",
21  ]
22}
23
24config("utils_public_config") {
25  include_dirs = [
26    "include",
27    "include/b_hilog",
28    "${path_base}/include",
29  ]
30}
31
32ohos_static_library("backup_cxx_cppdeps") {
33  branch_protector_ret = "pac_ret"
34
35  sanitize = {
36    integer_overflow = true
37    ubsan = true
38    boundary_sanitize = true
39    cfi = true
40    cfi_cross_dso = true
41    debug = false
42  }
43
44  part_name = "app_file_service"
45  subsystem_name = "filemanagement"
46}
47
48ohos_shared_library("backup_utils") {
49  branch_protector_ret = "pac_ret"
50
51  sanitize = {
52    integer_overflow = true
53    ubsan = true
54    boundary_sanitize = true
55    cfi = true
56    cfi_cross_dso = true
57    debug = false
58  }
59
60  sources = [
61    "src/b_anony/b_anony.cpp",
62    "src/b_encryption/b_encryption.cpp",
63    "src/b_error/b_error.cpp",
64    "src/b_error/b_excep_utils.cpp",
65    "src/b_filesystem/b_dir.cpp",
66    "src/b_filesystem/b_file.cpp",
67    "src/b_filesystem/b_file_hash.cpp",
68    "src/b_hiaudit/hi_audit.cpp",
69    "src/b_hiaudit/zip_util.cpp",
70    "src/b_json/b_json_clear_data_config.cpp",
71    "src/b_json/b_json_entity_ext_manage.cpp",
72    "src/b_json/b_json_entity_extension_config.cpp",
73    "src/b_json/b_json_service_disposal_config.cpp",
74    "src/b_json/b_report_entity.cpp",
75    "src/b_jsonutil/b_jsonutil.cpp",
76    "src/b_ohos/startup/backup_para.cpp",
77    "src/b_process/b_guard_cwd.cpp",
78    "src/b_process/b_guard_signal.cpp",
79    "src/b_process/b_process.cpp",
80    "src/b_radar/b_radar.cpp",
81    "src/b_sa/b_sa_utils.cpp",
82    "src/b_tarball/b_tarball_cmdline.cpp",
83    "src/b_tarball/b_tarball_factory.cpp",
84    "src/b_utils/b_time.cpp",
85  ]
86
87  configs = [ ":utils_private_config" ]
88  public_configs = [ ":utils_public_config" ]
89
90  external_deps = [
91    "access_token:libaccesstoken_sdk",
92    "access_token:libtokenid_sdk",
93    "cJSON:cjson",
94    "c_utils:utils",
95    "faultloggerd:libdfx_dumpcatcher",
96    "hilog:libhilog",
97    "hisysevent:libhisysevent",
98    "hitrace:hitrace_meter",
99    "init:libbegetutil",
100    "ipc:ipc_core",
101    "zlib:shared_libz",
102  ]
103
104  include_dirs = [
105    "${path_init}/interfaces/innerkits/include/syspara",
106    "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl",
107    "${path_backup}/utils/include",
108  ]
109
110  deps = [
111    ":backup_cxx_cppdeps",
112    "${path_backup}/interfaces/innerkits/native:sandbox_helper_native",
113    "${path_jsoncpp}:jsoncpp",
114    "//third_party/openssl:libcrypto_shared",
115  ]
116
117  use_exceptions = true
118  innerapi_tags = [ "platformsdk" ]
119  part_name = "app_file_service"
120  subsystem_name = "filemanagement"
121}
122