1324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#!/bin/bash
2324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
3324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverANTLR_JOB=${1:-ANTLR_Tool}
4324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverST_VERSION=3.1
5324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverANTLR2_VERSION=2.7.7
6324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
7324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver# find the antlr.jar from the upstream project
8324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverJAR=$(ls $WORKSPACE/../../$ANTLR_JOB/lastSuccessful/org.antlr\$antlr/archive/org.antlr/antlr/*/antlr-*-jar-with-dependencies.jar)
9324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "antlr.jar=$JAR"
10324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
11324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverif [ ! -f "$JAR" ]; then
12324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    echo "Could not find antlr.jar"
13324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    exit 1
14324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverfi
15324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
16324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    
17324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "************************************************************************"
18324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "Setting up dependencies"
19324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho
20324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
21324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverrm -fr $WORKSPACE/tmp
22324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvermkdir -p $WORKSPACE/tmp
23324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvercd $WORKSPACE
24324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
25324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver# stringtemplate3
26324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverif [ ! -f stringtemplate3-$ST_VERSION.tar.gz ]; then
27324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    wget http://pypi.python.org/packages/source/s/stringtemplate3/stringtemplate3-$ST_VERSION.tar.gz
28324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverfi
29324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver(cd tmp; tar xzf ../stringtemplate3-$ST_VERSION.tar.gz)
30324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver(cd tmp/stringtemplate3-$ST_VERSION; python setup.py install --install-lib=$WORKSPACE)
31324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
32324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver# antlr2
33324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverif [ ! -f antlr-$ANTLR2_VERSION.tar.gz ]; then
34324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    wget http://www.antlr2.org/download/antlr-$ANTLR2_VERSION.tar.gz
35324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverfi
36324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver(cd tmp; tar xzf ../antlr-$ANTLR2_VERSION.tar.gz)
37324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver(cd tmp/antlr-$ANTLR2_VERSION/lib/python; python setup.py install --install-lib=$WORKSPACE)
38324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
39324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
40324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverexport CLASSPATH=$JAR
41324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
42324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "************************************************************************"
43324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "Running the testsuite"
44324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho
45324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
46324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvercd $WORKSPACE
47324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverrm -fr testout/
48324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvermkdir -p testout/
49324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverpython setup.py unittest --xml-output=testout/
50324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverpython setup.py functest --xml-output=testout/ --antlr-jar="$JAR"
51324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
52324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
53324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "************************************************************************"
54324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "Running pylint"
55324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho
56324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
57324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvercd $WORKSPACE
58324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverpylint --rcfile=pylintrc --output-format=parseable --include-ids=yes antlr3 | tee pylint-report.txt
59324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
60324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
61324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "************************************************************************"
62324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho "Building dist files"
63324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverecho
64324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
65324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvercd $WORKSPACE
66324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverrm -f dist/*
67324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvercp -f $JAR dist/
68324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverpython setup.py sdist --formats=gztar,zip
69324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverfor PYTHON in /usr/bin/python2.?; do
70324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    $PYTHON setup.py bdist_egg
71324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverdone
72