autobuild fixes
[xonotic/xonotic.git] / misc / tools / xonotic-map-compiler-autobuild
1 #!/bin/sh
2
3 bspdir="$PWD/bspfiles"
4 mkdir -p "$bspdir"
5 cd data/xonotic-maps.pk3dir
6 git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
7         git reset --hard
8         git clean -xfd
9         git checkout "$HASH"
10         for F in maps/*.map.options; do
11                 if ! [ -f "$F" ]; then
12                         continue
13                 fi
14                 if ! [ -f "${F%.options}" ]; then
15                         continue
16                 fi
17                 M=${F#maps/}
18                 M=${M%.map.options}
19                 blobhash="$M"-`git ls-files -s -- "$F" | cut -d ' ' -f 2`-`git ls-files -s -- "${F%.options}" | cut -d ' ' -f 2`
20                 if [ -f "$bspdir/$blobhash.pk3" ]; then
21                         continue
22                 fi
23                 (
24                         cd maps
25                         ../../../misc/tools/xonotic-map-compiler "$M" -noshaderlist `head -n 1 "../$F"` 2>&1 | tee "$M.log"
26                 )
27                 zip -9r "$bspdir/$blobhash.pk3" "maps/$M.bsp" "maps/$M.log" "maps/$M/" "gfx/${M}_mini.tga"
28         done
29 done
30 git checkout master