• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2023 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
32rust_cxx("backup_cxx_gen") {
33  sources = [ "rust/src/lib.rs" ]
34}
35
36ohos_rust_static_ffi("backup_cxx_rust") {
37  sources = [ "rust/src/lib.rs" ]
38  deps = [ "//third_party/rust/crates/cxx:lib" ]
39  part_name = "app_file_service"
40  subsystem_name = "filemanagement"
41}
42
43ohos_static_library("backup_cxx_cppdeps") {
44  part_name = "app_file_service"
45  subsystem_name = "filemanagement"
46  defines = [ "RUST_CXX_NO_EXCEPTIONS" ]
47  sources = [
48    "//third_party/rust/crates/cxx/include/cxx.h",
49    "//third_party/rust/crates/cxx/src/cxx.cc",
50  ]
51  deps = [ "//third_party/rust/crates/cxx:lib" ]
52  if (is_win) {
53    defines += [ "CXX_RS_EXPORT=__declspec(dllexport)" ]
54  } else {
55    defines += [ "CXX_RS_EXPORT=__attribute__((visibility(\"default\")))" ]
56  }
57}
58
59ohos_shared_library("backup_utils") {
60  sources = [
61    "src/b_encryption/b_encryption.cpp",
62    "src/b_error/b_error.cpp",
63    "src/b_error/b_excep_utils.cpp",
64    "src/b_filesystem/b_dir.cpp",
65    "src/b_filesystem/b_file.cpp",
66    "src/b_json/b_json_entity_ext_manage.cpp",
67    "src/b_json/b_json_entity_extension_config.cpp",
68    "src/b_ohos/startup/backup_para.cpp",
69    "src/b_process/b_guard_cwd.cpp",
70    "src/b_process/b_guard_signal.cpp",
71    "src/b_process/b_process.cpp",
72    "src/b_tarball/b_tarball_cmdline.cpp",
73    "src/b_tarball/b_tarball_factory.cpp",
74  ]
75  sources += get_target_outputs(":backup_cxx_gen")
76
77  configs = [ ":utils_private_config" ]
78  public_configs = [ ":utils_public_config" ]
79
80  external_deps = [
81    "c_utils:utils",
82    "faultloggerd:libdfx_dumpcatcher",
83    "hilog:libhilog",
84    "init:libbegetutil",
85  ]
86
87  include_dirs = [
88    "${path_init}/interfaces/innerkits/include/syspara",
89    "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl",
90    "${path_rust}/crates/cxx/include",
91    "${target_gen_dir}/rust/src",
92  ]
93
94  deps = [
95    ":backup_cxx_cppdeps",
96    ":backup_cxx_gen",
97    ":backup_cxx_rust",
98    "${path_jsoncpp}:jsoncpp",
99  ]
100
101  use_exceptions = true
102  innerapi_tags = [ "platformsdk" ]
103  part_name = "app_file_service"
104  subsystem_name = "filemanagement"
105}
106