merge fixes, debug mode
This commit is contained in:
parent
48b3a87401
commit
abce563023
120
builder
120
builder
@ -4,7 +4,6 @@
|
|||||||
# https://git-scm.com/download/win
|
# https://git-scm.com/download/win
|
||||||
|
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
# set -o xtrace
|
|
||||||
|
|
||||||
trap cleanup SIGINT SIGTERM ERR EXIT
|
trap cleanup SIGINT SIGTERM ERR EXIT
|
||||||
|
|
||||||
@ -174,35 +173,46 @@ function read_test_settings ()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function merge_packages () # $1: Mutator name
|
function merge_package () # $1: What, $2: Where
|
||||||
{
|
{
|
||||||
local ModificationTime=""
|
local ModificationTime=""
|
||||||
local UpkList=""
|
local ModificationTimeNew=""
|
||||||
local PID=""
|
local PID=""
|
||||||
|
|
||||||
|
ModificationTime=$(stat -c %y "$KFWin64/$2")
|
||||||
|
CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorMergePackages") make $1 $2" &
|
||||||
|
PID="$!"
|
||||||
|
while ps -p "$PID" &> /dev/null
|
||||||
|
do
|
||||||
|
ModificationTimeNew="$(stat -c %y "$KFWin64/$2")"
|
||||||
|
if [[ "$ModificationTime" != "$ModificationTimeNew" ]]; then # wait for write
|
||||||
|
while ps -p "$PID" &> /dev/null
|
||||||
|
do
|
||||||
|
ModificationTime="$ModificationTimeNew"
|
||||||
|
sleep 1
|
||||||
|
ModificationTimeNew="$(stat -c %y "$KFWin64/$2")"
|
||||||
|
if [[ "$ModificationTime" == "$ModificationTimeNew" ]]; then # wait for write finish
|
||||||
|
kill "$PID"
|
||||||
|
rm -f "$KFWin64/$1" # cleanup (auto)
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f "$KFWin64/$1" # cleanup (manual)
|
||||||
|
}
|
||||||
|
|
||||||
|
function merge_packages () # $1: Mutator name
|
||||||
|
{
|
||||||
cp -f "$KFUnpublishScript/$1.u" "$KFWin64"
|
cp -f "$KFUnpublishScript/$1.u" "$KFWin64"
|
||||||
|
|
||||||
while read -r Upk
|
while read -r Upk
|
||||||
do
|
do
|
||||||
cp -f "$MutSource/$1/$Upk" "$KFWin64"
|
cp -f "$MutSource/$1/$Upk" "$KFWin64"
|
||||||
UpkList="$UpkList $Upk"
|
merge_package "$Upk" "$1.u"
|
||||||
done < <(find "$MutSource/$1" -type f -name '*.upk' -printf "%f\n")
|
done < <(find "$MutSource/$1" -type f -name '*.upk' -printf "%f\n")
|
||||||
|
|
||||||
if [[ -n "$UpkList" ]]; then
|
|
||||||
ModificationTime=$(stat -c %y "$KFWin64/$1.u")
|
|
||||||
CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorMergePackages") make $UpkList $1.u" &
|
|
||||||
PID="$!"
|
|
||||||
while ps -p "$PID" &> /dev/null
|
|
||||||
do
|
|
||||||
if [[ "$ModificationTime" != "$(stat -c %y "$KFWin64/$1.u")" ]]; then # file changed
|
|
||||||
sleep 2 # wait a bit in case the file hasn't been written to the end yet
|
|
||||||
kill "$PID"; break
|
|
||||||
fi
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
for Upk in $UpkList; do rm -f "$KFWin64/$Upk"; done # cleanup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function compiled ()
|
function compiled ()
|
||||||
@ -261,7 +271,7 @@ function compile ()
|
|||||||
while ps -p "$PID" &> /dev/null
|
while ps -p "$PID" &> /dev/null
|
||||||
do
|
do
|
||||||
if compiled; then kill "$PID"; break; fi
|
if compiled; then kill "$PID"; break; fi
|
||||||
sleep 2
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
restore_kfeditorconf
|
restore_kfeditorconf
|
||||||
@ -310,7 +320,7 @@ function brew ()
|
|||||||
while ps -p "$PID" &> /dev/null
|
while ps -p "$PID" &> /dev/null
|
||||||
do
|
do
|
||||||
if brewed; then kill "$PID"; break; fi
|
if brewed; then kill "$PID"; break; fi
|
||||||
sleep 2
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
publish_common
|
publish_common
|
||||||
@ -329,18 +339,18 @@ function brew_manual ()
|
|||||||
|
|
||||||
rm -rf "$KFPublish"
|
rm -rf "$KFPublish"
|
||||||
|
|
||||||
mkdir -p "$KFPublishBrewedPC" "$KFPublishScript"
|
mkdir -p "$KFPublishBrewedPC"
|
||||||
|
|
||||||
if ! [[ -x "$KFEditorPatcher" ]]; then
|
if ! [[ -x "$KFEditorPatcher" ]]; then
|
||||||
get_latest_kfeditor_patcher "$KFEditorPatcher"
|
get_latest_kfeditor_patcher "$KFEditorPatcher"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd "$KFWin64" && "$KFEditorPatcher"; popd
|
CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorPatcher")"
|
||||||
|
|
||||||
for Package in $PackageUpload
|
for Package in $PackageUpload
|
||||||
do
|
do
|
||||||
merge_packages "$Package"
|
merge_packages "$Package"
|
||||||
mv "$KFWin64/$Package.u" "$KFPublishScript"
|
mv "$KFWin64/$Package.u" "$KFPublishBrewedPC"
|
||||||
done
|
done
|
||||||
|
|
||||||
publish_common
|
publish_common
|
||||||
@ -473,30 +483,54 @@ function run_test ()
|
|||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function debug ()
|
||||||
|
{
|
||||||
|
set -o xtrace
|
||||||
|
}
|
||||||
|
|
||||||
export PATH="$PATH:$ThirdPartyBin"
|
export PATH="$PATH:$ThirdPartyBin"
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then show_help; exit 0; fi
|
if [[ $# -eq 0 ]]; then show_help; exit 0; fi
|
||||||
case $1 in
|
case $1 in
|
||||||
# Options
|
# Options
|
||||||
-h|--help ) show_help ;;
|
-h|--help ) show_help ;;
|
||||||
-v|--version ) show_version ;;
|
-v|--version ) show_version ;;
|
||||||
-ib|--init-build ) init_build ;;
|
-ib|--init-build ) init_build ;;
|
||||||
-it|--init-test ) init_test ;;
|
-it|--init-test ) init_test ;;
|
||||||
-i|--init ) init_build; init_test ;;
|
-i|--init ) init_build; init_test ;;
|
||||||
-c|--compile ) compile ;;
|
-c|--compile ) compile ;;
|
||||||
-b|--brew ) brew ;;
|
-b|--brew ) brew ;;
|
||||||
-bm|--brew-manual ) brew_manual ;;
|
-bm|--brew-manual ) brew_manual ;;
|
||||||
-u|--upload ) upload ;;
|
-u|--upload ) upload ;;
|
||||||
-t|--test ) run_test ;;
|
-t|--test ) run_test ;;
|
||||||
# Shortcuts
|
# Shortcuts
|
||||||
-cb ) compile; brew ;;
|
-cb ) compile; brew ;;
|
||||||
-cu ) compile; upload ;;
|
-cu ) compile; upload ;;
|
||||||
-cbm ) compile; brew_manual ;;
|
-cbm ) compile; brew_manual ;;
|
||||||
-cbu ) compile; brew; upload ;;
|
-cbu ) compile; brew; upload ;;
|
||||||
-cbmu ) compile; brew_manual; upload ;;
|
-cbmu ) compile; brew_manual; upload ;;
|
||||||
-ct ) compile; run_test ;;
|
-ct ) compile; run_test ;;
|
||||||
-cbt ) compile; brew; run_test ;;
|
-cbt ) compile; brew; run_test ;;
|
||||||
-cbmt ) compile; brew_manual; run_test ;;
|
-cbmt ) compile; brew_manual; run_test ;;
|
||||||
|
# Debug
|
||||||
|
-dh ) debug; show_help ;;
|
||||||
|
-dv ) debug; show_version ;;
|
||||||
|
-dib ) debug; init_build ;;
|
||||||
|
-dit ) debug; init_test ;;
|
||||||
|
-di ) debug; init_build; init_test ;;
|
||||||
|
-dc ) debug; compile ;;
|
||||||
|
-db ) debug; brew ;;
|
||||||
|
-dbm ) debug; brew_manual ;;
|
||||||
|
-du ) debug; upload ;;
|
||||||
|
-dt ) debug; run_test ;;
|
||||||
|
-dcb ) debug; compile; brew ;;
|
||||||
|
-dcu ) debug; compile; upload ;;
|
||||||
|
-dcbm ) debug; compile; brew_manual ;;
|
||||||
|
-dcbu ) debug; compile; brew; upload ;;
|
||||||
|
-dcbmu ) debug; compile; brew_manual; upload ;;
|
||||||
|
-dct ) debug; compile; run_test ;;
|
||||||
|
-dcbt ) debug; compile; brew; run_test ;;
|
||||||
|
-dcbmt ) debug; compile; brew_manual; run_test ;;
|
||||||
# Other
|
# Other
|
||||||
* ) echo "Command not recognized: $1"; exit 1 ;;
|
* ) echo "Command not recognized: $1"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user