forked from javacc21/javacc21
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
executable file
·227 lines (209 loc) · 8.12 KB
/
build.xml
File metadata and controls
executable file
·227 lines (209 loc) · 8.12 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<project name="javacc21" default="compile" basedir=".">
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<target name="init">
<echo>Join the Discussion forum at: https://discuss.congocc.org/</echo>
<echo>Send any bug report to bugs@javacc.com and include the following information.</echo>
<echo>JDK Version: ${java.version} on ${os.name}</echo>
<uptodate property="parser.uptodate"
targetfile="src/java/com/javacc/parser/JavaCCParser.java">
<srcfiles dir="src/javacc" includes="*.javacc"/>
</uptodate>
<uptodate property="preprocessor.uptodate"
targetfile="src/java/com/javacc/preprocessor/PreprocessorParser.java"
srcfile="examples/preprocessor/Preprocessor.javacc"
/>
</target>
<target name="restore-bootstrap-jar">
<exec executable="git" dir="${basedir}">
<arg line="checkout bin/javacc.jar"/>
</exec>
</target>
<!--
Build and test using the bootstrap jarfile, then
drop in the newly built jarfile and build and test again
-->
<target name="full-test" depends="restore-bootstrap-jar,clean,jar,test">
<echo>Now we copy the new javacc.jar to bin to rebootstrap</echo>
<copy file="javacc.jar" todir="bin"/>
<antcall target="clean"/>
<antcall target="test"/>
</target>
<target name="clean">
<delete file="javacc.jar"/>
<delete file="javacc-full.jar"/>
<delete dir="build"/>
<delete dir="src/java/com/javacc/parser"/>
<delete dir="src/java/com/javacc/preprocessor"/>
<delete dir="examples/csharp/org"/>
<delete dir="examples/java/org"/>
<delete dir="examples/freemarker/fel"/>
<delete dir="examples/freemarker/ftl"/>
<delete dir="examples/json/org"/>
<delete dir="examples/preprocessor/org/"/>
<delete dir="examples/python/org/"/>
<delete dir="examples/legacy/test.tmp"/>
</target>
<target name="parser-gen" depends="init" unless="parser.uptodate">
<echo>Using Bootstrap JavaCC to regenerate JavaCC parser</echo>
<java jar="bin/javacc.jar" fork="true" failonerror="true">
<assertions><enable/></assertions>
<arg line="-n -q -d ../java src/javacc/JavaCC.javacc"/>
</java>
</target>
<target name="preprocessor-gen" depends="init" unless="preprocessor.uptodate">
<echo>Using Bootstrap JavaCC to regenerate preprocessor</echo>
<java jar="bin/javacc.jar" fork="true" failonerror="true">
<assertions><enable/></assertions>
<arg line="-n -q -d ../../src/java examples/preprocessor/Preprocessor.javacc"/>
</java>
</target>
<target name="compile" depends="parser-gen, preprocessor-gen">
<mkdir dir="build"/>
<javac srcdir="src/java"
destdir="build"
deprecation="off"
debug="on"
optimize="off"
classpath="bin/freemarker.jar"
includeantruntime="no"
failonerror="true"
fork="true"
target="1.8" source="1.8"
/>
<copy todir="build/templates/java">
<fileset dir="src/ftl/java">
<include name="*.ftl"/>
</fileset>
</copy>
<copy todir="build/templates/python">
<fileset dir="src/ftl/python">
<include name="*.ftl"/>
</fileset>
</copy>
<copy todir="build/templates/csharp">
<fileset dir="src/ftl/csharp">
<include name="*.ftl"/>
</fileset>
</copy>
<copy todir="build/include/java">
<fileset dir="examples/java">
<include name="*.javacc"/>
</fileset>
</copy>
<copy todir="build/include/python">
<fileset dir="examples/python">
<include name="*.javacc"/>
</fileset>
</copy>
<copy todir="build/include/csharp">
<fileset dir="examples/csharp">
<include name="*.javacc"/>
</fileset>
</copy>
<copy todir="build/include/json">
<fileset dir="examples/json">
<include name="*.javacc"/>
</fileset>
</copy>
<copy todir="build/include/preprocessor">
<fileset dir="examples/preprocessor">
<include name="*.javacc"/>
</fileset>
</copy>
<copy todir="build/include/json">
<fileset dir="examples/json">
<include name="*.javacc"/>
</fileset>
</copy>
<copy todir="build">
<fileset dir="src/ftl">
<include name="*.properties"/>
</fileset>
</copy>
</target>
<target name='docs'>
<ant antfile="build.xml" dir="src/docs" target="docs" />
</target>
<target name="test" depends="jar">
<echo>Testing the JSON Parser</echo>
<ant antfile="build.xml" dir="examples/json" target="clean"/>
<ant antfile="build.xml" dir="examples/json" target="test"/>
<echo>Testing the Preprocessor</echo>
<ant antfile="build.xml" dir="examples/preprocessor" target="clean"/>
<ant antfile="build.xml" dir="examples/preprocessor" target="test"/>
<echo>Testing the CSharp parser standalone</echo>
<ant antfile="build.xml" dir="examples/csharp" target="clean"/>
<ant antfile="build.xml" dir="examples/csharp" target="test"/>
<echo>Testing the Java parser standalone</echo>
<ant antfile="build.xml" dir="examples/java" target="clean"/>
<ant antfile="build.xml" dir="examples/java" target="test"/>
<echo>Building the Python parser</echo>
<ant antfile="build.xml" dir="examples/python" target="clean"/>
<ant antfile="build.xml" dir="examples/python" target="test"/>
<echo>Testing the newer FreeMarker parser</echo>
<ant antfile="build.xml" dir="examples/freemarker" target="clean"/>
<ant antfile="build.xml" dir="examples/freemarker" target="test"/>
<echo>Running through the crufty old legacy examples</echo>
<ant antfile="build.xml" dir="examples/legacy" target="test" />
</target>
<target name="test-java" depends="jar">
<echo>Testing the Java parser standalone</echo>
<ant antfile="build.xml" dir="examples/java" target="clean"/>
<ant antfile="build.xml" dir="examples/java" target="test"/>
</target>
<target name="jar" depends="compile">
<echo>Creating basic jarfile, using this requires a freemarker.jar in the same directory</echo>
<jar jarfile="javacc.jar" basedir="build" compress="true">
<manifest>
<attribute name="Main-Class" value="com.javacc.Main"/>
<attribute name="Class-Path" value="freemarker.jar bin/freemarker.jar"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Build-Date" value="${timestamp}"/>
</manifest>
</jar>
<!--chmod file="javacc.jar" perm="+x"/-->
</target>
<target name="full-jar" depends="compile">
<echo>Creating the "uber-jar" with all dependencies, i.e. the FreeMarker classes</echo>
<jar jarfile="javacc-full.jar" compress="true">
<fileset dir="build"/>
<zipfileset includes="**/*.class" src="bin/freemarker.jar"/>
<manifest>
<attribute name="Main-Class" value="com.javacc.Main"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Build-Date" value="${timestamp}"/>
</manifest>
</jar>
<chmod file="javacc-full.jar" perm="+x"/>
</target>
<target name="update-bootstrap">
<!--
Update the bootstrap javacc.jar using the current javacc.jar built from the current
source. To cater for template changes, the process needs to be repeated once to
ensure that the templates are up to date, and again to ensure that any generated
code is using the updated templates.
-->
<echo>Ensuring templates are up to date in the bootstrap jar ...</echo>
<antcall target="clean"></antcall>
<antcall target="jar"></antcall>
<echo>Copying current jar to bootstrap location ...</echo>
<copy file="javacc.jar" todir="bin"/>
<echo>Ensuring any generated code is up to date in the bootstrap jar ...</echo>
<antcall target="clean"></antcall>
<antcall target="jar"></antcall>
<echo>Copying current jar to bootstrap location ...</echo>
<copy file="javacc.jar" todir="bin"/>
</target>
<target name="test-python" depends="jar">
<exec executable="python3" dir="${basedir}" failonerror="true">
<arg line="-u python_tests.py"/>
</exec>
</target>
<target name="test-csharp" depends="jar">
<exec executable="python3" dir="${basedir}" failonerror="true">
<arg line="-u csharp_tests.py"/>
</exec>
</target>
</project>