forked from antlr/stringtemplate4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
110 lines (92 loc) · 3.93 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
104
105
106
107
108
109
110
<project name="ST4" default="distribute" basedir=".">
<property file="build.properties" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="build.dir" value="${basedir}/build" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="install.root.dir" value="${dist.dir}/ST-${version}" />
<property name="jar.file" value="${dist.dir}/ST-${version}.jar" />
<path id="classpath">
<pathelement location="/usr/local/lib/antlr-3.3-complete.jar"/> <!-- parrt setup -->
<pathelement location="${antlr3.jar}"/> <!-- general setup -->
<pathelement location="${ant-antlr3.jar}"/>
</path>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}/gen/org/stringtemplate/v4/compiler" />
</target>
<target name="antlr" depends="init">
<antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${source}/org/stringtemplate/v4/compiler/Group.g"
outputdirectory="${build.dir}/gen/org/stringtemplate/v4/compiler">
<classpath refid="classpath"/>
</antlr:ant-antlr3>
<antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${source}/org/stringtemplate/v4/compiler/STParser.g"
outputdirectory="${build.dir}/gen/org/stringtemplate/v4/compiler">
<classpath refid="classpath"/>
</antlr:ant-antlr3>
<antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${source}/org/stringtemplate/v4/compiler/CodeGenerator.g"
outputdirectory="${build.dir}/gen/org/stringtemplate/v4/compiler">
<classpath refid="classpath"/>
</antlr:ant-antlr3>
</target>
<target name="compile" depends="antlr" description="Compile for generic OS">
<mkdir dir="${build.dir}/classes"/>
<mkdir dir="${build.dir}/src"/>
<copy todir="${build.dir}/src" >
<fileset dir="${source}"/>
</copy>
<replace dir="${build.dir}/src" token="@version@" value="${version}"/>
<javac
destdir="${build.dir}/classes"
source="1.5"
target="1.5"
debug="true"
excludes="org/stringtemplate/v4/test/**">
<classpath refid="classpath"/>
<src path="${build.dir}/src:${build.dir}/gen"/>
</javac>
</target>
<target name="build-jar" depends="compile" description="Build ST4.jar">
<mkdir dir="${dist.dir}"/>
<jar jarfile="${jar.file}">
<fileset dir="${build.dir}/classes" includes="**/*.class"/>
<manifest>
<attribute name="Version" value="${version}"/>
</manifest>
</jar>
</target>
<target name="zip-source" depends="compile">
<mkdir dir="${install.root.dir}"/>
<mkdir dir="${install.root.dir}/src"/>
<copy todir="${install.root.dir}/src">
<fileset dir="${source}">
<include name="**/*.java"/>
<include name="**/*.g"/>
<include name="**/*.st"/>
<include name="**/*.stg"/>
</fileset>
</copy>
<copy todir="${install.root.dir}">
<fileset dir=".">
<include name="build.properties"/>
<include name="build.xml"/>
<include name="LICENSE.txt"/>
<include name="README.txt"/>
<include name="doxyfile"/>
</fileset>
</copy>
<copy todir="${install.root.dir}/lib" file="${antlr3.jar}">
</copy>
<zip destfile="${dist.dir}/ST-${version}-src.zip">
<zipfileset dir="${install.root.dir}" prefix="ST-${version}"/>
</zip>
</target>
<target name="distribute" depends="clean, zip-source, build-jar">
</target>
</project>