updated regex and shell finding command
This commit is contained in:
parent
5d31d1e97f
commit
bca83430f7
1 changed files with 37 additions and 14 deletions
|
|
@ -1,21 +1,20 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Author: Jake Goodwin
|
# Author: Jake Goodwin
|
||||||
# Date: 2026
|
# Date: 2026
|
||||||
# Filename: otto.sh
|
# Filename: otto.sh
|
||||||
|
# Description: Automates the TDD process.
|
||||||
|
|
||||||
CROSS_TC_WIN="$(pwd)/i686-w64-mingw32_toolchain.cmake"
|
CROSS_TC_WIN="$(pwd)/i686-w64-mingw32_toolchain.cmake"
|
||||||
CMAKE_VERBOSE="ON"
|
CMAKE_VERBOSE="ON"
|
||||||
CROSS_COMPILE=1
|
CROSS_COMPILE=1
|
||||||
TEMPLATE_FILES=".template_files"
|
TEMPLATE_FILES=".template_files"
|
||||||
MODULE_DIR="${TEMPLATE_FILES}/modules"
|
MODULE_DIR="${TEMPLATE_FILES}/modules"
|
||||||
|
TEST_MODULE_DIR="${TEMPLATE_FILES}/test_module"
|
||||||
|
|
||||||
PROJECT_NAME="WCH_Template"
|
PROJECT_NAME="template"
|
||||||
|
|
||||||
generate_tags_file () {
|
|
||||||
echo "generate_tags_file()"
|
|
||||||
# Saving current directory
|
|
||||||
#CUR_DIR=$(pwd)
|
|
||||||
|
|
||||||
|
run_uc_tags() {
|
||||||
uctags --recurse=yes \
|
uctags --recurse=yes \
|
||||||
--languages=C,C++,Asm \
|
--languages=C,C++,Asm \
|
||||||
--extras=+q \
|
--extras=+q \
|
||||||
|
|
@ -24,9 +23,29 @@ generate_tags_file () {
|
||||||
--exclude=build \
|
--exclude=build \
|
||||||
--exclude=.git \
|
--exclude=.git \
|
||||||
--exclude=.template_files \
|
--exclude=.template_files \
|
||||||
|
--exclude=*.txt \
|
||||||
|
--exclude=*.md \
|
||||||
|
--exclude=*.S \
|
||||||
|
--exclude=*.json \
|
||||||
./
|
./
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generate_tags_file () {
|
||||||
|
echo "generate_tags_file()"
|
||||||
|
|
||||||
|
if find "tags" -mmin +30 | grep -q .; then
|
||||||
|
echo "generating tags."
|
||||||
|
run_uc_tags
|
||||||
|
elif [ ! -e tags ]; then
|
||||||
|
echo "no tags file found runnning tags."
|
||||||
|
run_uc_tags
|
||||||
|
else
|
||||||
|
echo "Skipping tags generation."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
format_source_code () {
|
format_source_code () {
|
||||||
#Get a list of all C files
|
#Get a list of all C files
|
||||||
source_c_files=$(find ./src ./tests/shared -name '*.c')
|
source_c_files=$(find ./src ./tests/shared -name '*.c')
|
||||||
|
|
@ -64,6 +83,10 @@ clear_cmake_cache () {
|
||||||
rm -rf CMakeCache.txt CMakeFiles/
|
rm -rf CMakeCache.txt CMakeFiles/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clean_build_directory() {
|
||||||
|
rm -r ./build/*
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
does_module_exist () {
|
does_module_exist () {
|
||||||
local basename="$1"
|
local basename="$1"
|
||||||
|
|
@ -206,16 +229,16 @@ add_new_module () {
|
||||||
|
|
||||||
add_c_mdoule () {
|
add_c_mdoule () {
|
||||||
|
|
||||||
sed "s/module_name/${modname}/" $MODULE_DIR/module_name.c > $modsrc_dir/${modname}.c
|
sed -e "s/module_name/${modname}/" $MODULE_DIR/module_name.c > $modsrc_dir/${modname}.c
|
||||||
sed -i'' "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.c
|
sed -i'' -e "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.c
|
||||||
|
|
||||||
sed "s/module_name/${modname_cap}/" $MODULE_DIR/module_name.h > $modsrc_dir/${modname}.h
|
sed -e "s/module_name/${modname_cap}/" $MODULE_DIR/module_name.h > $modsrc_dir/${modname}.h
|
||||||
sed -i'' "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.h
|
sed -i'' -e "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.h
|
||||||
|
|
||||||
sed "s/module_name/${modname}/" $MODULE_DIR/CMakeLists.txt > $modsrc_dir/CMakeLists.txt
|
sed -e "s/module_name/${modname}/" $MODULE_DIR/CMakeLists.txt > $modsrc_dir/CMakeLists.txt
|
||||||
|
|
||||||
sed "s/module_name/${modname}/" $MODULE_DIR/test_module_name.cpp > $modtest_dir/test_${modname}.cpp
|
sed -e "s/module_name/${modname}/" $MODULE_DIR/test_module_name.cpp > $modtest_dir/test_${modname}.cpp
|
||||||
sed "s/module_name/${modname}/" $MODULE_DIR/TestCMakeLists.txt > $modtest_dir/CMakeLists.txt
|
sed -e "s/module_name/${modname}/" $MODULE_DIR/TestCMakeLists.txt > $modtest_dir/CMakeLists.txt
|
||||||
|
|
||||||
# Add the module to the cmake lists files.
|
# Add the module to the cmake lists files.
|
||||||
add_module_to_cmakes "${modname}"
|
add_module_to_cmakes "${modname}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue