diff --git a/backup.gni b/backup.gni index c5d63676279bec513d5b3188f8f0f38c7a8cfdf9..bfe01b0c1d8f1de3d0b8d4d47bc44b6ecf23ee71 100644 --- a/backup.gni +++ b/backup.gni @@ -19,7 +19,6 @@ path_access_token = "//base/security/access_token" path_backup_js = "//foundation/filemanagement/app_file_service/interfaces/kits/js" path_base = "//commonlibrary/c_utils/base" -path_distributedfile = "//foundation/distributeddatamgr/distributedfile" path_faultloggerd = "//base/hiviewdfx/faultloggerd" path_file_api = "//foundation/filemanagement/file_api" path_googletest = "//third_party/googletest" @@ -32,6 +31,8 @@ path_init = "//base/startup/init" path_filemgmt_libn = "//foundation/filemanagement/file_api/utils/filemgmt_libn" path_backup_mock = "//foundation/filemanagement/app_file_service/tests/mock" +path_bas_hiviewdfx_hilog = "//base/hiviewdfx/hilog" + backup_mock_parcel_include_dirs = [ "$path_backup_mock/parcel/include" ] backup_mock_parcel_src = [ "$path_backup_mock/parcel/src/parcel.cpp" ] backup_mock_parameter_include_dirs = [ "$path_backup_mock/parameter/include" ] diff --git a/bundle.json b/bundle.json index 58a13df906e7c7c1b9f562c65ac6d85bf56652a0..80107caf947ab6e6fc93c17487bd867923a43b21 100644 --- a/bundle.json +++ b/bundle.json @@ -27,11 +27,10 @@ "common_event_service", "c_utils", "data_share", - "distributeddatamgr", "faultloggerd", "file_api", - "hitrace_native", - "hiviewdfx_hilog_native", + "hitrace", + "hilog", "ipc", "init", "napi", diff --git a/interfaces/innerkits/native/file_share/BUILD.gn b/interfaces/innerkits/native/file_share/BUILD.gn index 6f9b24ff6beb41defa7de82bbcfb6e4b3b885932..07ff0407b32a7db66f7f79fde9b058343e71a3f3 100644 --- a/interfaces/innerkits/native/file_share/BUILD.gn +++ b/interfaces/innerkits/native/file_share/BUILD.gn @@ -32,7 +32,7 @@ ohos_shared_library("fileshare_native") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "c_utils:utils", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", ] part_name = "app_file_service" diff --git a/interfaces/innerkits/remote_file_share/native/BUILD.gn b/interfaces/innerkits/remote_file_share/native/BUILD.gn index 9fe39dba5306b543d1fbca328eb2c7e7eb060132..baf5f45c310442b8a27ca99dc35a58f3b5224634 100644 --- a/interfaces/innerkits/remote_file_share/native/BUILD.gn +++ b/interfaces/innerkits/remote_file_share/native/BUILD.gn @@ -30,7 +30,7 @@ ohos_shared_library("remote_file_share_native") { external_deps = [ "c_utils:utils", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", ] defines = [ diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 2c2cdb565c51ec43d9c53ce62530f8e26687959b..5c68b54c5a9236662ab094b39cd109ea3052454a 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -58,7 +58,7 @@ ohos_shared_library("fileshare") { "data_share:datashare_consumer", "file_api:filemgmt_libn", "file_api:remote_uri_native", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", "ipc:ipc_core", ] @@ -85,7 +85,7 @@ ohos_shared_library("fileuri") { "bundle_framework:appexecfwk_core", "c_utils:utils", "file_api:filemgmt_libn", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] @@ -112,11 +112,10 @@ ohos_shared_library("backup") { ] deps = [ + "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner", "${path_file_api}/utils/filemgmt_libn:filemgmt_libn", "${path_napi}:ace_napi", ] - external_deps = [ "app_file_service:backup_kit_inner" ] - public_deps = [ "${path_file_api}/utils/filemgmt_libhilog:filemgmt_libhilog" ] } diff --git a/test/fuzztest/remotefileshare_fuzzer/BUILD.gn b/test/fuzztest/remotefileshare_fuzzer/BUILD.gn index b3541874493b144cc4563664ea8806ab4a639f0b..6dfde7d307a40077a9328875b073c577fe9e905b 100644 --- a/test/fuzztest/remotefileshare_fuzzer/BUILD.gn +++ b/test/fuzztest/remotefileshare_fuzzer/BUILD.gn @@ -34,7 +34,7 @@ ohos_fuzztest("RemoteFileShareFuzzTest") { external_deps = [ "file_api:filemgmt_libn", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", ] defines = [ diff --git a/test/unittest/file_share_native/BUILD.gn b/test/unittest/file_share_native/BUILD.gn index e14a6b01289726e8b351d7d0b86396f66249bdf8..8ee4cb0d5cacf73bf1ecaa330948f23a19f49a95 100644 --- a/test/unittest/file_share_native/BUILD.gn +++ b/test/unittest/file_share_native/BUILD.gn @@ -24,7 +24,7 @@ ohos_unittest("file_share_test") { "access_token:libaccesstoken_sdk", "app_file_service:fileshare_native", "c_utils:utils", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", "ipc:ipc_core", ] } diff --git a/tests/unittests/backup_api/backup_impl/BUILD.gn b/tests/unittests/backup_api/backup_impl/BUILD.gn index ae43e66802d6a10e583dc648026f38d28d3551a2..3baea6efe89b23c70529a3fb86d52ba22ff29335 100644 --- a/tests/unittests/backup_api/backup_impl/BUILD.gn +++ b/tests/unittests/backup_api/backup_impl/BUILD.gn @@ -56,13 +56,13 @@ ohos_unittest("backup_sa_impl_test") { include_dirs += backup_mock_utils_include deps = [ + "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner", "${path_backup}/tests/utils:backup_test_utils", "${path_backup}/utils:backup_utils", "${path_googletest}:gmock_main", ] external_deps = [ - "app_file_service:backup_kit_inner", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/tests/unittests/backup_tools/BUILD.gn b/tests/unittests/backup_tools/BUILD.gn index 52a5bdfa7e4235dcf7cf125988eeb2639e46c640..d23baac8d463a48b011bae8172446b198f21eb9f 100644 --- a/tests/unittests/backup_tools/BUILD.gn +++ b/tests/unittests/backup_tools/BUILD.gn @@ -44,7 +44,7 @@ ohos_unittest("backup_tool_test") { external_deps = [ "c_utils:utils", - "hitrace_native:hitrace_meter", + "hitrace:hitrace_meter", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/tools/backup_tool/BUILD.gn b/tools/backup_tool/BUILD.gn index 50960b764ba768dff8d98fe4623f6cfdde5e2093..f27c0d80ef2db3d426ba3dd3078a116d6292a9e3 100644 --- a/tools/backup_tool/BUILD.gn +++ b/tools/backup_tool/BUILD.gn @@ -31,7 +31,7 @@ ohos_executable("backup_tool") { include_dirs = [ "include" ] - external_deps = [ "hitrace_native:hitrace_meter" ] + external_deps = [ "hitrace:hitrace_meter" ] deps = [ "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner", diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 045dc156b5188930aac1b9c66546eae91f33b4bc..49a013ea27c824597bc31e1e57d2f08dbddef646 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -24,6 +24,7 @@ config("utils_private_config") { config("utils_public_config") { include_dirs = [ "include", + "include/b_hilog", "${path_base}/include", ] } @@ -79,8 +80,8 @@ ohos_shared_library("backup_utils") { external_deps = [ "faultloggerd:libdfx_dumpcatcher" ] public_deps = [ + "${path_bas_hiviewdfx_hilog}/interfaces/native/innerkits:libhilog", "${path_base}:utils", - "${path_distributedfile}/utils/filemgmt_libhilog:filemgmt_libhilog", "${path_jsoncpp}:jsoncpp", ] diff --git a/utils/include/b_hilog/filemgmt_libhilog.h b/utils/include/b_hilog/filemgmt_libhilog.h new file mode 100644 index 0000000000000000000000000000000000000000..6ed1f2d2c161b704e860133190730933cfa25ed2 --- /dev/null +++ b/utils/include/b_hilog/filemgmt_libhilog.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FILEMGMT_LIBHILOG_H +#define FILEMGMT_LIBHILOG_H + +#include "hilog/log.h" + +#include + +namespace OHOS { +#ifndef LOG_DOMAIN +#define LOG_DOMAIN 0xD001600 +#endif + +#ifndef LOG_TAG +#define LOG_TAG "FileManagement" +#endif + +static constexpr HiviewDFX::HiLogLabel FILEMGMT_LOG_LABEL = {LOG_CORE, LOG_DOMAIN, LOG_TAG}; + +#if defined __FILE_NAME__ +#define FILEMGMT_FILE_NAME __FILE_NAME__ +#else +#include +#define FILEMGMT_FILE_NAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) +#endif + +#define FILEMGMT_PRINT_LOG(Level, fmt, ...) \ + HiviewDFX::HiLog::Level(FILEMGMT_LOG_LABEL, "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, \ + __LINE__, __FUNCTION__, ##__VA_ARGS__) + +#define HILOGD(fmt, ...) FILEMGMT_PRINT_LOG(Debug, fmt, ##__VA_ARGS__) +#define HILOGI(fmt, ...) FILEMGMT_PRINT_LOG(Info, fmt, ##__VA_ARGS__) +#define HILOGW(fmt, ...) FILEMGMT_PRINT_LOG(Warn, fmt, ##__VA_ARGS__) +#define HILOGE(fmt, ...) FILEMGMT_PRINT_LOG(Error, fmt, ##__VA_ARGS__) +#define HILOGF(fmt, ...) FILEMGMT_PRINT_LOG(Fatal, fmt, ##__VA_ARGS__) +} // namespace OHOS + +#endif // FILEMGMT_LIBHILOG_H \ No newline at end of file