-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.generated.xml
361 lines (326 loc) · 17.2 KB
/
build.generated.xml
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?xml version="1.0" encoding="UTF-8" ?>
<project name="build.generated">
<target name="spoofaximp.default" depends="utils-files,sdf2table,ppgen,pppack,stratego.aster,stratego.ctree,sdf2imp,refresh"/>
<!-- Initialization -->
<available file="${trans}/${strmodule}.str" property="build.stratego.enabled"/>
<dirname property="externaldefdir" file="${externaldef}"/>
<condition property="externaldefimport" value="-I ${externaldefdir}" else="">
<isset property="externaldef"/>
</condition>
<condition property="externaljarimport" value=":${externaljar}" else="">
<isset property="externaljar"/>
</condition>
<condition property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter">
<isset property="eclipse.running"/>
</condition>
<condition property="externaljarflags" value="${externaljarflags}" else="">
<isset property="externaljarflags"/>
</condition>
<mkdir dir="${build}"/>
<mkdir dir="${src-gen}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${include}"/>
<mkdir dir="${lib}"/>
<mkdir dir="${syntax}"/>
<target name="sdf2imp" depends="sdf2table,sdf2imp.eclipse,sdf2imp.standalone"/>
<target name="sdf2imp.eclipse" if="eclipse.running" depends="sdf2rtg">
<java classname="org.strategoxt.imp.metatooling.building.AntDescriptorBuilder">
<arg value="${include}/${esvmodule}.packed.esv"/>
</java>
</target>
<target name="refresh" if="eclipse.running">
<eclipse.convertPath fileSystemPath="${basedir}" property="projectdir"/>
<eclipse.refreshLocal resource="${projectdir}/include" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/syntax/${sdfmodule}.pp.generated" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/lib/editor-common.generated.str" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/build.generated.xml" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-Builders.generated.esv" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-Colorer.generated.esv" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-Completions.generated.esv" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-Folding.generated.esv" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-References.generated.esv" depth="infinite"/>
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-Syntax.generated.esv" depth="infinite"/>
</target>
<target name="sdf2imp.standalone" unless="eclipse.running" depends="sdf2rtg">
<java classname="org.strategoxt.imp.generator.sdf2imp" failonerror="true">
<arg value="-i"/>
<arg value="${basedir}/editor/${esvmodule}.main.esv"/>
<arg value="-p"/>
<arg value="${include}/${sdfmodule}.tbl"/>
</java>
</target>
<target name="sdf2table" depends="make-permissive">
<apply executable="${build.strategoxt.sdf}sdf2table" dest="${include}" failonerror="true">
<arg value="-i"/>
<srcfile/>
<arg value="-o"/>
<targetfile/>
<arg value="-m"/>
<arg value="${sdfmodule}"/>
<fileset file="${include}/${sdfmodule}-Permissive.def"/>
<mapper type="glob" from="*-Permissive.def" to="*.tbl"/>
</apply>
</target>
<target name="make-permissive" depends="pack-sdf,copy-sdf">
<dependset>
<srcfileset file="${include}/${sdfmodule}.def"/>
<targetfileset file="${include}/${sdfmodule}-Permissive.def"/>
</dependset>
<available file="${include}/${sdfmodule}-Permissive.def" property="permissive-grammar.available"/>
<antcall target="make-permissive.helper"/>
</target>
<target name="make-permissive.helper" unless="permissive-grammar.available">
<java classname="org.strategoxt.permissivegrammars.make_permissive" failonerror="true">
<arg value="-i"/>
<arg value="${include}/${sdfmodule}.def"/>
<arg value="-o"/>
<arg value="${include}/${sdfmodule}-Permissive.def"/>
<arg line="--optimize on"/>
</java>
</target>
<target name="utils-files">
<mkdir dir="utils"/>
<copy file="${eclipse.spoofaximp.jars}/make_permissive.jar" todir="utils" failonerror="false"/>
<copy file="${eclipse.spoofaximp.jars}/sdf2imp.jar" todir="utils" failonerror="false"/>
<copy file="${eclipse.spoofaximp.jars}/aster.jar" todir="utils" failonerror="false"/>
<copy file="${eclipse.spoofaximp.strategojar}" todir="utils" failonerror="false"/>
</target>
<target name="pack-sdf" unless="externaldef">
<dependset>
<srcfileset dir="${syntax}">
<include name="**/*.sdf"/>
</srcfileset>
<targetfileset file="${include}/${sdfmodule}.def"/>
</dependset>
<available file="${include}/${sdfmodule}.def" property="pack-sdf.available"/>
<antcall target="pack-sdf.helper"/>
</target>
<target name="pack-sdf.helper" unless="pack-sdf.available">
<java classname="run" failonerror="true">
<arg value="org.strategoxt.tools.main-pack-sdf"/>
<arg value="-i"/>
<arg value="${syntax}/${sdfmodule}.sdf"/>
<arg value="-o"/>
<arg value="${include}/${sdfmodule}.def"/>
<arg value="-I"/>
<arg value="${syntax}"/>
<arg value="-I"/>
<arg value="${lib}"/>
<arg line="${build.sdf.imports}"/>
</java>
</target>
<target name="copy-sdf" if="externaldef">
<copy file="${externaldef}" tofile="${include}/${sdfmodule}.def" preservelastmodified="true"/>
</target>
<target name="copy-jar" if="externaljar">
<copy file="${externaljar}" todir="${include}" preservelastmodified="true"/>
</target>
<target name="rtg2sig" if="build.stratego.enabled" depends="sdf2rtg">
<dependset>
<srcfileset file="${include}/${sdfmodule}.rtg"/>
<targetfileset file="${include}/${sdfmodule}.str"/>
</dependset>
<available file="${include}/${sdfmodule}.str" property="rtg2sig.available"/>
<antcall target="rtg2sig.helper"/>
</target>
<target name="rtg2sig.helper" unless="rtg2sig.available">
<java classname="run" failonerror="true">
<arg value="org.strategoxt.tools.main-rtg2sig"/>
<arg value="-i"/>
<arg value="${include}/${sdfmodule}.rtg"/>
<arg value="-o"/>
<arg value="${include}/${sdfmodule}.str"/>
<arg value="--module"/>
<arg value="${sdfmodule}"/>
</java>
</target>
<target name="sdf2rtg" depends="pack-sdf,copy-sdf">
<dependset>
<srcfileset file="${include}/${sdfmodule}.def"/>
<targetfileset file="${include}/${sdfmodule}.rtg"/>
</dependset>
<available file="${include}/${sdfmodule}.rtg" property="sdf2rtg.available"/>
<antcall target="sdf2rtg.helper"/>
</target>
<target name="sdf2rtg.helper" unless="sdf2rtg.available">
<java classname="run" failonerror="true">
<arg value="org.strategoxt.tools.main-sdf2rtg"/>
<arg value="-i"/>
<arg value="${include}/${sdfmodule}.def"/>
<arg value="-m"/>
<arg value="${sdfmodule}"/>
<arg value="-o"/>
<arg value="${include}/${sdfmodule}.rtg"/>
<arg value="--ignore-missing-cons"/>
<arg value="-Xnativepath"/>
<arg value="${build.strategoxt.sdf}"/>
</java>
</target>
<target name="ppgen" if="build.stratego.enabled" depends="pack-sdf">
<dependset>
<srcfileset file="${include}/${sdfmodule}.def"/>
<targetfileset file="${syntax}/${sdfmodule}.generated.pp"/>
<targetfileset file="${include}/${sdfmodule}.generated.pp.af"/>
</dependset>
<available file="${include}/${sdfmodule}.generated.pp.af" property="ppgen.available"/>
<antcall target="ppgen.helper"/>
<available file="${include}/${sdfmodule}.generated.pp.af" property="ppgen.available"/>
<antcall target="ppgen.helper.fallback"/>
</target>
<target name="ppgen.helper" unless="ppgen.available">
<!-- Any failures here are ignored; they are only a problem when imported from Stratego -->
<java classname="run" failonerror="false">
<arg value="org.strategoxt.tools.main-ppgen"/>
<arg value="-i"/>
<arg value="${include}/${sdfmodule}.def"/>
<arg value="-o"/>
<arg value="${include}/${sdfmodule}.generated.pp.af"/>
<arg value="-t"/>
</java>
<java classname="run" failonerror="false">
<arg value="org.strategoxt.tools.main-pp-pp-table"/>
<arg value="-i"/>
<arg value="${include}/${sdfmodule}.generated.pp.af"/>
<arg value="-o"/>
<arg value="${syntax}/${sdfmodule}.generated.pp"/>
</java>
</target>
<target name="ppgen.helper.fallback" unless="ppgen.available">
<echo file="${include}/${sdfmodule}.generated.pp.af" message="PP-Table([])"/>
</target>
<target name="pppack" if="build.stratego.enabled" depends="pack-sdf">
<dependset>
<srcfileset file="${syntax}/${sdfmodule}.pp"/>
<targetfileset file="${include}/${sdfmodule}.pp.af"/>
</dependset>
<available file="${syntax}/${sdfmodule}.pp" property="pppack.source-available"/>
<available file="${include}/${sdfmodule}.pp.af" property="pppack.available"/>
<antcall target="pppack.helper"/>
<available file="${include}/${sdfmodule}.pp.af" property="pppack.available"/>
<antcall target="pppack.helper.fallback"/>
</target>
<target name="pppack.helper" unless="pppack.available" if="pppack.source-available">
<java classname="run" failonerror="true">
<arg value="org.strategoxt.tools.main-parse-pp-table"/>
<arg value="-i"/>
<arg value="${syntax}/${sdfmodule}.pp"/>
<arg value="-o"/>
<arg value="${include}/${sdfmodule}.pp.af"/>
</java>
</target>
<target name="pppack.helper.fallback" unless="pppack.available">
<echo file="${include}/${sdfmodule}.pp.af" message="PP-Table([])"/>
</target>
<!-- Aster to Stratego -->
<target name="stratego.aster">
<available file="${trans}/${strmodule}.rtree" property="aster-output.available"/>
<dependset>
<srcfileset dir="${basedir}">
<include name="**/*.astr"/>
</srcfileset>
<targetfileset file="${trans}/${strmodule}.rtree"/>
</dependset>
<condition property="aster-output.uptodate">
<and>
<isset property="aster-output.available"/>
<available file="${trans}/${strmodule}.rtree"/>
</and>
</condition>
<available file="${trans}/${strmodule}.rtree" property="aster-output.uptodate"/>
<antcall target="stratego.aster.helper"/>
</target>
<target name="stratego.aster.helper" unless="aster-output.uptodate">
<apply executable="java" failonerror="true">
<arg line="-Xss8m -Xmx768m -client -jar utils/aster.jar"/>
<arg value="-i"/>
<fileset dir="${basedir}">
<include name="**/*.astr"/>
</fileset>
</apply>
</target>
<!-- Stratego to Java interpreter -->
<target name="stratego.ctree" depends="rtg2sig">
<dependset>
<srcfileset dir="${basedir}">
<include name="**/*.str"/>
<include name="**/*.astr"/>
<exclude name="lib/editor-common.generated.str"/>
</srcfileset>
<targetfileset file="${include}/${strmodule}.ctree"/>
</dependset>
<available file="${include}/${strmodule}.ctree" property="strc-java.available"/>
<antcall target="copy-jar"/>
<antcall target="stratego.jvm.helper">
<param name="build.stratego.outputpath" value="${include}"/>
<param name="build.stratego.extraargs" value="-F"/>
<param name="build.stratego.extension" value="ctree"/>
<param name="build.stratego.compiler" value="strc"/>
</antcall>
</target>
<!-- Stratego to Java compiler -->
<target name="stratego.jar" depends="rtg2sig">
<dependset>
<srcfileset dir="${basedir}">
<include name="**/*.str"/>
<include name="**/*.astr"/>
<exclude name="lib/editor-common.generated.str"/>
</srcfileset>
<targetfileset file="${src-gen}/trans/Main.java"/>
</dependset>
<available file="${src-gen}/trans/Main.java" property="strc-java.available"/>
<antcall target="copy-jar"/>
<antcall target="stratego.jvm.helper">
<param name="build.stratego.outputpath" value="${src-gen}/trans"/>
<param name="build.stratego.extraargs" value="-la java-front"/>
<param name="build.stratego.extension" value="java"/>
</antcall>
<javac classpath="utils/strategoxt.jar:${src-gen}${externaljarimport}" srcdir="${src-gen}" includes="trans/**" destdir="${build}" source="1.5" target="1.5" debug="on"/>
<jar basedir="${build}" includes="trans/**" destfile="${include}/${strmodule}.jar"/>
</target>
<target name="stratego.jvm.helper" unless="strc-java.available" if="build.stratego.enabled">
<delete file="${include}/${strmodule}.rtree" failonerror="false"/>
<java classname="org.strategoxt.strj.Main" failonerror="true">
<arg value="-i"/>
<arg value="${trans}/${strmodule}.str"/>
<arg value="-o"/>
<arg value="${build.stratego.outputpath}/${strmodule}.${build.stratego.extension}"/>
<arg value="-p"/>
<arg value="trans"/>
<arg value="--library"/>
<arg value="--clean"/>
<arg line="${build.stratego.args}"/>
<arg line="${build.stratego.extraargs}"/>
<arg line="${externaljarflags}"/>
<arg line="${externaldefimport}"/>
</java>
<delete file="${include}/${strmodule}.rtree" failonerror="false"/>
<mkdir dir="${build}/trans"/>
</target>
<!-- Stratego to C-based native executable -->
<target name="stratego.c">
<antcall target="stratego.c.helper">
<param name="build.stratego.outputpath" value="${basedir}/include"/>
<param name="build.stratego.extraargs" value=""/>
<param name="build.stratego.extension" value=""/>
<param name="build.stratego.compiler" value="strc"/>
</antcall>
</target>
<!-- Helper target for calling the stratego compiler -->
<target name="stratego.c.helper" depends="rtg2sig" if="build.stratego.enabled">
<apply executable="${build.strategoxt.stratego}/${build.stratego.compiler}" dest="${build.stratego.outputpath}" failonerror="true">
<arg value="-i"/>
<srcfile/>
<arg value="-o"/>
<targetfile/>
<arg line="${build.stratego.args}"/>
<arg line="${build.stratego.extraargs}"/>
<arg line="${externaldefimport}"/>
<fileset file="${trans}/${strmodule}.str"/>
<mapper type="glob" from="*.str" to="*.${build.stratego.extension}"/>
</apply>
</target>
<target name="clean" description="clean up">
<delete dir="${build}"/>
<delete file="${src-gen}/trans/Main.java"/>
</target>
</project>