1#!/bin/bash
2
3ANTLR_JOB=${1:-ANTLR_Tool}
4ST_VERSION=3.1
5ANTLR2_VERSION=2.7.7
6
7# find the antlr.jar from the upstream project
8JAR=$(ls $WORKSPACE/../../$ANTLR_JOB/lastSuccessful/org.antlr\$antlr/archive/org.antlr/antlr/*/antlr-*-jar-with-dependencies.jar)
9echo "antlr.jar=$JAR"
10
11if [ ! -f "$JAR" ]; then
12    echo "Could not find antlr.jar"
13    exit 1
14fi
15
16
17echo "************************************************************************"
18echo "Setting up dependencies"
19echo
20
21rm -fr $WORKSPACE/tmp
22mkdir -p $WORKSPACE/tmp
23cd $WORKSPACE
24
25# stringtemplate3
26if [ ! -f stringtemplate3-$ST_VERSION.tar.gz ]; then
27    wget http://pypi.python.org/packages/source/s/stringtemplate3/stringtemplate3-$ST_VERSION.tar.gz
28fi
29(cd tmp; tar xzf ../stringtemplate3-$ST_VERSION.tar.gz)
30(cd tmp/stringtemplate3-$ST_VERSION; python setup.py install --install-lib=$WORKSPACE)
31
32# antlr2
33if [ ! -f antlr-$ANTLR2_VERSION.tar.gz ]; then
34    wget http://www.antlr2.org/download/antlr-$ANTLR2_VERSION.tar.gz
35fi
36(cd tmp; tar xzf ../antlr-$ANTLR2_VERSION.tar.gz)
37(cd tmp/antlr-$ANTLR2_VERSION/lib/python; python setup.py install --install-lib=$WORKSPACE)
38
39
40export CLASSPATH=$JAR
41
42echo "************************************************************************"
43echo "Running the testsuite"
44echo
45
46cd $WORKSPACE
47rm -fr testout/
48mkdir -p testout/
49python setup.py unittest --xml-output=testout/
50python setup.py functest --xml-output=testout/ --antlr-jar="$JAR"
51
52
53echo "************************************************************************"
54echo "Running pylint"
55echo
56
57cd $WORKSPACE
58pylint --rcfile=pylintrc --output-format=parseable --include-ids=yes antlr3 | tee pylint-report.txt
59
60
61echo "************************************************************************"
62echo "Building dist files"
63echo
64
65cd $WORKSPACE
66rm -f dist/*
67cp -f $JAR dist/
68python setup.py sdist --formats=gztar,zip
69for PYTHON in /usr/bin/python2.?; do
70    $PYTHON setup.py bdist_egg
71done
72