Update Ubuntu CI scripts

This commit is contained in:
vczh
2026-07-12 18:38:34 -07:00
parent 8a0eb3e9b7
commit 353f46a9a0
5 changed files with 41 additions and 20 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ function Help {
function Make {
if [ -a vmake ]; then
vt4 --preprocess ./vmake | vt4 --evaluate | ${SHELL} > makefile
vt4 --preprocess ./vmake | vt4 --evaluate | "${BASH}" > makefile
else
echo "Cannot find ./vmake ."
exit 1
+5 -5
View File
@@ -15,13 +15,13 @@ function Error {
}
function Preprocess {
PATTERN='^\s*<#@\s*include\s*"([^"]*)"\s*#>\s*$'
PATTERN='^[[:space:]]*<#@[[:space:]]*include[[:space:]]*"([^"]*)"[[:space:]]*#>[[:space:]]*$'
cat $1 | while read -r LINE; do
INCLUDE_STAT=`echo "${LINE}" | grep -E ${PATTERN}`
INCLUDE_STAT=`echo "${LINE}" | grep -E "${PATTERN}"`
if [[ "$INCLUDE_STAT" == "" ]]; then
echo "${LINE}"
else
INCLUDE_FILE=`echo "${LINE}" | sed -r -e 's%'${PATTERN}'%\1%g'`
INCLUDE_FILE=`echo "${LINE}" | sed -E -e 's%'${PATTERN}'%\1%g'`
INCLUDE_DIR=`dirname ${INCLUDE_FILE}`
INCLUDE_NAME=`basename ${INCLUDE_FILE}`
@@ -47,8 +47,8 @@ function Evaluate {
cat $1 | while read -r LINE; do
COLUMN_NUMBER=0
PARTS=`echo $LINE | sed -r -e 's%(<#=\s*|<#\s*|\s*#>)%\n\1\n%g'`
PARTS=`echo "$PARTS" | sed -r -e 's%^<#=\s*$%<#=%g;s%^<#\s*$%<#%g;s%^\s*#>$%#>%g'`
PARTS=`echo $LINE | sed -E -e 's%(<#=[[:space:]]*|<#[[:space:]]*|[[:space:]]*#>)%\n\1\n%g'`
PARTS=`echo "$PARTS" | sed -E -e 's%^<#=[[:space:]]*$%<#=%g;s%^<#[[:space:]]*$%<#%g;s%^[[:space:]]*#>$%#>%g'`
PURE_COMMAND=1
while read -r PART; do
+1 -1
View File
@@ -1,3 +1,3 @@
#!/bin/bash
echo `clang++ --std=c++20 $1 -MM $2` | sed -r -e 's%[\]\s*%%g'
echo `clang++ --std=c++20 $1 -MM $2` | sed -E -e 's%\\[[:space:]]*%%g'
+9 -4
View File
@@ -7,13 +7,18 @@ fi
CONTENT=`cat $1`
# extract all cpp files
PATTERN='<ClCompile\s+Include="(\$\(MSBuildThisFileDirectory\))?([^"]+.cpp)"\s*/?\s*>'
COMPILES=`echo "${CONTENT}" | grep -E ${PATTERN}`
CPPS=`echo "${COMPILES}" | sed -r -e 's%\s*'${PATTERN}'\s*%\2%g'`
PATTERN='<ClCompile[[:space:]]+Include="(\$\(MSBuildThisFileDirectory\))?([^"]+.cpp)"[[:space:]]*/?[[:space:]]*>'
COMPILES=`echo "${CONTENT}" | grep -E "${PATTERN}"`
CPPS=`echo "${COMPILES}" | sed -E -e 's%[[:space:]]*'${PATTERN}'[[:space:]]*%\2%g'`
# refine file names
CPPS=`echo "${CPPS}" | sed -e 's%[\]%/%g'`
CPPS=`echo "${CPPS}" | sed -e 's%^%'${PWD}/$(dirname $1)/'%g'`
if [ "$(uname -s)" == "Darwin" ]; then
REALPATH=grealpath
else
REALPATH=realpath
fi
echo "${CPPS}" | while read -r CPP; do
realpath --relative-to="${PWD}" ${CPP}
"${REALPATH}" --relative-to="${PWD}" "${CPP}"
done
+25 -9
View File
@@ -9,16 +9,32 @@ for CPP_VCXPROJ_ITEM in "${CPP_VCXPROJS[@]}"; do
done
# Remove duplicated items (preserve the first occurrence, like LINQ Distinct)
declare -A __vutil_seen_cpp_files
__vutil_distinct_cpp_files=()
for __vutil_cpp_file in "${CPP_FILES[@]}"; do
if [ "${__vutil_seen_cpp_files["${__vutil_cpp_file}"]+x}" == "" ]; then
__vutil_seen_cpp_files["${__vutil_cpp_file}"]=1
__vutil_distinct_cpp_files+=("${__vutil_cpp_file}")
fi
done
if [ "${BASH_VERSINFO[0]}" -ge 4 ]; then
declare -A __vutil_seen_cpp_files
for __vutil_cpp_file in "${CPP_FILES[@]}"; do
if [ "${__vutil_seen_cpp_files["${__vutil_cpp_file}"]+x}" == "" ]; then
__vutil_seen_cpp_files["${__vutil_cpp_file}"]=1
__vutil_distinct_cpp_files+=("${__vutil_cpp_file}")
fi
done
unset __vutil_seen_cpp_files
else
for __vutil_cpp_file in "${CPP_FILES[@]}"; do
__vutil_cpp_file_exists=0
for __vutil_distinct_cpp_file in "${__vutil_distinct_cpp_files[@]}"; do
if [ "${__vutil_cpp_file}" == "${__vutil_distinct_cpp_file}" ]; then
__vutil_cpp_file_exists=1
break
fi
done
if [ "${__vutil_cpp_file_exists}" -eq 0 ]; then
__vutil_distinct_cpp_files+=("${__vutil_cpp_file}")
fi
done
fi
CPP_FILES=("${__vutil_distinct_cpp_files[@]}")
unset __vutil_seen_cpp_files __vutil_distinct_cpp_files __vutil_cpp_file
unset __vutil_distinct_cpp_files __vutil_cpp_file __vutil_cpp_file_exists __vutil_distinct_cpp_file
for CPP_REMOVE in "${CPP_REMOVES[@]}"; do
CPP_FILES=(${CPP_FILES[@]/$CPP_REMOVE})
@@ -32,7 +48,7 @@ CPP_FILE_LIST=("${CPP_FILES[@]}")
printf -v CPP_FILES "%s\n" "${CPP_FILE_LIST[@]}"
CPP_FILES=${CPP_FILES%?}
O_FILES=`echo "${CPP_FILES}" | sed -r -e 's%([^/]*/)*([^/]+).cpp%./Obj/\2.o%g'`
O_FILES=`echo "${CPP_FILES}" | sed -E -e 's%([^/]*/)*([^/]+).cpp%./Obj/\2.o%g'`
O_FILES=`echo ${O_FILES}`
printf "%s\n" "${CPP_FILE_LIST[@]}" > vmake.txt