mirror of
https://bitbucket.org/swgmasters/swg-src.git
synced 2026-01-15 23:04:54 -05:00
Multithread Script Building
This commit is contained in:
@@ -106,12 +106,21 @@ if [[ $response =~ ^(yes|y| ) ]]; then
|
||||
oldPATH=$PATH
|
||||
PATH=$basedir/build/bin:$PATH
|
||||
|
||||
|
||||
$basedir/utils/mocha/prepare_all_scripts.sh $basedir/dsrc/sku.0/sys.server/compiled/game/script
|
||||
$basedir/utils/build_java.sh
|
||||
$basedir/utils/build_miff.sh
|
||||
$basedir/utils/build_tab.sh
|
||||
$basedir/utils/build_tpf.sh
|
||||
read -p "Do you wanna use multicore scripts or the safe option? (multi/safe) " response
|
||||
response=${response,,}
|
||||
if [[ $response =~ ^(multi|multithread| ) ]]; then
|
||||
$basedir/utils/mocha/prepare_all_scripts_multi.sh $basedir/dsrc/sku.0/sys.server/compiled/game/script
|
||||
$basedir/utils/build_java_multi.sh
|
||||
$basedir/utils/build_miff.sh
|
||||
$basedir/utils/build_tab_multi.sh
|
||||
$basedir/utils/build_tpf_multi.sh
|
||||
else
|
||||
$basedir/utils/mocha/prepare_all_scripts.sh $basedir/dsrc/sku.0/sys.server/compiled/game/script
|
||||
$basedir/utils/build_java.sh
|
||||
$basedir/utils/build_miff.sh
|
||||
$basedir/utils/build_tab.sh
|
||||
$basedir/utils/build_tpf.sh
|
||||
fi
|
||||
|
||||
$basedir/utils/build_object_template_crc_string_tables.py
|
||||
$basedir/utils/build_quest_crc_string_tables.py
|
||||
|
||||
44
utils/build_java_multi.sh
Executable file
44
utils/build_java_multi.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#/bin/bash
|
||||
|
||||
DIR="$( dirname "${BASH_SOURCE[0]}" )"
|
||||
|
||||
destination="data/sku.0/sys.server/compiled/game"
|
||||
sourcepath="dsrc/sku.0/sys.server/compiled/game"
|
||||
|
||||
mkdir -p $destination/script
|
||||
|
||||
filenames=$(find $sourcepath -name '*.java')
|
||||
spinstr='|/-\'
|
||||
i=0
|
||||
current=0
|
||||
total=$(ls ${filenames[@]} | wc -l)
|
||||
|
||||
compile () {
|
||||
OFILENAME=${filename/$sourcepath/$destination}
|
||||
OFILENAME=${OFILENAME/java/class}
|
||||
|
||||
if [[ -e $OFILENAME && $filename -nt $OFILENAME ]] || [ ! -e $OFILENAME ]; then
|
||||
result=$(${DIR}/build_java_single.sh $filename 2>&1)
|
||||
fi
|
||||
|
||||
if [[ ! -z $result ]]; then
|
||||
printf "\r$filename\n"
|
||||
printf "$result\n\n"
|
||||
fi
|
||||
}
|
||||
|
||||
for filename in $filenames; do
|
||||
current=$((current+1))
|
||||
i=$(( (i+1) %4 ))
|
||||
perc=$(bc -l <<< "scale=0; $current*100/$total")
|
||||
printf "\rCompiling java scripts : [${spinstr:$i:1}] $perc%%"
|
||||
while [ `jobs | wc -l` -ge 20 ]
|
||||
do
|
||||
sleep 5
|
||||
done
|
||||
compile $filename & done
|
||||
wait
|
||||
|
||||
echo ""
|
||||
|
||||
|
||||
42
utils/build_tab_multi.sh
Executable file
42
utils/build_tab_multi.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
server=$(find ./dsrc/sku.0/sys.server/compiled/game/datatables -name '*.tab')
|
||||
inc=$(find ./dsrc/sku.0/sys.shared/compiled/game/datatables/include -name '*.tab')
|
||||
shared=$(find ./dsrc/sku.0/sys.shared/compiled/game/datatables -name '*.tab')
|
||||
|
||||
filenames=("${server[@]}" "${inc[@]}" "${shared[@]}")
|
||||
|
||||
spinstr='|/-\'
|
||||
i=0
|
||||
current=0
|
||||
total=$(ls ${filenames[@]} | wc -l)
|
||||
|
||||
compile () {
|
||||
ofilename=${filename/dsrc/data}
|
||||
ofilename=${ofilename/.tab/.iff}
|
||||
mkdir -p $(dirname $ofilename)
|
||||
|
||||
[ -e $ofilename ] && rm "$ofilename"
|
||||
|
||||
result=$(./exe/linux/bin/DataTableTool -i "$filename" -- -s SharedFile searchPath10=data/sku.0/sys.shared/compiled/game searchPath10=data/sku.0/sys.server/compiled/game 2>&1)
|
||||
|
||||
if [[ ! $result =~ .*SUCCESS.* ]]; then
|
||||
printf "\r$filename\n"
|
||||
printf "$result\n\n"
|
||||
fi
|
||||
}
|
||||
|
||||
for filename in ${filenames[@]}; do
|
||||
current=$((current+1))
|
||||
i=$(( (i+1) %4 ))
|
||||
perc=$(bc -l <<< "scale=0; $current*100/$total")
|
||||
printf "\rGenerating Datatables: [${spinstr:$i:1}] $perc%%"
|
||||
while [ `jobs | wc -l` -ge 20 ]
|
||||
do
|
||||
sleep 5
|
||||
done
|
||||
compile $filename & done
|
||||
wait
|
||||
|
||||
echo ""
|
||||
|
||||
40
utils/build_tpf_multi.sh
Executable file
40
utils/build_tpf_multi.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
filenames=$(find ./dsrc -name '*.tpf')
|
||||
spinstr='|/-\'
|
||||
i=0
|
||||
current=0
|
||||
total=$(find ./dsrc -name '*.tpf' | wc -l)
|
||||
|
||||
compile () {
|
||||
ofilename=${filename/dsrc/data}
|
||||
ofilename=${ofilename/.tpf/.iff}
|
||||
mkdir -p $(dirname $ofilename)
|
||||
|
||||
if [[ -e $ofilename && $filename -nt $ofilename ]] || [ ! -e $ofilename ]; then
|
||||
result=$(./exe/linux/bin/TemplateCompiler -compile "$filename" 2>&1)
|
||||
|
||||
if [[ ! -z $result ]]; then
|
||||
printf "\r$filename\n"
|
||||
printf "$result\n\n"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
for filename in $filenames; do
|
||||
current=$((current+1))
|
||||
i=$(( (i+1) %4 ))
|
||||
perc=$(bc -l <<< "scale=0; $current*100/$total")
|
||||
printf "\rGenerating Object Templates: [${spinstr:$i:1}] $perc%%"
|
||||
# Comment this loop out if you have a real fast system.(12Cores+, Fast SSD Storage)
|
||||
while [ `jobs | wc -l` -ge 50 ]
|
||||
do
|
||||
sleep 5
|
||||
done
|
||||
compile $filename & done
|
||||
wait
|
||||
|
||||
echo ""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user