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
17ohos_executable("backup_tool") {
18  branch_protector_ret = "pac_ret"
19  sanitize = {
20    integer_overflow = true
21    cfi = true
22    cfi_cross_dso = true
23    debug = false
24  }
25
26  include_dirs = []
27  deps = []
28  defines = []
29  sources = [ "src/main.cpp" ]
30
31  if (build_variant == "root") {
32    include_dirs += [ "include" ]
33
34    defines += [
35      "LOG_DOMAIN=0xD004304",
36      "LOG_TAG=\"BackupTool\"",
37    ]
38
39    deps += [
40      "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner",
41      "${path_backup}/utils/:backup_utils",
42      "${path_jsoncpp}:jsoncpp",
43    ]
44
45    sources += [
46      "src/tools_op.cpp",
47      "src/tools_op_backup.cpp",
48      "src/tools_op_check_sa.cpp",
49      "src/tools_op_help.cpp",
50      "src/tools_op_incremental_backup.cpp",
51      "src/tools_op_incremental_restore.cpp",
52      "src/tools_op_incremental_restore_async.cpp",
53      "src/tools_op_restore.cpp",
54      "src/tools_op_restore_async.cpp",
55    ]
56
57    external_deps = [
58      "c_utils:utils",
59      "hilog:libhilog",
60      "hitrace:hitrace_meter",
61      "ipc:ipc_core",
62    ]
63
64    defines += [ "BACKUP_TOOL_ENABLE=1" ]
65  }
66
67  use_exceptions = true
68  install_enable = false
69  part_name = "app_file_service"
70  subsystem_name = "filemanagement"
71}
72