forked from RuleWorld/rulebender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_build_BNGParser.sh
executable file
·121 lines (97 loc) · 4.48 KB
/
s_build_BNGParser.sh
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
set -e
# #########################################################################
# Build Script for BNGParser
# #########################################################################
echo ' '
echo ' '
echo ' '
echo ' This script should be called right after cloning the GitHub code.'
echo ' Building the parser before importing the code into Eclipse will'
echo ' ensure that Eclipse is using the right parser.'
echo ' '
/bin/rm -r -f BNGParser
git clone https://github.com/RuleWorld/BNGParser.git
cd BNGParser/src/bngparser/grammars
echo '-------------------------------------------------------------------'
echo ' Generate grammars'
echo '-------------------------------------------------------------------'
java -jar ../../antlr-3.3-complete.jar BNGLexer.g
java -jar ../../antlr-3.3-complete.jar BNGGrammar.g
echo '-------------------------------------------------------------------'
echo ' Compile grammars'
echo '-------------------------------------------------------------------'
cd ../..
for jfile in $(ls bngparser/grammars/*.java)
do
echo $jfile
javac -classpath bngparser/grammars:bngparser/methods:bngparser/models:bngparser/dataType:bngparser/exceptions:antlr-3.3-complete.jar:../commons-lang3-3.1.jar:. -sourcepath . $jfile
done
echo '-------------------------------------------------------------------'
echo ' Compiling methods '
echo '-------------------------------------------------------------------'
for jfile in $(ls bngparser/methods/*.java)
do
echo $jfile
javac -classpath bngparser/grammars:bngparser/methods:bngparser/models:bngparser/dataType:bngparser/exceptions:antlr-3.3-complete.jar:../commons-lang3-3.1.jar:. -sourcepath . $jfile
done
echo '-------------------------------------------------------------------'
echo ' Compiling dataType '
echo '-------------------------------------------------------------------'
for jfile in $(ls bngparser/dataType/*.java)
do
echo $jfile
javac -classpath bngparser/grammars:bngparser/methods:bngparser/models:bngparser/dataType:bngparser/exceptions:antlr-3.3-complete.jar:../commons-lang3-3.1.jar:. -sourcepath . $jfile
done
echo '-------------------------------------------------------------------'
echo ' Compiling exceptions '
echo '-------------------------------------------------------------------'
for jfile in $(ls bngparser/exceptions/*.java)
do
echo $jfile
javac -classpath bngparser/grammars:bngparser/methods:bngparser/models:bngparser/dataType:bngparser/exceptions:antlr-3.3-complete.jar:../commons-lang3-3.1.jar:. -sourcepath . $jfile
done
echo '-------------------------------------------------------------------'
echo ' Compiling bngparser '
echo '-------------------------------------------------------------------'
for jfile in $(ls bngparser/*.java)
do
if [ $jfile != 'bngparser/MCellTranslatorTester.java' ];
then
if [ $jfile != 'bngparser/Tester.java' ];
then
echo $jfile
javac -classpath bngparser/grammars:bngparser/methods:bngparser/models:bngparser/dataType:bngparser/exceptions:antlr-3.3-complete.jar:../commons-lang3-3.1.jar:. -sourcepath . $jfile
fi
fi
done
echo '-------------------------------------------------------------------'
echo ' Creating jar '
echo '-------------------------------------------------------------------'
cp ../xml.stg .
jar cf BNGParser.jar bngparser xml.stg
echo '-------------------------------------------------------------------'
echo ' Running a Test '
echo '-------------------------------------------------------------------'
cp ../commons-lang3-3.1.jar .
cat bngparser/Tester.java | sed 's/testModels/\.\.\/testModels/' > bngparser/Tester_new.java
mv bngparser/Tester.java bngparser/Tester.old.java
mv bngparser/Tester_new.java bngparser/Tester.java
javac -cp antlr-3.3-complete.jar:BNGParser.jar:commons-lang3-3.1.jar:. \
bngparser/Tester.java
java -cp antlr-3.3-complete.jar:BNGParser.jar:commons-lang3-3.1.jar:. \
bngparser/Tester
echo '-------------------------------------------------------------------'
echo ' Deploy BNGParser.jar '
echo '-------------------------------------------------------------------'
cd ../..
echo ' '
echo ' Moving lib/BNGParser.jar to archive/BNGParser.old.jar '
rm -f archive/BNGParser.old.jar
mv lib/BNGParser.jar archive/BNGParser.old.jar
echo ' Copying the newly built parser to lib/BNGParser.jar '
cp BNGParser/src/BNGParser.jar lib/BNGParser.jar
echo ' '
echo '-------------------------------------------------------------------'
echo ' Done '
echo '-------------------------------------------------------------------'