Backup.
This commit is contained in:
parent
70a8d15021
commit
949f29fbd7
|
@ -1,3 +1,4 @@
|
|||
|
||||
add_subdirectory(HuntingCamera)
|
||||
add_subdirectory(MissionManager)
|
||||
add_subdirectory(MissionManager)
|
||||
add_subdirectory(VersionReleaseTool)
|
|
@ -45,7 +45,7 @@ endif()
|
|||
|
||||
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||
add_custom_target(
|
||||
HunttingCameraTest_code_check
|
||||
HuntingCameraTest_code_check
|
||||
COMMAND ${CLANG_TIDY_EXE}
|
||||
-checks='${CLANG_TIDY_CHECKS}'
|
||||
--header-filter=.*
|
||||
|
@ -61,13 +61,13 @@ add_custom_target(
|
|||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make HunttingCameraTest_code_check
|
||||
COMMAND make HuntingCameraTest_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
HunttingCameraTest_code_format
|
||||
HuntingCameraTest_code_format
|
||||
COMMAND ${CLANG_FORMAT_EXE}
|
||||
-style=file
|
||||
-i ${SRC_FILES} ${SRC_FILES_MAIN} ${HEADER_FILES}
|
||||
|
@ -76,8 +76,8 @@ add_custom_target(
|
|||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make HunttingCameraTest_code_check
|
||||
COMMAND make HunttingCameraTest_code_format
|
||||
COMMAND make HuntingCameraTest_code_check
|
||||
COMMAND make HuntingCameraTest_code_format
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
endif()
|
||||
|
|
84
test/application/VersionReleaseTool/CMakeLists.txt
Normal file
84
test/application/VersionReleaseTool/CMakeLists.txt
Normal file
|
@ -0,0 +1,84 @@
|
|||
# include(${CMAKE_SOURCE_DIR}/build/independent_source.cmake)
|
||||
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||
# include(${APPLICATION_SOURCE_PATH}/VersionRelease/build/hunting_camera.cmake)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${TEST_OUTPUT_PATH}/bin)
|
||||
|
||||
include_directories(
|
||||
./src
|
||||
# ${HUNTTING_MAIN_INCLUDE_PATH}
|
||||
# ${MIDDLEWARE_SOURCE_PATH}/McuManager/include
|
||||
# ${MIDDLEWARE_SOURCE_PATH}/McuManager/src
|
||||
${UTILS_SOURCE_PATH}/UpgradeTool/include
|
||||
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||
${UTILS_SOURCE_PATH}/Log/include
|
||||
${TEST_SOURCE_PATH}
|
||||
# ${TEST_SOURCE_PATH}/application/MissionManager/tool/include
|
||||
# ${TEST_SOURCE_PATH}/middleware/McuManager/tool/include
|
||||
# ${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
|
||||
# ${TEST_SOURCE_PATH}/utils/LinuxApiMock/include
|
||||
# ${TEST_SOURCE_PATH}/utils/TestManager/include
|
||||
# ${TEST_SOURCE_PATH}/utils/McuProtocol/tool/include
|
||||
# ${TEST_SOURCE_PATH}/utils/UartDevice/tool/include
|
||||
# ${TEST_SOURCE_PATH}/hal/tool/include
|
||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
|
||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/include
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
aux_source_directory(. SRC_FILES_MAIN)
|
||||
aux_source_directory(./src SRC_FILES)
|
||||
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
|
||||
aux_source_directory(./src_mock SRC_FILES)
|
||||
endif()
|
||||
|
||||
set(TARGET_NAME VersionReleaseTool)
|
||||
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
||||
target_link_libraries(${TARGET_NAME} UpgradeTool StatusCode Log gtest gmock pthread)
|
||||
if(${TEST_COVERAGE} MATCHES "true")
|
||||
target_link_libraries(${TARGET_NAME} gcov)
|
||||
endif()
|
||||
|
||||
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||
add_custom_target(
|
||||
VersionReleaseTool_code_check
|
||||
COMMAND ${CLANG_TIDY_EXE}
|
||||
-checks='${CLANG_TIDY_CHECKS}'
|
||||
--header-filter=.*
|
||||
--system-headers=false
|
||||
${SRC_FILES}
|
||||
${SRC_FILES_MAIN}
|
||||
${CLANG_TIDY_CONFIG}
|
||||
# --line-filter='[{\"name\":\"${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include/getest/gtest.h\"}]'
|
||||
--line-filter='[{\"name\":\"${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include/getest/*.h\"}]'
|
||||
-p ${PLATFORM_PATH}/cmake-shell
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/VersionRelease
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make VersionReleaseTool_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
VersionReleaseTool_code_format
|
||||
COMMAND ${CLANG_FORMAT_EXE}
|
||||
-style=file
|
||||
-i ${SRC_FILES} ${SRC_FILES_MAIN} ${HEADER_FILES}
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/VersionRelease
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make VersionReleaseTool_code_check
|
||||
COMMAND make VersionReleaseTool_code_format
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
endif()
|
||||
|
||||
define_file_name(${TARGET_NAME})
|
31
test/application/VersionReleaseTool/mainTest.cpp
Normal file
31
test/application/VersionReleaseTool/mainTest.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Fancy Code.
|
||||
* 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.
|
||||
*/
|
||||
#include "ArgvAnalysis.h"
|
||||
#include "ILog.h"
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CreateLogModule();
|
||||
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||
ArgvAnalysis::GetInstance()->Analyze(argc, argv);
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
RUN_ALL_TESTS();
|
||||
ILogUnInit();
|
||||
DestroyLogModule();
|
||||
return 0;
|
||||
}
|
58
test/application/VersionReleaseTool/src/ArgvAnalysis.cpp
Normal file
58
test/application/VersionReleaseTool/src/ArgvAnalysis.cpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Fancy Code.
|
||||
* 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.
|
||||
*/
|
||||
#include "ArgvAnalysis.h"
|
||||
#include "ILog.h"
|
||||
std::shared_ptr<ArgvAnalysis> &ArgvAnalysis::GetInstance(std::shared_ptr<ArgvAnalysis> *impl)
|
||||
{
|
||||
static auto instance = std::make_shared<ArgvAnalysis>();
|
||||
if (impl) {
|
||||
if (instance.use_count() == 1) {
|
||||
LogInfo("Instance changed succeed.\n");
|
||||
instance = *impl;
|
||||
}
|
||||
else {
|
||||
LogError("Can't changing the instance becase of using by some one.\n");
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
void ArgvAnalysis::Analyze(int argc, char *argv[])
|
||||
{
|
||||
LogInfo("argc: %d\n", argc);
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string arg = argv[i];
|
||||
size_t pos = arg.find('=');
|
||||
|
||||
if (pos != std::string::npos) {
|
||||
std::string key = arg.substr(0, pos);
|
||||
std::string value = arg.substr(pos + 1);
|
||||
|
||||
// remove'--'
|
||||
if (key.substr(0, 2) == "--") {
|
||||
key = key.substr(2);
|
||||
}
|
||||
|
||||
mOptions[key] = value;
|
||||
}
|
||||
else {
|
||||
LogError("Invalid argument format: %s\n", arg.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &pair : mOptions) {
|
||||
LogInfo("Key: %s, Value: %s\n", pair.first.c_str(), pair.second.c_str());
|
||||
}
|
||||
}
|
31
test/application/VersionReleaseTool/src/ArgvAnalysis.h
Normal file
31
test/application/VersionReleaseTool/src/ArgvAnalysis.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Fancy Code.
|
||||
* 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 ARGV_ANALYSIS_H
|
||||
#define ARGV_ANALYSIS_H
|
||||
#include "StatusCode.h"
|
||||
#include <map>
|
||||
#include <thread>
|
||||
class ArgvAnalysis
|
||||
{
|
||||
public:
|
||||
ArgvAnalysis() = default;
|
||||
virtual ~ArgvAnalysis() = default;
|
||||
static std::shared_ptr<ArgvAnalysis> &GetInstance(std::shared_ptr<ArgvAnalysis> *impl = nullptr);
|
||||
void Analyze(int argc, char *argv[]);
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> mOptions;
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Fancy Code.
|
||||
* 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.
|
||||
*/
|
||||
#include "GtestUsing.h"
|
||||
#include "ILog.h"
|
||||
#include "UpgradeTool.h"
|
||||
#include "VersionReleaseTool.h"
|
||||
#include <thread>
|
||||
namespace VersionReleaseTool
|
||||
{
|
||||
TEST(VersionReleaseTool, Version)
|
||||
{
|
||||
UpgradeTool::GetInstance()->PackFile("src", "output", "1.0.0", "product", "project", "upgradeType");
|
||||
}
|
||||
} // namespace VersionReleaseTool
|
18
test/application/VersionReleaseTool/src/VersionReleaseTool.h
Normal file
18
test/application/VersionReleaseTool/src/VersionReleaseTool.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Fancy Code.
|
||||
* 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 VERSION_RELEASE_TOOL_H
|
||||
#define VERSION_RELEASE_TOOL_H
|
||||
|
||||
#endif
|
|
@ -9,5 +9,16 @@
|
|||
|
||||
使用方法:
|
||||
```
|
||||
./delete_test_code.sh ../../test/
|
||||
$ cd //tools/shell
|
||||
$ ./delete_test_code.sh ../../test/
|
||||
```
|
||||
|
||||
## 1.3. delete_sdk_code.sh
|
||||
|
||||
  根据需要,删除SDK当中若干模块的src代码。
|
||||
|
||||
使用方法:
|
||||
```
|
||||
$ cd //tools/shell
|
||||
$ ./delete_sdk_code.sh
|
||||
```
|
45
tools/shell/delete_sdk_code.sh
Executable file
45
tools/shell/delete_sdk_code.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 查找目录列表
|
||||
# search_dirs=("../../middleware" "../../application" "../../utils")
|
||||
search_dirs=("../../test-utils")
|
||||
|
||||
# 保留目录列表
|
||||
preserve_dirs=("../../test-utils/LinuxApi" "../../test-utils/ConfigBase")
|
||||
|
||||
# 遍历查找目录
|
||||
for search_dir in "${search_dirs[@]}"; do
|
||||
echo "正在处理目录: $search_dir"
|
||||
|
||||
# 使用find命令遍历目录并删除文件
|
||||
find "$search_dir" -type d | while read -r dir; do
|
||||
# 检查目录是否在保留列表中
|
||||
is_preserve=false
|
||||
for preserve_dir in "${preserve_dirs[@]}"; do
|
||||
if [[ "$dir" == *"$preserve_dir"* ]]; then
|
||||
is_preserve=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# 如果目录不在保留列表中,则删除src目录和CMakeLists.txt
|
||||
if [[ $is_preserve == false ]]; then
|
||||
src_dir="$dir/src"
|
||||
cmake_file="$dir/CMakeLists.txt"
|
||||
|
||||
# 如果src目录存在,则删除它
|
||||
if [[ -d "$src_dir" ]]; then
|
||||
echo "删除目录: $src_dir"
|
||||
rm -rf "$src_dir"
|
||||
fi
|
||||
|
||||
# 如果CMakeLists.txt文件存在,则删除它
|
||||
if [[ -f "$cmake_file" ]]; then
|
||||
echo "删除文件: $cmake_file"
|
||||
rm "$cmake_file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "处理完成"
|
Loading…
Reference in New Issue
Block a user