mirror of
https://bitbucket.org/seefoe/dockerized-swg-src.git
synced 2026-07-14 00:01:36 -04:00
Multithread Script Building
This commit is contained in:
Executable
+44
@@ -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 ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user