1
0

i want to sleep...

This commit is contained in:
GenZmeY 2022-02-14 04:57:54 +03:00
parent 844ab522d3
commit 8b91408be6

68
builder
View File

@ -95,12 +95,8 @@ ArgWarnings="false"
ArgNoColors="false" ArgNoColors="false"
# Colors # Colors
# shellcheck disable=SC2034
WHT=''
RED='' RED=''
# shellcheck disable=SC2034
GRN='' GRN=''
# shellcheck disable=SC2034
YLW='' YLW=''
BLU='' BLU=''
DEF='' DEF=''
@ -121,7 +117,7 @@ function get_latest () # $1: Reponame, $2: filename, $3: output filename
msg "download $2 ($LatestTag)" msg "download $2 ($LatestTag)"
mkdir -p "$(dirname "$3")/" mkdir -p "$(dirname "$3")/"
curl -LJs "$DownloadUrl" -o "$3" curl -LJs "$DownloadUrl" -o "$3"
msg "successfully downloaded" msg "${GRN}successfully downloaded${DEF}"
} }
function get_latest_multini () # $1: file to save function get_latest_multini () # $1: file to save
@ -137,12 +133,8 @@ function get_latest_kfeditor_patcher () # $1: file to save
function setup_colors () function setup_colors ()
{ {
if [[ -t 2 ]] && ! is_true "$ArgNoColors" && [[ "${TERM-}" != "dumb" ]]; then if [[ -t 2 ]] && ! is_true "$ArgNoColors" && [[ "${TERM-}" != "dumb" ]]; then
# shellcheck disable=SC2034
WHT='\e[37m'
RED='\e[31m' RED='\e[31m'
# shellcheck disable=SC2034
GRN='\e[32m' GRN='\e[32m'
# shellcheck disable=SC2034
YLW='\e[33m' YLW='\e[33m'
BLU='\e[34m' BLU='\e[34m'
DEF='\e[0m' DEF='\e[0m'
@ -163,7 +155,7 @@ function msg () # $1: String
if is_true "$ArgDebug"; then if is_true "$ArgDebug"; then
echo -e "${BLU}${1-}${DEF}" >&1 echo -e "${BLU}${1-}${DEF}" >&1
else else
echo -e "${DEF}${1-}" >&1 echo -e "${DEF}${1-}${DEF}" >&1
fi fi
fi fi
} }
@ -222,14 +214,14 @@ function cleanup()
function backup_kfeditorconf () function backup_kfeditorconf ()
{ {
msg "backup $KFEditorConf" msg "backup $(basename "$KFEditorConf") to $(basename "$KFEditorConfBackup")"
cp -f "$KFEditorConf" "$KFEditorConfBackup" cp -f "$KFEditorConf" "$KFEditorConfBackup"
} }
function restore_kfeditorconf () function restore_kfeditorconf ()
{ {
if [[ -f "$KFEditorConfBackup" ]]; then if [[ -f "$KFEditorConfBackup" ]]; then
msg "restore $KFEditorConf from backup" msg "restore $(basename "$KFEditorConf") from backup"
mv -f "$KFEditorConfBackup" "$KFEditorConf" mv -f "$KFEditorConfBackup" "$KFEditorConf"
fi fi
} }
@ -238,7 +230,7 @@ function init_build ()
{ {
local PackageList="" local PackageList=""
msg "create new build config ($MutBuildConfig)" msg "creating new build config"
:> "$MutBuildConfig" :> "$MutBuildConfig"
@ -251,6 +243,8 @@ function init_build ()
fi fi
done < <(find "$MutSource" -mindepth 2 -maxdepth 2 -type d -ipath '*/Classes' | sed -r 's|.+/([^/]+)/[^/]+|\1|' | sort) done < <(find "$MutSource" -mindepth 2 -maxdepth 2 -type d -ipath '*/Classes' | sed -r 's|.+/([^/]+)/[^/]+|\1|' | sort)
msg "packages found: $PackageList"
cat > "$MutBuildConfig" <<EOF cat > "$MutBuildConfig" <<EOF
# Build parameters # Build parameters
@ -269,6 +263,8 @@ PackageBuildOrder="$PackageList"
# The order doesn't matter # The order doesn't matter
PackageUpload="$PackageList" PackageUpload="$PackageList"
EOF EOF
msg "${GRN}$(basename "$MutBuildConfig") created${DEF}"
} }
function read_build_settings () function read_build_settings ()
@ -404,7 +400,7 @@ function compile ()
if ! compiled; then if ! compiled; then
die "compilation failed" die "compilation failed"
fi fi
msg "successfully compiled" msg "${GRN}successfully compiled${DEF}"
else else
CMD //C "$(cygpath -w "$KFEditor") make $StripSourceArg -useunpublished" & CMD //C "$(cygpath -w "$KFEditor") make $StripSourceArg -useunpublished" &
PID="$!" PID="$!"
@ -412,7 +408,7 @@ function compile ()
do do
if compiled; then if compiled; then
kill "$PID" kill "$PID"
msg "successfully compiled" msg "${GRN}successfully compiled${DEF}"
break break
fi fi
sleep 1 sleep 1
@ -482,7 +478,7 @@ function brew ()
brew_cleanup brew_cleanup
die "brewing failed" die "brewing failed"
fi fi
msg "successfully brewed" msg "${GRN}successfully brewed${DEF}"
else else
CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditor") brewcontent -platform=PC $PackageUpload -useunpublished" & CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditor") brewcontent -platform=PC $PackageUpload -useunpublished" &
PID="$!" PID="$!"
@ -490,7 +486,7 @@ function brew ()
do do
if brewed; then if brewed; then
kill "$PID" kill "$PID"
msg "successfully brewed" msg "${GRN}successfully brewed${DEF}"
break break
fi fi
sleep 1 sleep 1
@ -521,9 +517,9 @@ function brew_manual ()
get_latest_kfeditor_patcher "$KFEditorPatcher" get_latest_kfeditor_patcher "$KFEditorPatcher"
fi fi
msg "patching $(basename $KFEditor)" msg "patching $(basename "$KFEditor")"
CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorPatcher")" CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorPatcher")"
msg "successfully patched" msg "${GRN}successfully patched${DEF}"
for Package in $PackageUpload for Package in $PackageUpload
do do
@ -531,16 +527,17 @@ function brew_manual ()
mv "$KFWin64/$Package.u" "$KFPublishBrewedPC" mv "$KFWin64/$Package.u" "$KFPublishBrewedPC"
done done
msg "successfully brewed" msg "${GRN}successfully brewed${DEF}"
publish_common publish_common
find "$KFPublish" -type d -empty -delete find "$KFPublish" -type d -empty -delete
} }
# Uploading without brewing
function publish_unpublished () function publish_unpublished ()
{ {
msg "${YLW}warn: uploading without brewing${DEF}"
mkdir -p "$KFPublishBrewedPC" "$KFPublishScript" "$KFPublishPackages" mkdir -p "$KFPublishBrewedPC" "$KFPublishScript" "$KFPublishPackages"
for Package in $PackageUpload for Package in $PackageUpload
@ -558,8 +555,6 @@ function upload ()
{ {
local PreparedWsDir="" local PreparedWsDir=""
msg "upload to steam workshop"
read_build_settings read_build_settings
if ! compiled ; then if ! compiled ; then
@ -585,7 +580,13 @@ EOF
cp -rf "$KFPublish" "$PreparedWsDir" cp -rf "$KFPublish" "$PreparedWsDir"
CMD //C "$(cygpath -w "$KFWorkshop") $(basename "$MutWsInfo")" msg "upload to steam workshop"
if is_true "$ArgQuiet"; then
CMD //C "$(cygpath -w "$KFWorkshop") $(basename "$MutWsInfo")" &>/dev/null
else
CMD //C "$(cygpath -w "$KFWorkshop") $(basename "$MutWsInfo")"
fi
msg "${GRN}successfully uploaded to steam workshop${DEF}"
rm -rf "$PreparedWsDir" rm -rf "$PreparedWsDir"
rm -f "$MutWsInfo" rm -f "$MutWsInfo"
@ -596,7 +597,7 @@ function init_test ()
local AviableMutators="" local AviableMutators=""
local AviableGamemodes="" local AviableGamemodes=""
msg "create new test config ($MutTestConfig)" msg "creating new test config"
read_build_settings read_build_settings
@ -623,8 +624,14 @@ function init_test ()
done < <(grep -rihPo '\s.+extends\sKFGameInfo_' "$MutSource/$Package" | awk '{ print $1 }') done < <(grep -rihPo '\s.+extends\sKFGameInfo_' "$MutSource/$Package" | awk '{ print $1 }')
done done
if [[ -n "$AviableMutators" ]]; then
msg "mutators found: $AviableMutators"
fi
if [[ -z "$AviableGamemodes" ]]; then if [[ -z "$AviableGamemodes" ]]; then
AviableGamemodes="KFGameContent.KFGameInfo_Survival" AviableGamemodes="KFGameContent.KFGameInfo_Survival"
else
msg "custom gamemodes found: $AviableGamemodes"
fi fi
cat > "$MutTestConfig" <<EOF cat > "$MutTestConfig" <<EOF
@ -660,18 +667,23 @@ Mutators="$AviableMutators"
# Additional parameters # Additional parameters
Args="" Args=""
EOF EOF
msg "${GRN}$(basename "$MutTestConfig") created${DEF}"
} }
function run_test () function run_test ()
{ {
local UseUnpublished="" local UseUnpublished=""
msg "run test..."
read_build_settings read_build_settings
read_test_settings read_test_settings
if ! brewed; then UseUnpublished="-useunpublished"; fi if ! brewed; then
UseUnpublished="-useunpublished"
msg "run test (unpublished)"
else
msg "run test (brewed)"
fi
CMD //C "$(cygpath -w "$KFGame") $Map?Difficulty=$Difficulty?GameLength=$GameLength?Game=$Game?Mutator=$Mutators?$Args $UseUnpublished" -log CMD //C "$(cygpath -w "$KFGame") $Map?Difficulty=$Difficulty?GameLength=$GameLength?Game=$Game?Mutator=$Mutators?$Args $UseUnpublished" -log
} }