-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.generated.xml
773 lines (710 loc) · 31.1 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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
<?xml version="1.0" encoding="UTF-8"?>
<project name="build.generated">
<target name="spoofaximp.default" depends="spoofaximp.default.ctree" />
<target name="spoofaximp.default.ctree" depends="
check-classpath,
call-onsave,
init,
sdf2table,
meta-sdf2table,
ppgen,
pppack,
sdf2imp.eclipse,
sdf2imp.standalone,
sdf2parenthesize,
stratego.aster,
java.jar,
stratego.ctree,
refresh,
sdf2imp.eclipse.load" />
<target name="spoofaximp.default.jar" depends="
check-classpath,
call-onsave,
init,
sdf2table,
meta-sdf2table,
ppgen,
pppack,
sdf2imp.eclipse,
sdf2imp.standalone,
sdf2parenthesize,
stratego.aster,
java.jar,
stratego.jar.helper,
refresh,
sdf2imp.eclipse.load" />
<target name="spoofaximp.default.nostr" depends="
check-classpath,
call-onsave,
init,
sdf2table,
meta-sdf2table,
ppgen,
pppack,
sdf2imp.eclipse,
sdf2imp.standalone,
sdf2parenthesize,
stratego.aster,
java.jar,
refresh,
sdf2imp.eclipse.load" />
<!-- Initialization -->
<available file="${src-gen}/StateMachine/strategies/Main.java" property="java.jar.enabled" />
<condition property="java.jar.import" value="-la StateMachine.strategies" else="">
<isset property="java.jar.enabled" />
</condition>
<condition property="java.jar.classpath" value=":${include}/${strmodule}-java.jar" else="">
<isset property="java.jar.enabled" />
</condition>
<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="externaljarimport1" value=":${externaljar}" else="">
<isset property="externaljar" />
</condition>
<condition property="externaljarimport2" value=":${externaljarx}" else="">
<isset property="externaljarx" />
</condition>
<condition property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter">
<isset property="eclipse.running" />
</condition>
<condition property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter">
<available classname="org.eclipse.jdt.core.JDTCompilerAdapter" />
</condition>
<condition property="externaljarflags" value="${externaljarflags}" else="">
<isset property="externaljarflags" />
</condition>
<condition property="metasdfmodule.available" value="1">
<available file="${syntax}/${metasdfmodule}.sdf" />
</condition>
<fail unless="build" message="Please use build.main.xml to build this project or configure the required properties manually" />
<mkdir dir="${build}" />
<mkdir dir="${src-gen}" />
<mkdir dir="${dist}" />
<mkdir dir="${include}" />
<mkdir dir="${lib}" />
<mkdir dir="${syntax}" />
<!-- The files for which the on-save handler is called before building. -->
<path id="call-onsave.files">
<fileset dir=".">
<include name="**/*.tmpl" />
<include name="**/*.sdf3" />
<include name="**/*.nab" />
<include name="**/*.ts" />
</fileset>
</path>
<!-- Call on-save handler for template and name binding files so that their generated files are present. -->
<target name="call-onsave" if="eclipse.running">
<pathconvert pathsep=" " property="call-onsave.args" refid="call-onsave.files" />
<java classname="org.strategoxt.imp.metatooling.building.AntForceOnSave">
<arg line="${call-onsave.args}" />
</java>
</target>
<target name="sdf2imp" depends="sdf2table,sdf2imp.eclipse,sdf2imp.standalone,sdf2parenthesize" />
<target name="sdf2imp.eclipse" if="eclipse.running" depends="sdf2rtg">
<java classname="org.strategoxt.imp.metatooling.building.AntDescriptorBuilder" failonerror="true">
<arg value="${include}/${esvmodule}.packed.esv" />
</java>
</target>
<target name="sdf2imp.eclipse.load" if="eclipse.running">
<java classname="org.strategoxt.imp.metatooling.loading.AntDescriptorLoader" failonerror="true">
<arg value="${include}/${esvmodule}.packed.esv" />
</java>
</target>
<target name="refresh" if="eclipse.running">
<eclipse.convertPath fileSystemPath="${basedir}" property="projectdir" />
<eclipse.convertPath fileSystemPath="${syntax}" property="syntaxdir" />
<eclipse.convertPath fileSystemPath="${lib}" property="libdir" />
<eclipse.refreshLocal resource="${libdir}" depth="infinite" />
<eclipse.refreshLocal resource="${syntaxdir}/${sdfmodule}.pp.generated" 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}-Outliner.generated.esv" depth="infinite" />
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-Outliner.generated.str" depth="infinite" />
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-References.generated.esv" depth="infinite" />
<eclipse.refreshLocal resource="${projectdir}/editor/${sdfmodule}-Syntax.generated.esv" depth="infinite" />
<eclipse.convertPath fileSystemPath="${src-gen}" property="eclipse.path.src-gen" />
<eclipse.refreshLocal resource="${eclipse.path.src-gen}" depth="infinite" />
<eclipse.convertPath fileSystemPath="${build}" property="eclipse.path.build" />
<eclipse.refreshLocal resource="${eclipse.path.build}" 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="check-classpath">
<available classname="org.strategoxt.imp.generator.sdf2imp" property="check-classpath.available" />
<antcall target="check-classpath.helper" />
</target>
<target name="init" if="eclipse.running">
<!-- refresh one file/dir in the project to trigger an Ant rebuild with the next build command -->
<java classname="org.strategoxt.imp.metatooling.building.AntForceRefreshScheduler" failonerror="false">
<arg value="${include}" />
</java>
</target>
<target name="check-classpath.helper" unless="check-classpath.available">
<echo level="error" message="Could not load the Spoofax plugin loading classes." />
<echo level="error" message="Make sure it is on the class path." />
<echo level="error" message="" />
<echo level="error" message="In Eclipse, make sure the Ant builder is configured properly:" />
<echo level="error" message="right-click on build.main.xml, go to Run as, Ant build..., JRE tab," />
<echo level="error" message="and ensure Run in the same JRE as the workspace is selected" />
<echo level="error" message="alternatively, build the project using Build Project in the Project menu" />
<fail />
</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="meta-sdf2table" if="metasdfmodule.available">
<fail unless="eclipse.spoofaximp.jars" message="Property eclipse.spoofaximp.jars must point to the directory containing StrategoMix.def" />
<antcall target="sdf2table">
<param name="sdfmodule" value="${metasdfmodule}" />
<param name="build.sdf.imports" value="-Idef "${eclipse.spoofaximp.jars}/StrategoMix.def" ${build.sdf.imports}" />
</antcall>
<antcall target="meta-sdf2table.helper" />
</target>
<target name="meta-sdf2table.helper" if="eclipse.running">
<eclipse.convertPath fileSystemPath="${include}" property="includeresource" />
<eclipse.refreshLocal resource="${includeresource}/${metasdfmodule}.tbl" depth="infinite" />
</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">
<!-- only useful for builds outside of Eclipse -->
<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.jars}/StrategoMix.def" todir="utils" failonerror="false" />
<copy file="${eclipse.spoofaximp.strategojar}" todir="utils" failonerror="false" />
</target>
<target name="pack-sdf" unless="externaldef">
<dependset>
<srcfileset dir="${basedir}">
<include name="**/*.sdf" />
</srcfileset>
<srcfileset dir="${lib}">
<include name="**/*.def" />
</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">
<condition property="utils-include" value="-I ${utils}" else="">
<available file="${utils}" />
</condition>
<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="${utils-include}" />
<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="sdf2parenthesize" depends="pack-sdf,copy-sdf">
<dependset>
<srcfileset file="${include}/${sdfmodule}.def" />
<targetfileset file="${include}/${sdfmodule}-parenthesize.str" />
</dependset>
<available file="${include}/${sdfmodule}-parenthesize.str" property="sdf2parenthesize.available" />
<antcall target="sdf2parenthesize.helper" />
<available file="${include}/${sdfmodule}-parenthesize.str" property="sdf2parenthesize.available" />
<antcall target="sdf2parenthesize.helper.fallback" />
</target>
<target name="sdf2parenthesize.helper" unless="sdf2parenthesize.available">
<java classname="run" failonerror="false">
<arg value="org.strategoxt.tools.main-sdf2parenthesize" />
<arg value="-i" />
<arg value="${include}/${sdfmodule}.def" />
<arg value="-m" />
<arg value="${sdfmodule}" />
<arg value="-o" />
<arg value="${include}/${sdfmodule}-parenthesize.str" />
<arg value="--omod" />
<arg value="include/${sdfmodule}-parenthesize" />
<arg value="--main-strategy" />
<arg value="io-${sdfmodule}-parenthesize" />
<arg value="--lang" />
<arg value="${sdfmodule}" />
<arg value="--rule-prefix" />
<arg value="${sdfmodule}" />
<arg value="--sig-module" />
<arg value="include/${sdfmodule}" />
</java>
</target>
<target name="sdf2parenthesize.helper.fallback" unless="sdf2parenthesize.available">
<echo file="${include}/${sdfmodule}-parenthesize.str" message="module include/${sdfmodule}-parenthesize rules parenthesize-${sdfmodule} = id" />
</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="true">
<arg value="org.strategoxt.tools.main-ppgen" />
<arg value="-i" />
<arg value="${include}/${sdfmodule}.def" />
<arg value="-t" />
<arg value="-b" />
<arg value="-o" />
<arg value="${include}/${sdfmodule}.generated.pp.af" />
</java>
<java classname="run" failonerror="true">
<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" />
<fileset dir="${basedir}" id="aster-input-set">
<include name="**/*.astr" />
</fileset>
<pathconvert pathsep=" " setonempty="false" property="aster-input" refid="aster-input-set" />
<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" if="aster-input" unless="aster-output.uptodate">
<java classname="org.strategoxt.aster.Main" failonerror="true">
<arg value="-i" />
<arg line="${aster-input}" />
</java>
</target>
<target name="java.jar" if="java.jar.enabled">
<jar basedir="${build}" excludes="trans/**" update="true" destfile="${include}/${strmodule}-java.jar" />
</target>
<!-- Stratego to Java interpreter -->
<target name="stratego.ctree" depends="rtg2sig">
<fail message="Main stratego file '${strmodule}.str' not found.">
<condition>
<not>
<isset property="build.stratego.enabled" />
</not>
</condition>
</fail>
<dependset>
<srcfileset dir="${basedir}">
<include name="**/*.str" />
<include name="**/*.astr" />
<exclude name="lib/*.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.outputfile" value="${include}/${strmodule}.ctree" />
<param name="build.stratego.extraargs" value="-F" />
</antcall>
</target>
<!-- Stratego to Java compiler -->
<target name="stratego.jar" depends="rtg2sig,utils-files">
<fail message="Main stratego file '${strmodule}.str' not found.">
<condition>
<not>
<isset property="build.stratego.enabled" />
</not>
</condition>
</fail>
<dependset>
<srcfileset dir="${basedir}">
<include name="**/*.str" />
<include name="**/*.astr" />
<exclude name="lib/*.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.jar.deletehelper" />
<antcall target="stratego.jvm.helper">
<param name="build.stratego.outputfile" value="${src-gen}/trans/Main.java" />
<param name="build.stratego.extraargs" value="-la java-front ${java.jar.import}" />
</antcall>
<javac srcdir="${src-gen}" includes="trans/**" destdir="${build}" source="1.7" target="1.7" debug="on">
<classpath>
<pathelement path="utils/strategoxt.jar:${src-gen}${externaljarimport1}${externaljarimport2}${java.jar.classpath}" />
<fileset dir="${eclipse.home}/plugins">
<include name="*.jar" />
</fileset>
<!-- Spoofax/322 -->
</classpath>
</javac>
<!-- copy imported terms -->
<copy todir="${build}/trans">
<fileset dir="${src-gen}/trans" excludes="**/*.java" />
</copy>
<jar basedir="${build}" includes="trans/**" destfile="${include}/${strmodule}.tmp.jar" />
<move file="${include}/${strmodule}.tmp.jar" tofile="${include}/${strmodule}.jar" />
<delete>
<fileset dir="${build}" includes="trans/**" />
</delete>
</target>
<target name="stratego.jar.deletehelper" unless="strc-java.available">
<delete>
<fileset dir="${src-gen}" includes="trans/**" />
<fileset dir="${build}" includes="trans/**" />
</delete>
</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.outputfile}" />
<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}" />
<arg line="-I "${lib}" -I "${include}" --cache-dir "${basedir}/.cache"" />
</java>
<delete file="${include}/${strmodule}.rtree" failonerror="false" />
<mkdir dir="${build}/trans" />
</target>
<!-- begin: targets used for adding debugging instrumentation to stratego -->
<!--
if "debug.the.debug.transformer" is set, debug the debug instrumentation, do not output rtree-files, but str-files
Only used by stratego.jvm.helper.debug
-->
<condition property="transformer-output" value="" else="--output-rtree">
<isset property="debug.the.debug.transformer" />
</condition>
<!--
if debug.the.debug.transformer is set then the debug.transformer outputs str files, so the strj-compiler should accept a str-file.
if debug.the.debug.transformer is NOT set then the debug.transformer outputs rtree files (much faster generated), so the strj-compiler should accept a rtree-file
Only used by stratego.jvm.helper.debug
-->
<condition property="strj.input.file.type" value="str" else="rtree">
<isset property="debug.the.debug.transformer" />
</condition>
<!-- value determines which target will be executed.
If the file ".debugmode" can be found in the project root call stratego.jar.debug
else call stratego.jar
-->
<condition property="stratego.jar.target" value="call.stratego.jar.debug" else="call.stratego.jar">
<available file=".debugmode" />
</condition>
<!-- will save the stratego files with debug info in this folder -->
<property name="trans-debug" location="trans-debug" />
<!-- this helper target determines what target to call, based on debug.build.enabled -->
<target name="stratego.jar.helper">
<antcall target="${stratego.jar.target}" />
</target>
<!-- call stratego.jar unless debug.build.enabled property is set -->
<target name="call.stratego.jar" depends="stratego.jar">
<echo message="call.stratego.jar - ${stratego.jar.target}" />
</target>
<!-- call stratego.jar.debug when debug.build.enabled property is set -->
<target name="call.stratego.jar.debug" depends="stratego.jar.debug">
<echo message="call.stratego.jar.debug - ${stratego.jar.target}" />
</target>
<!-- copy stratego runtime jars to utils folder -->
<target name="utils-files-debug" depends="utils-files">
<copy file="${eclipse.spoofaximp.stratego-debug-runtime-jar}" todir="utils" failonerror="false" />
<copy file="${eclipse.spoofaximp.stratego-debug-runtime-java-jar}" todir="utils" failonerror="false" />
</target>
<!-- Stratego to Java compiler with debugging capabilities -->
<target name="stratego.jar.debug" depends="rtg2sig,utils-files-debug">
<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.jar.deletehelper" />
<!-- compile stratego to java -->
<antcall target="stratego.jvm.helper.debug">
<param name="build.stratego.outputfile" value="${src-gen}/trans/Main.java" />
<param name="build.stratego.extraargs" value="-la java-front ${java.jar.import}" />
</antcall>
<!-- compile java to class -->
<javac destdir="${build}" source="1.7" target="1.7" debug="on">
<!-- attribute in javac: srcdir="${src-gen}" -->
<src path="${src-gen}" />
<!-- attribute in javac: classpath="utils/strategoxt.jar:${src-gen}${externaljarimport1}${externaljarimport2}${java.jar.classpath}" -->
<classpath>
<pathelement path="utils/strategoxt.jar:${src-gen}${externaljarimport1}${externaljarimport2}${java.jar.classpath}" />
<!-- the path attribute accepts colon- or semicolon-separated lists of locations -->
<fileset dir="${eclipse.home}/plugins">
<include name="*.jar" />
</fileset>
<!-- Spoofax/322 -->
<pathelement location="utils/stratego-debug-runtime.jar" />
<!-- The location attribute specifies a single file or directory relative to the project's base directory (or an absolute filename) -->
<pathelement location="utils/stratego-debug-runtime-java.jar" />
</classpath>
<!-- attribute in javac: includes="trans/**" -->
<include name="trans/**" />
</javac>
<!-- copy imported terms -->
<copy todir="${build}/trans">
<fileset dir="${src-gen}/trans" excludes="**/*.java" />
</copy>
<!-- create a jar from the class files -->
<jar basedir="${build}" includes="trans/**" destfile="${include}/${strmodule}.tmp.jar" />
<move file="${include}/${strmodule}.tmp.jar" tofile="${include}/${strmodule}.jar" />
<delete>
<fileset dir="${build}" includes="trans/**" />
</delete>
</target>
<!-- instrument the stratego program and compile it to java -->
<target name="stratego.jvm.helper.debug" unless="strc-java.available" if="build.stratego.enabled">
<echo message="generate stratego with debug information" />
<echo message="${basedir}" />
<available classname="org.strategoxt.imp.debug.stratego.transformer.trans.Main" property="transformer.available" />
<!-- add debug information -->
<java classname="org.strategoxt.imp.debug.stratego.transformer.trans.Main" failonerror="true" fork="true">
<classpath>
<pathelement location="${eclipse.spoofaximp.stratego-transformer-jar}" />
<pathelement location="${eclipse.spoofaximp.stratego-transformer-java-jar}" />
<pathelement location="${eclipse.spoofaximp.strategojar}" />
</classpath>
<arg value="-i" />
<arg value="${trans}/${strmodule}.str" />
<arg value="--gen-dir" />
<arg value="${trans-debug}" />
<arg value="--base-dir" />
<!-- set the basedir to the project dir -->
<arg value="${basedir}" />
<!-- "arg line='val'" val should contain space-separated arguments -->
<arg line="--charoffset-converter --fail-catch ${transformer-output}" />
<!-- arguments should start with two '-'-characters -->
<!-- <arg value="-charoffset-converter"/> -->
<!-- create charoffset table -->
<!-- <arg value="-fail-catch"/> -->
<!-- catch failures in where/with-clauses in rules -->
<!-- <arg value="-output-rtree"/> -->
</java>
<!-- now compile instrumented stratego to java -->
<delete file="${include}/${strmodule}.rtree" failonerror="false" />
<java classname="org.strategoxt.strj.Main" failonerror="true">
<arg value="-i" />
<arg value="${trans-debug}/trans/${strmodule}.${strj.input.file.type}" />
<arg value="-o" />
<arg value="${build.stratego.outputfile}" />
<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}" />
<arg line="-I "${lib}" -I "${include}" --cache-dir "${basedir}/.cache"" />
<!-- put strategodebuglib.rtree on the include path -->
<arg line="-I "${eclipse.spoofaximp.strategodebuglib-folder}"" />
<arg line="-la org.strategoxt.imp.debug.stratego.runtime.trans" />
</java>
<delete file="${include}/${strmodule}.rtree" failonerror="false" />
<mkdir dir="${build}/trans" />
</target>
<!-- end: targets used for adding debugging instrumentation to stratego -->
<!-- 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}" />
<arg line="-I "${lib}" --cache-dir "${basedir}/.cache"" />
<fileset file="${trans}/${strmodule}.str" />
<mapper type="glob" from="*.str" to="*.${build.stratego.extension}" />
</apply>
</target>
<target name="clean" description="Clean project">
<delete dir="${build}" />
<delete dir=".cache" />
<delete file="${include}/${sdfmodule}.def" />
<delete file="${include}/${sdfmodule}-parenthesize.str" />
<delete file="${include}/${sdfmodule}-Permissive.def" />
<delete file="${include}/${sdfmodule}.generated.pp.af" />
<delete file="${include}/${sdfmodule}.packed.esv" />
<delete file="${include}/${sdfmodule}.pp.af" />
<delete file="${include}/${sdfmodule}.rtg" />
<delete file="${include}/${sdfmodule}.str" />
<delete file="${include}/${sdfmodule}.tbl" />
<delete file="${include}/${strmodule}.rtree" />
<delete file="${include}/${strmodule}.ctree" />
<delete file="${include}/${strmodule}.ctree.dep" />
<delete file="${include}/${strmodule}.jar" />
<delete>
<fileset dir="editor" includes="*.generated.esv" />
</delete>
<delete dir="${src-gen}/trans" />
<delete file="editor/${sdfmodule}.generated.esv" />
<delete file="${syntax}/${sdfmodule}.generated.esv" />
<delete file="${syntax}/${sdfmodule}.generated.pp" />
<delete file="${include}/${metasdfmodule}-Permissive.def" />
<delete file="${include}/${metasdfmodule}.def" />
<delete file="${include}/${metasdfmodule}.tbl" />
<delete file=".settings/org.eclipse.jdt.core.prefs" />
<delete dir="utils" />
<delete>
<fileset dir="lib-refactoring" includes="*.generated.str" />
<fileset dir="${lib}" includes="*.generated.str" />
</delete>
<antcall target="refresh-cleaned" />
</target>
<target name="refresh-cleaned" if="eclipse.running">
<eclipse.convertPath fileSystemPath="${basedir}" property="projectdir" />
<eclipse.refreshLocal resource="${projectdir}" depth="infinite" />
</target>
</project>