aboutsummaryrefslogtreecommitdiff
path: root/mvn-compile.sh
blob: 7d6fff2b9d054c5e19d1ddd21c8f6934d35e96f8 (plain)
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
#!/bin/sh

fn_build()
{
    t1=`date +%s`
    mvn compile test-compile -l $logfile
    # date -r $logfile +%s
    t2=`date +%s`
    total=`expr $t2 - $t1`
}

logfile=target/build.log

t0=`for file in $(find src -type f); do date -r "$file" +%s; done | sort -r | uniq | head -1`

if [ ! -f $logfile ]; then
    fn_build
fi

tb=`date -r $logfile +%s`

if [ $t0 -gt $tb ]; then
    fn_build
fi

cat $logfile | \
    grep -oE "^\[ERROR\].*\.java.*\]" | \
    sed -E 's/:\[(.*),.*/:\1/' | \
    sort | uniq

if [ ! -z $total ]; then
    echo "$total seconds"
fi