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 stack_protector_ret = true 45 sanitize = { 46 integer_overflow = true 47 ubsan = true 48 boundary_sanitize = true 49 cfi = true 50 cfi_cross_dso = true 51 debug = false 52 } 53 54 part_name = "app_file_service" 55 subsystem_name = "filemanagement" 56 defines = [ "RUST_CXX_NO_EXCEPTIONS" ] 57 sources = [ 58 "//third_party/rust/crates/cxx/include/cxx.h", 59 "//third_party/rust/crates/cxx/src/cxx.cc", 60 ] 61 deps = [ "//third_party/rust/crates/cxx:lib" ] 62 if (is_win) { 63 defines += [ "CXX_RS_EXPORT=__declspec(dllexport)" ] 64 } else { 65 defines += [ "CXX_RS_EXPORT=__attribute__((visibility(\"default\")))" ] 66 } 67} 68 69ohos_shared_library("backup_utils") { 70 stack_protector_ret = true 71 sanitize = { 72 integer_overflow = true 73 ubsan = true 74 boundary_sanitize = true 75 cfi = true 76 cfi_cross_dso = true 77 debug = false 78 } 79 80 sources = [ 81 "src/b_encryption/b_encryption.cpp", 82 "src/b_error/b_error.cpp", 83 "src/b_error/b_excep_utils.cpp", 84 "src/b_filesystem/b_dir.cpp", 85 "src/b_filesystem/b_file.cpp", 86 "src/b_json/b_json_entity_ext_manage.cpp", 87 "src/b_json/b_json_entity_extension_config.cpp", 88 "src/b_ohos/startup/backup_para.cpp", 89 "src/b_process/b_guard_cwd.cpp", 90 "src/b_process/b_guard_signal.cpp", 91 "src/b_process/b_process.cpp", 92 "src/b_tarball/b_tarball_cmdline.cpp", 93 "src/b_tarball/b_tarball_factory.cpp", 94 ] 95 sources += get_target_outputs(":backup_cxx_gen") 96 97 configs = [ ":utils_private_config" ] 98 public_configs = [ ":utils_public_config" ] 99 100 external_deps = [ 101 "c_utils:utils", 102 "faultloggerd:libdfx_dumpcatcher", 103 "hilog:libhilog", 104 "init:libbegetutil", 105 ] 106 107 include_dirs = [ 108 "${path_init}/interfaces/innerkits/include/syspara", 109 "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl", 110 "${path_rust}/crates/cxx/include", 111 "${target_gen_dir}/rust/src", 112 ] 113 114 deps = [ 115 ":backup_cxx_cppdeps", 116 ":backup_cxx_gen", 117 ":backup_cxx_rust", 118 "${path_jsoncpp}:jsoncpp", 119 ] 120 121 use_exceptions = true 122 innerapi_tags = [ "platformsdk" ] 123 part_name = "app_file_service" 124 subsystem_name = "filemanagement" 125} 126