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