-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.xml
103 lines (91 loc) · 4 KB
/
build.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
<!--
This file is released under terms of BSD license
See LICENSE file for more information
@author: clementval
-->
<!-- CLAW X2T build process -->
<project name="cx2t" default="main" basedir=".">
<description>Build CX2T libraries</description>
<!-- Value set externally-->
<property name="claw.properties.dir" value=""/>
<property file="${claw.properties.dir}/claw.properties"/>
<!-- Java sources -->
<property name="src.translator.parser.dir"
value="${gen.src.dir}/claw/wani/language/parser"/>
<!-- Classpath for the CX2T Translator library -->
<path id="build.path">
<pathelement path="${st4.dep}"/>
<pathelement path="${antlr.dep}"/>
<pathelement path="${antlr4.dep}"/>
<pathelement path="${antlr4.runtime.dep}"/>
<pathelement path="${argparse4j.dep}"/>
<pathelement path="${omni.xcodeml-common.dep}"/>
<pathelement path="${toml.dep}"/>
</path>
<path id="antlr.path">
<pathelement path="${st4.dep}"/>
<pathelement path="${antlr.dep}"/>
<pathelement path="${antlr4.dep}"/>
<pathelement path="${antlr4.runtime.dep}"/>
</path>
<!-- Initialization step -->
<target name="init" description="Initialize build directories">
<tstamp/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${src.translator.parser.dir}"/>
</target>
<!-- Check if parser is up-to-date or need to be re-generated -->
<uptodate property="antlr.required"
targetfile="${src.dir}/claw/wani/language/parser/Claw.g4" >
<srcfiles dir="${src.translator.parser.dir}" includes="*.java" erroronmissingdir="false" />
</uptodate>
<!-- Generate the CLAW parser from the ANTLR grammar file -->
<target name="antlr" if="antlr.required" description="Generate the parser from ANTLR grammar file">
<java jvm="${java.exec}" classname="org.antlr.v4.Tool" fork="true" failonerror="true"
classpathref="antlr.path">
<arg value="-o"/>
<arg value="${src.translator.parser.dir}"/>
<arg value="-package"/>
<arg value="claw.wani.language.parser"/>
<arg line="${src.dir}/claw/wani/language/parser/Claw.g4"/>
</java>
</target>
<!-- Compile the java code for the two libraries -->
<target name="compile" depends="antlr" description="compile the source">
<javac executable="${javac.exec}" fork="yes" includeantruntime="false" srcdir=""
destdir="${classes.dir}" classpathref="build.path" debug="on">
<src>
<pathelement path="${src.dir}"/>
<pathelement path="${gen.src.dir}"/>
</src>
</javac>
</target>
<!-- Package compiled files into their own library -->
<target name="jar" depends="compile" description="package, output to JAR">
<mkdir dir="${dist.dir}"/>
<!-- CLAW X2T TATSU -->
<jar jarfile="${dist.dir}/${claw.tatsu.jar}" basedir="${classes.dir}"
includes="claw/tatsu/**"/>
<!-- CLAW X2T SHENRON -->
<jar jarfile="${dist.dir}/${claw.shenron.jar}" basedir="${classes.dir}"
includes="claw/shenron/**"/>
<!-- CLAW X2T WANI -->
<jar jarfile="${dist.dir}/${claw.wani.jar}" basedir="${classes.dir}"
includes="claw/wani/**">
<zipfileset dir="${src.dir}/claw/config" includes="**/*.xml **/*.xsd"
prefix="claw/config"/>
</jar>
<!-- -->
<jar jarfile="${dist.dir}/${external.jar}" basedir="${classes.dir}"
includes="external/**"/>
</target>
<target name="clean" description="clean up">
<delete dir="${classes.dir}"/>
<delete file="${dist.dir}/${claw.tatsu.jar}"/>
<delete file="${dist.dir}/${claw.shenron.jar}"/>
<delete file="${dist.dir}/${claw.wani.jar}"/>
<delete file="${dist.dir}/${external.jar}"/>
</target>
<!-- Default target -->
<target name="main" depends="init, antlr, compile, jar"/>
</project>