-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.xml
More file actions
154 lines (134 loc) · 5.75 KB
/
build.xml
File metadata and controls
154 lines (134 loc) · 5.75 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
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="./ant2html.xsl"?>
<!-- ======================================================================
DateParser
An ANTLR parser for interpreting natural language date strings.
by Ethan Blackwelder
====================================================================== -->
<project name="DateParser" default="prepare">
<description>
DateParser:
An ANTLR parser for interpreting natural language date strings.
(You're currently reading the Ant script for creating distribution packages.)
Copyright (c) 2010 Ethan Blackwelder. All Rights Reserved.
</description>
<tstamp>
<format property="timestamp" pattern="dd-MM-yyyy hh:mm aa"/>
</tstamp>
<property file="build.properties"/>
<path id="classpath.compile">
<pathelement location="${dist.home}/${jar.name}"/>
<fileset dir="${dist.home}" includes="*.jar"/>
</path>
<path id="classpath.run">
<fileset dir="${dist.home}" includes="*.jar"/>
</path>
<target name="generate-lexer" description="Generates a lexer and parser from an ANTLR grammar.">
<java classname="${antlr.main-class}" classpath="${libs.home}${file.separator}${antlr.jar}">
<arg value="-verbose"/>
<arg value="-o"/>
<arg value="${src.home}${file.separator}${grammar.package-dir}"/>
<arg value="-make"/> <!-- Only re-generate if the grammar changes. -->
<arg value="${src.home}${file.separator}${grammar.package-dir}${file.separator}${grammar.file}"/>
</java>
</target>
<target name="prepare" depends="generate-lexer" description="Makes target directories, copy non-Java resources, etc.">
<mkdir dir="${build.home}" />
<mkdir dir="${dist.home}" />
<copy todir="${dist.home}">
<fileset dir="${libs.home}" includes="*.jar"/>
</copy>
<antcall target="-copy-resources">
<param name="resources.srcdir" value="${src.home}"/>
<param name="resources.destdir" value="${build.home}"/>
</antcall>
<antcall target="-copy-resources">
<param name="resources.srcdir" value="${demos.home}"/>
<param name="resources.destdir" value="${build.home}"/>
</antcall>
<antcall target="-copy-resources">
<param name="resources.srcdir" value="${tools.home}"/>
<param name="resources.destdir" value="${build.home}"/>
</antcall>
</target>
<target name="clean" description="Clean-up time">
<delete dir="${build.home}" verbose="${verbose.mode}"/>
<delete dir="${dist.home}" verbose="${verbose.mode}"/>
</target>
<target name="-copy-resources" description="Copies image resources to a specific build directory.">
<fail message="Please set the 'resources.srcdir' parameter." unless="resources.srcdir"/>
<fail message="Please set the 'resources.destdir' parameter." unless="resources.destdir"/>
<copy todir="${resources.destdir}" includeemptydirs="no">
<fileset dir="${resources.srcdir}">
<exclude name="**/.svn"/>
<exclude name="**/*.java"/>
<exclude name="**/Thumbs.db"/>
</fileset>
</copy>
</target>
<target name="compile-full" depends="prepare" description="Compiles the all Java source files (including demos and tools).">
<javac destdir="${build.home}" target="${jar.target}" includeantruntime="no">
<src path="${src.home}"/>
<src path="${demos.home}"/>
<src path="${tools.home}"/>
<classpath>
<!-- pathelement location="${dist.home}/${jar.name.core}"/-->
<fileset dir="${libs.home}" includes="*.jar"/>
</classpath>
</javac>
</target>
<target name="jar-full" depends="compile-full" description="Creates a min JAR of the application">
<jar destfile="${dist.home}${file.separator}${jar.name}">
<manifest>
<attribute name="Created-By" value="${app.author}"/>
<attribute name="Built-By" value="${user.name} - ${ant.version}"/>
<attribute name="Implementation-Title" value="${app.name}"/>
<attribute name="Implementation-Version" value="${app.version} (${timestamp})"/>
<attribute name="Implementation-URL" value="${app.website}"/>
<attribute name="Main-Class" value="${jar.main-class}"/>
<attribute name="Class-Path" value="${antlr.jar}"/>
</manifest>
<fileset dir="${build.home}">
<include name="**/*"/>
</fileset>
</jar>
</target>
<target name="zip-src" depends="prepare" description="Creates a ZIP of the source code">
<property name="base-prefix" value="${app.name}-${app.version}"/>
<zip destfile="${dist.home}${file.separator}${zip.name.src}">
<zipfileset dir="${basedir}" prefix="${base-prefix}">
<include name="build.xml"/>
<include name="ant2html.xsl"/>
<include name="License.txt"/>
</zipfileset>
<zipfileset dir="${src.home}" prefix="${base-prefix}/src">
<exclude name="**/.svn"/>
<exclude name="**/Thumbs.db"/>
</zipfileset>
<zipfileset dir="${demos.home}" prefix="${base-prefix}/demos">
<exclude name="**/.svn"/>
<exclude name="**/Thumbs.db"/>
</zipfileset>
<zipfileset dir="${tools.home}" prefix="${base-prefix}/tools">
<exclude name="**/.svn"/>
</zipfileset>
<zipfileset dir="${libs.home}" prefix="${base-prefix}/lib">
<exclude name="**/.svn"/>
</zipfileset>
</zip>
</target>
<target name="dist" depends="jar-full,zip-src" description="Creates a distribution of all packages">
<echo message="Your distribution packages are here: ${dist.home}"/>
</target>
<target name="redist" depends="clean,dist" description="Creates a fresh distribution of all packages">
</target>
<target name="run-demo" depends="jar-full" description="Compiles and runs the GUI application.">
<java fork="true" classname="${run.main-class}">
<classpath>
<fileset dir="${dist.home}">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
</project>