diff --git a/bundle.json b/bundle.json index 236fd55..9d88a4b 100644 --- a/bundle.json +++ b/bundle.json @@ -23,16 +23,16 @@ "ram": "~320KB", "deps": { "components": [ + "bounds_checking_function", "hilog", "hilog_lite", "hiview", "init", - "napi" + "napi", + "zlib" ], "third_party": [ - "bounds_checking_function", - "cJSON", - "zlib" + "cJSON" ] }, "build": { diff --git a/cmd/BUILD.gn b/cmd/BUILD.gn index 4a8c5a7..37dc258 100644 --- a/cmd/BUILD.gn +++ b/cmd/BUILD.gn @@ -43,9 +43,7 @@ ohos_executable("hitrace") { deps = [ ":hitrace_osal_inner", "../config:hitrace_utils", - "//third_party/bounds_checking_function:libsec_static", "//third_party/cJSON:cjson", - "//third_party/zlib:libz", ] external_deps = [] @@ -59,13 +57,15 @@ ohos_executable("hitrace") { if (device_company != "qemu" && support_executable_file) { external_deps += [ "hiview:libucollection_client" ] } + external_deps += [ + "bounds_checking_function:libsec_static", + "zlib:libz", + ] include_dirs = [ "./include", - "//third_party/zlib", "../frameworks/include/", "../interfaces/native/innerkits/include/hitrace_meter", - "//third_party/bounds_checking_function/include", ] subsystem_name = "hiviewdfx" part_name = "hitrace" @@ -81,9 +81,7 @@ ohos_executable("bytrace") { deps = [ ":hitrace_osal_inner", "../config:hitrace_utils", - "//third_party/bounds_checking_function:libsec_static", "//third_party/cJSON:cjson", - "//third_party/zlib:libz", ] external_deps = [] @@ -97,13 +95,15 @@ ohos_executable("bytrace") { if (device_company != "qemu" && support_executable_file) { external_deps += [ "hiview:libucollection_client" ] } + external_deps += [ + "bounds_checking_function:libsec_static", + "zlib:libz", + ] include_dirs = [ "./include", - "//third_party/zlib", "../frameworks/include/", "../interfaces/native/innerkits/include/hitrace_meter", - "//third_party/bounds_checking_function/include", ] subsystem_name = "hiviewdfx" part_name = "hitrace" @@ -119,7 +119,13 @@ ohos_prebuilt_etc("hitrace.cfg") { ohos_executable("hitrace_example") { sources = [ "example/hitrace_example.cpp" ] deps = [ "../interfaces/native/innerkits:hitrace_meter" ] - external_deps = [ "hilog:libhilog" ] + + external_deps = [] + if (defined(ohos_lite)) { + external_deps += [ "hilog_lite:hilog_lite" ] + } else { + external_deps += [ "hilog:libhilog" ] + } install_enable = false subsystem_name = "hiviewdfx" part_name = "hitrace" diff --git a/frameworks/hitrace_ndk/BUILD.gn b/frameworks/hitrace_ndk/BUILD.gn index 91f6596..64f299d 100644 --- a/frameworks/hitrace_ndk/BUILD.gn +++ b/frameworks/hitrace_ndk/BUILD.gn @@ -22,7 +22,13 @@ ohos_shared_library("hitrace_ndk") { sources = [ "hitrace_meter_ndk.c" ] deps = [ "../../interfaces/native/innerkits:hitrace_meter" ] - external_deps = [ "hilog:libhilog" ] + + external_deps = [] + if (defined(ohos_lite)) { + external_deps += [ "hilog_lite:hilog_lite" ] + } else { + external_deps += [ "hilog:libhilog" ] + } innerapi_tags = [ "ndk" ] part_name = "hitrace" diff --git a/frameworks/native/BUILD.gn b/frameworks/native/BUILD.gn index df968a3..8e67ea0 100644 --- a/frameworks/native/BUILD.gn +++ b/frameworks/native/BUILD.gn @@ -14,17 +14,13 @@ import("//build/ohos.gni") ohos_source_set("hitracechain_source") { - include_dirs = [ - "../../interfaces/native/innerkits/include", - "//third_party/bounds_checking_function/include", - ] + include_dirs = [ "../../interfaces/native/innerkits/include" ] sources = [ "hitracechain.cpp", "hitracechainc.c", "hitraceid.cpp", ] - deps = [ "//third_party/bounds_checking_function:libsec_static" ] external_deps = [] @@ -33,6 +29,7 @@ ohos_source_set("hitracechain_source") { } else { external_deps += [ "hilog:libhilog" ] } + external_deps += [ "bounds_checking_function:libsec_static" ] part_name = "hitrace" subsystem_name = "hiviewdfx" diff --git a/frameworks/native/c_wrapper/BUILD.gn b/frameworks/native/c_wrapper/BUILD.gn index af0b24f..9508619 100644 --- a/frameworks/native/c_wrapper/BUILD.gn +++ b/frameworks/native/c_wrapper/BUILD.gn @@ -18,16 +18,18 @@ ohos_shared_library("hitracechain_c_wrapper") { "../../native", "../c_wrapper/include", "../../native/innerkits/include", - "//third_party/bounds_checking_function/include", ] sources = [ "./source/hitracechain_c_wrapper.c" ] - deps = [ - "../../../interfaces/native/innerkits:libhitracechain", - "//third_party/bounds_checking_function:libsec_static", - ] - external_deps = [ "hilog:libhilog" ] + deps = [ "../../../interfaces/native/innerkits:libhitracechain" ] + + external_deps = [ "bounds_checking_function:libsec_static" ] + if (defined(ohos_lite)) { + external_deps += [ "hilog_lite:hilog_lite" ] + } else { + external_deps += [ "hilog:libhilog" ] + } output_extension = "so" diff --git a/interfaces/js/kits/napi/BUILD.gn b/interfaces/js/kits/napi/BUILD.gn index 9b2bf17..9e4c63d 100644 --- a/interfaces/js/kits/napi/BUILD.gn +++ b/interfaces/js/kits/napi/BUILD.gn @@ -29,10 +29,13 @@ ohos_shared_library("hitracechain_napi") { deps = [ "../../../native/innerkits:libhitracechain" ] - external_deps = [ - "hilog:libhilog", - "napi:ace_napi", - ] + external_deps = [] + if (defined(ohos_lite)) { + external_deps += [ "hilog_lite:hilog_lite" ] + } else { + external_deps += [ "hilog:libhilog" ] + } + external_deps += [ "napi:ace_napi" ] relative_install_dir = "module" @@ -44,10 +47,13 @@ ohos_shared_library("hitracechain_napi") { ohos_shared_library("hitracemeter_napi") { sources = [ "./hitracemeter/napi_hitrace_meter.cpp" ] deps = [ "../../../native/innerkits:hitrace_meter" ] - external_deps = [ - "hilog:libhilog", - "napi:ace_napi", - ] + external_deps = [] + if (defined(ohos_lite)) { + external_deps += [ "hilog_lite:hilog_lite" ] + } else { + external_deps += [ "hilog:libhilog" ] + } + external_deps += [ "napi:ace_napi" ] relative_install_dir = "module" diff --git a/interfaces/native/innerkits/BUILD.gn b/interfaces/native/innerkits/BUILD.gn index 8d7ab31..420795d 100644 --- a/interfaces/native/innerkits/BUILD.gn +++ b/interfaces/native/innerkits/BUILD.gn @@ -59,10 +59,7 @@ ohos_shared_library("libhitracechain") { config("hitrace_meter_config") { visibility = [ ":*" ] - include_dirs = [ - "include/hitrace_meter", - "//third_party/bounds_checking_function/include", - ] + include_dirs = [ "include/hitrace_meter" ] } ohos_static_library("hitrace_inner") { @@ -101,7 +98,6 @@ ohos_shared_library("hitrace_dump") { include_dirs = [ "./include", "../../../frameworks/include/", - "//third_party/bounds_checking_function/include", ] public_configs = [ ":hitrace_dump_config" ] sources = [ @@ -112,11 +108,11 @@ ohos_shared_library("hitrace_dump") { deps = [ "../../../config:hitrace_utils", - "//third_party/bounds_checking_function:libsec_static", "//third_party/cJSON:cjson", ] external_deps = [ + "bounds_checking_function:libsec_static", "init:libbeget_proxy", "init:libbegetutil", ] @@ -138,9 +134,15 @@ ohos_shared_library("hitrace_meter") { ":hitrace_etc", ":hitrace_inner", ":libhitracechain", - "//third_party/bounds_checking_function:libsec_static", ] - external_deps = [ "hilog:libhilog" ] + + external_deps = [ "bounds_checking_function:libsec_static" ] + if (defined(ohos_lite)) { + external_deps += [ "hilog_lite:hilog_lite" ] + } else { + external_deps += [ "hilog:libhilog" ] + } + output_extension = "so" innerapi_tags = [ diff --git a/interfaces/native/innerkits/src/hitrace_dump.cpp b/interfaces/native/innerkits/src/hitrace_dump.cpp index ec4bd58..e4cabca 100644 --- a/interfaces/native/innerkits/src/hitrace_dump.cpp +++ b/interfaces/native/innerkits/src/hitrace_dump.cpp @@ -499,7 +499,7 @@ bool WriteFile(uint8_t contentType, const std::string &src, int outFd) ssize_t readBytes = TEMP_FAILURE_RETRY(read(srcFd, g_buffer + bytes, PAGE_SIZE)); if (readBytes <= 0) { endFlag = true; - HILOG_ERROR(LOG_CORE, "WriteFile: read %{public}s failed.", src.c_str()); + HILOG_INFO(LOG_CORE, "WriteFile: read %{public}s end or failed.", src.c_str()); break; } diff --git a/lite/BUILD.gn b/lite/BUILD.gn deleted file mode 100644 index c2672e9..0000000 --- a/lite/BUILD.gn +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2020 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. - -import("//build/lite/config/component/lite_component.gni") -import("//build/lite/ndk/ndk.gni") - -hitrace_sources = [ - "../frameworks/native/hitrace.cpp", - "../frameworks/native/hitracec.c", - "../frameworks/native/hitraceid.cpp", -] - -config("hitrace_config") { - include_dirs = [ - "../interfaces/native/innerkits", - "../interfaces/native/innerkits/include", - "//third_party/bounds_checking_function/include", - ] -} - -lite_library("hitrace") { - target_type = "shared_library" - sources = hitrace_sources - public_configs = [ ":hitrace_config" ] - public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - external_deps = [ "hilog_lite:hilog_shared" ] - cflags = [ "-Wall" ] -} diff --git a/lite/test/BUILD.gn b/lite/test/BUILD.gn deleted file mode 100644 index e701da9..0000000 --- a/lite/test/BUILD.gn +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (c) 2021 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. - -import("//build/lite/config/component/lite_component.gni") -import("//build/lite/config/test.gni") - -hitrace_root_dir = "../.." -hitrace_code_dir = "${hitrace_root_dir}/frameworks/native" -hitrace_test_dir = "${hitrace_root_dir}/test/unittest" - -config("module_private_config") { - visibility = [ ":*" ] - include_dirs = [ - "../../interfaces/native/innerkits/include", - "//third_party/bounds_checking_function/include", - ] -} - -unittest("HitraceCTest") { - sources = [ - "${hitrace_code_dir}/hitracec.c", - "${hitrace_test_dir}/common/native/hitracec_test.cpp", - ] - - configs = [ ":module_private_config" ] - - public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - external_deps = [ "hilog_lite:hilog_shared" ] -} - -unittest("HitraceCppTest") { - sources = [ - "${hitrace_code_dir}/hitrace.cpp", - "${hitrace_code_dir}/hitracec.c", - "${hitrace_code_dir}/hitraceid.cpp", - "${hitrace_test_dir}/common/native/hitracecpp_test.cpp", - ] - - configs = [ ":module_private_config" ] - - public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - external_deps = [ "hilog_lite:hilog_shared" ] -} - -group("unittest") { - if (ohos_build_type == "debug") { - deps = [ - ":HitraceCTest", - ":HitraceCppTest", - ] - } -} diff --git a/test/BUILD.gn b/test/BUILD.gn index 6f4ac23..40be61d 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -17,10 +17,7 @@ module_output_path = "hiviewdfx/hitrace" config("module_private_config") { visibility = [ ":*" ] - include_dirs = [ - "../interfaces/native/innerkits/include", - "//third_party/bounds_checking_function/include", - ] + include_dirs = [ "../interfaces/native/innerkits/include" ] } ohos_unittest("HitraceCTest") { @@ -33,10 +30,7 @@ ohos_unittest("HitraceCTest") { configs = [ ":module_private_config" ] - deps = [ - "//third_party/bounds_checking_function:libsec_static", - "//third_party/googletest:gtest_main", - ] + deps = [ "//third_party/googletest:gtest_main" ] external_deps = [] if (defined(ohos_lite)) { @@ -44,6 +38,7 @@ ohos_unittest("HitraceCTest") { } else { external_deps += [ "hilog:libhilog" ] } + external_deps += [ "bounds_checking_function:libsec_static" ] } ohos_unittest("HitraceCppTest") { @@ -58,10 +53,7 @@ ohos_unittest("HitraceCppTest") { configs = [ ":module_private_config" ] - deps = [ - "//third_party/bounds_checking_function:libsec_static", - "//third_party/googletest:gtest_main", - ] + deps = [ "//third_party/googletest:gtest_main" ] external_deps = [] if (defined(ohos_lite)) { @@ -69,6 +61,7 @@ ohos_unittest("HitraceCppTest") { } else { external_deps += [ "hilog:libhilog" ] } + external_deps += [ "bounds_checking_function:libsec_static" ] } config("HitraceNDKTest_config") { @@ -77,7 +70,6 @@ config("HitraceNDKTest_config") { include_dirs = [ "../cmd/include", "../interfaces/native/innerkits/include/hitrace_meter", - "//third_party/bounds_checking_function/include", ] } @@ -92,7 +84,6 @@ ohos_unittest("HitraceNDKTest") { "../cmd:hitrace_osal_inner", "../interfaces/native/innerkits:hitrace_meter", "../interfaces/native/innerkits:libhitracechain", - "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] @@ -102,6 +93,7 @@ ohos_unittest("HitraceNDKTest") { } else { external_deps += [ "hilog:libhilog" ] } + external_deps += [ "bounds_checking_function:libsec_static" ] } ohos_unittest("HitraceDumpTest") { @@ -116,12 +108,13 @@ ohos_unittest("HitraceDumpTest") { deps = [ "../interfaces/native/innerkits:hitrace_dump", - "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] - external_deps = [ "init:libbegetutil" ] - + external_deps = [ + "bounds_checking_function:libsec_static", + "init:libbegetutil", + ] if (defined(ohos_lite)) { external_deps += [ "hilog_lite:hilog_lite" ] } else {