优化编译脚本,兼容PC编译

Signed-off-by: zourongchun <zourongchun@huawei.com>
This commit is contained in:
zourongchun 2022-03-30 15:29:00 +08:00
parent d7c4944494
commit 9d136d5abe
7 changed files with 57 additions and 24 deletions

View File

@ -316,7 +316,7 @@ int32_t SoftBusSocketSelect(int32_t nfds, SoftBusFdSet *readFds, SoftBusFdSet *w
sysTimeOut.tv_sec = timeOut->sec;
sysTimeOut.tv_usec = timeOut->usec;
int32_t ret = select(nfds, tempReadSet, tempWriteSet, tempExceptSet, sysTimeOut);
int32_t ret = select(nfds, tempReadSet, tempWriteSet, tempExceptSet, &sysTimeOut);
if (ret < 0) {
HILOG_ERROR(SOFTBUS_HILOG_ID, "select : %{public}s", strerror(errno));
return GetErrorCode();

33
check_sub_module.py Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2022 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 os
import sys
def main():
if sys.argv[1] == "" or sys.argv[2] == "" :
print("false")
return 1
sub_module = os.path.join(sys.argv[1], sys.argv[2])
if os.path.exists(sub_module) == True :
print("true")
return 0
print("false")
return 0
if __name__ == '__main__':
sys.exit(main())

View File

@ -18,8 +18,8 @@ core_lane_hub_path = "$dsoftbus_root_path/core/bus_center/lnn/lane_hub"
native_source_path = rebase_path("$dsoftbus_root_path")
dep_dir = "dsoftbus_enhance/core/bus_center/lnn/lane_hub"
enhanced = exec_script(
"$dsoftbus_root_path/run_shell_cmd.py",
[ "cd $native_source_path; if [ -d $dep_dir ]; then echo true; else echo false; fi" ],
"$dsoftbus_root_path/check_sub_module.py",
[ "$native_source_path","dep_dir"],
"value")
bus_center_hub_inc = [

View File

@ -22,8 +22,8 @@ if (dsoftbus_standard_feature_qos == true) {
native_source_path = rebase_path("$dsoftbus_root_path")
dep_qos = "dsoftbus_enhance/core/transmission/trans_channel/qos/BUILD.gn"
enhanced_qos = exec_script(
"$dsoftbus_root_path/run_shell_cmd.py",
[ "cd $native_source_path; if [ -f $dep_qos ]; then echo true; else echo false; fi" ],
"$dsoftbus_root_path/check_sub_module.py",
[ "$native_source_path","dep_qos"],
"value")
if (enhanced_qos) {
trans_qos_deps += [ "$dsoftbus_root_path/dsoftbus_enhance/core/transmission/trans_channel/qos:dsoftbus_trans_qos" ]

View File

@ -30,8 +30,8 @@ if (dsoftbus_standard_feature_trans_udp_file == true) {
native_source_path = rebase_path("$dsoftbus_root_path")
dep_file = "components/nstackx_enhanced/nstackx_core/dfile/BUILD.gn"
enhanced = exec_script(
"$dsoftbus_root_path/run_shell_cmd.py",
[ "cd $native_source_path; if [ -f $dep_file ]; then echo true; else echo false; fi" ],
"$dsoftbus_root_path/check_sub_module.py",
[ "$native_source_path","dep_file"],
"value")
if (enhanced) {
trans_file_sdk_inc += [

View File

@ -17,8 +17,8 @@ libsoftbus_stream_sdk_path = "$dsoftbus_root_path/sdk/transmission/trans_channel
dstream_native_source_path = rebase_path("$dsoftbus_root_path")
dstream_dep_file = "components/nstackx_enhanced/fillp/BUILD.gn"
enhanced = exec_script(
"$dsoftbus_root_path/run_shell_cmd.py",
[ "cd $dstream_native_source_path; if [ -f $dstream_dep_file ]; then echo true; else echo false; fi" ],
"$dsoftbus_root_path/check_sub_module.py",
[ "$dstream_native_source_path","dstream_dep_file"],
"value")
libsoftbus_stream_inc = [

View File

@ -1080,9 +1080,9 @@ HWTEST_F(DsoftbusSocketTest, SoftBusSocketSelectTest001, TestSize.Level0)
{
int32_t socketFd;
SoftBusFdSet readFds;
struct timeval tv = {
.tv_sec = 5,
.tv_usec = 1
SoftBusSockTimeOut tv = {
.sec = 5,
.usec = 1
};
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(0, ret);
@ -1107,9 +1107,9 @@ HWTEST_F(DsoftbusSocketTest, SoftBusSocketSelectTest002, TestSize.Level0)
int32_t socketFd;
SoftBusFdSet writeFds;
SoftBusFdSet fdSelect;
struct timeval tv = {
.tv_sec = 5,
.tv_usec = 1
SoftBusSockTimeOut tv = {
.sec = 5,
.usec = 1
};
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(0, ret);
@ -1135,9 +1135,9 @@ HWTEST_F(DsoftbusSocketTest, SoftBusSocketSelectTest003, TestSize.Level0)
int32_t socketFd;
SoftBusFdSet exceptFds;
SoftBusFdSet fdSelect;
struct timeval tv = {
.tv_sec = 5,
.tv_usec = 1
SoftBusSockTimeOut tv = {
.sec = 5,
.usec = 1
};
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(0, ret);
@ -1161,9 +1161,9 @@ HWTEST_F(DsoftbusSocketTest, SoftBusSocketSelectTest003, TestSize.Level0)
HWTEST_F(DsoftbusSocketTest, SoftBusSocketSelectTest004, TestSize.Level0)
{
SoftBusFdSet readFds, writeFds, exceptFds;
struct timeval tv = {
.tv_sec = 5,
.tv_usec = 1
SoftBusSockTimeOut tv = {
.sec = 5,
.usec = 1
};
SoftBusSocketFdZero(&readFds);
SoftBusSocketFdZero(&writeFds);
@ -1180,9 +1180,9 @@ HWTEST_F(DsoftbusSocketTest, SoftBusSocketSelectTest004, TestSize.Level0)
*/
HWTEST_F(DsoftbusSocketTest, SoftBusSocketSelectTest005, TestSize.Level0)
{
struct timeval tv = {
.tv_sec = 5,
.tv_usec = 1
SoftBusSockTimeOut tv = {
.sec = 5,
.usec = 1
};
int32_t ret = SoftBusSocketSelect(SET_SIZE, NULL, NULL, NULL, &tv);
EXPECT_TRUE(ret >= 0);