From dd30d07d1c3412370b1fbd36398a417d65c7bf45 Mon Sep 17 00:00:00 2001 From: y30045862 Date: Mon, 26 Jun 2023 22:23:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E7=BB=84=E4=BB=B6=20Signed-off-by:?= =?UTF-8?q?=20yangjingbo10=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I79e6592c86e380242bbca0971140ff7c76869f8b --- backup.gni | 3 +- bundle.json | 5 +- .../innerkits/native/file_share/BUILD.gn | 2 +- .../remote_file_share/native/BUILD.gn | 2 +- interfaces/kits/js/BUILD.gn | 7 ++- test/fuzztest/remotefileshare_fuzzer/BUILD.gn | 2 +- test/unittest/file_share_native/BUILD.gn | 2 +- .../unittests/backup_api/backup_impl/BUILD.gn | 2 +- tests/unittests/backup_tools/BUILD.gn | 2 +- tools/backup_tool/BUILD.gn | 2 +- utils/BUILD.gn | 3 +- utils/include/b_hilog/filemgmt_libhilog.h | 52 +++++++++++++++++++ 12 files changed, 68 insertions(+), 16 deletions(-) create mode 100644 utils/include/b_hilog/filemgmt_libhilog.h diff --git a/backup.gni b/backup.gni index c5d636762..bfe01b0c1 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 58a13df90..80107caf9 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 6f9b24ff6..07ff0407b 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 9fe39dba5..baf5f45c3 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 2c2cdb565..5c68b54c5 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 b35418744..6dfde7d30 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 e14a6b012..8ee4cb0d5 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 ae43e6680..3baea6efe 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 52a5bdfa7..d23baac8d 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 50960b764..f27c0d80e 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 045dc156b..49a013ea2 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 000000000..6ed1f2d2c --- /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 -- Gitee