update .gn

Signed-off-by: lixing0101 <lixing141@huawei.com>
This commit is contained in:
lixing0101 2024-03-11 16:45:39 +08:00
parent 6ae8c712ce
commit 7f81427d99
11 changed files with 71 additions and 159 deletions

View File

@ -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": {

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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") {
@ -100,7 +97,6 @@ ohos_shared_library("hitrace_dump") {
include_dirs = [
"./include",
"../../../frameworks/include/",
"//third_party/bounds_checking_function/include",
]
public_configs = [ ":hitrace_dump_config" ]
sources = [
@ -111,11 +107,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",
]
@ -137,9 +133,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 = [

View File

@ -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;
}

View File

@ -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" ]
}

View File

@ -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",
]
}
}

View File

@ -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 {