This repository was archived by the owner on Nov 12, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathauto-marker.sh
More file actions
executable file
·96 lines (78 loc) · 2.85 KB
/
auto-marker.sh
File metadata and controls
executable file
·96 lines (78 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -e
base_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
function usage {
echo "$0 <exercise-name> \"<tutee>+\""
}
exercise=$1
if [ "x${exercise}" = "x" ]; then
usage
exit 1
fi
tutees=$2
if [ "x$2" = "x" ]; then
usage
exit 1
fi
## get_repo PictureProcessing dd1711
function get_repo {
if [ -d $1/$2 ]; then
wd=$(pwd)
cd $1/$2 && git pull --all && OK=true || OK=false
cd ${wd}
${OK}
else
git clone -q "doc:/vol/lab/firstyear/Repositories/2011-2012/161/$2/$1.git" $1/$2 || \
git clone -q "doc:/vol/lab/firstyear/Repositories/2011-2012/161/$2/$1" $1/$2
fi
}
echo "Getting repos..."
mkdir -p ${exercise}
for tutee in ${tutees} Masters; do
echo " * Getting repo for ${tutee}"
get_repo ${exercise} ${tutee}
done
skelhash=$(git --git-dir ${exercise}/Masters/.git log --format=%h | tail -n1)
echo "Comparing with skeleton solution (${skelhash})"
for tutee in ${tutees}; do
echo " * Repo for ${tutee}"
changedFiles=$(git --git-dir ${exercise}/${tutee}/.git diff --raw --stat ${skelhash}..HEAD | grep ':' | cut -d' ' -f2 | grep -v '.metadata' | grep '.java')
rm -f ${exercise}/${tutee}.changedfiles
changedFilesAbs=""
for f in ${changedFiles}; do
if [ ! -f "${exercise}/${tutee}/$f" ]; then
echo "Skipping ${f}"
continue
fi
# ignore files in the support subdir
if echo ${f} | grep "support/"; then
true
else
echo "$f" >> ${exercise}/${tutee}.changedfiles
changedFilesAbs="${changedFilesAbs} ${exercise}/${tutee}/${f}"
fi
done
enscript -b "${tutee} - Code - ${exercise}" -o ${exercise}/${tutee}-code.ps --color -Ejava -G -f Courier8 -2r -C ${changedFilesAbs}
done
echo "Building submissions"
for tutee in ${tutees}; do
echo " * Building for ${tutee}"
wd=$(pwd)
cd "${exercise}/${tutee}"
ln -sf "${base_dir}/build.xml" .
{ ant || echo -e "\nBUILD FAILED\n" ;} > ../${tutee}-build.txt
cd ${wd}
enscript -b "${tutee} - Build - ${exercise}" -o ${exercise}/${tutee}-build.ps -G -f Courier8 ${exercise}/${tutee}-build.txt
done
echo "Generating printable checkstyle reports"
for tutee in ${tutees}; do
echo " * Checking for ${tutee}"
checkstyle -c "${base_dir}/almost_sun_checks.xml" $(find "${exercise}/${tutee}" -name '*.java') > ${exercise}/${tutee}.checkstyle || true
grep -f ${exercise}/${tutee}.changedfiles ${exercise}/${tutee}.checkstyle > ${exercise}/${tutee}.checkstyle2
enscript -b "${tutee} - Style - ${exercise}" -o ${exercise}/${tutee}-style.ps -G -f Courier8 ${exercise}/${tutee}.checkstyle2
done
echo "Combining reports"
for tutee in ${tutees}; do
echo " * Combining ${tutee}'s reports"
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=${exercise}/${tutee}-combined.pdf ${exercise}/${tutee}-*.ps
done