autobuild script ;)
[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 checkout "$HASH"
8         for F in maps/*.map.options; do
9                 if ! [ -f "$F" ]; then
10                         continue
11                 fi
12                 if ! [ -f "${F%.options}" ]; then
13                         continue
14                 fi
15                 M=${F#maps/}
16                 M=${M%.map.options}
17                 blobhash="$M"-`git ls-files -s -- "$F" | cut -d ' ' -f 2`-`git ls-files -s -- "${F%.options}" | cut -d ' ' -f 2`
18                 if [ -f "$bspdir/$blobhash.pk3" ]; then
19                         continue
20                 fi
21                 (
22                         cd maps
23                         ../../../misc/tools/xonotic-map-compiler "$M" -noshaderlist `head -n 1 "../$F"` 2>&1 | tee "$M.log"
24                 )
25                 zip -9r "$bspdir/$blobhash.pk3" "maps/$M.bsp" "maps/$M.log" "maps/$M/" "gfx/${M}_mini.tga"
26         done
27 done
28 git checkout master