-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
121 lines (105 loc) · 4.36 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
111
112
113
114
115
116
117
118
119
120
121
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="antlr-url-grammar" default="compile" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="ivy.version" value="2.2.0" />
<property name="ivy.url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy" />
<property name="lib.dir" value="${basedir}/lib"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="src.java" value="${src.dir}/java"/>
<property name="src.test" value="${src.dir}/test"/>
<property name="build.dir" value="${basedir}/build" />
<property name="build.lib" value="${build.dir}/lib" />
<property name="build.test" value="${build.dir}/test" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.test" value="${build.dir}/test"/>
<property name="test.classes" value="${build.test}/classes"/>
<property name="test.output" value="${build.test}/output"/>
<path id="autoivy.classpath">
<fileset dir="${build.lib}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${build.dir}/ivy-${ivy.version}.jar" />
</path>
<path id="classpath">
<pathelement location="${build.classes}"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<path refid="autoivy.classpath" />
</path>
<target name="ivy-download" depends="init" unless="ivy.jar.exists">
<echo>Downloading Ivy...</echo>
<get src="${ivy.url}/${ivy.version}/ivy-${ivy.version}.jar"
dest="${build.dir}/ivy-${ivy.version}.jar"
usetimestamp="true" />
</target>
<target name="ivy-init" depends="ivy-download" unless="ivy.initialized">
<mkdir dir="${build.lib}" />
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpathref="autoivy.classpath" />
<property name="ivy.initialized" value="true" />
</target>
<target name="ivy-retrieve-build" depends="ivy-init">
<ivy:retrieve type="jar,source"
sync="true"
pattern="${build.lib}/[type]s/[artifact]-[revision].[ext]" />
</target>
<target name="init">
<mkdir dir="${build.dir}" />
</target>
<target name="clean">
<delete dir="${build.classes}"/>
<delete dir="${build.test}"/>
</target>
<target name="gen-url-parser" depends="ivy-retrieve-build">
<property name="url.dir" value="${src.java}/org/jingguo/url"/>
<java jar="${lib.dir}/antlr-3.3-complete.jar" fork="true">
<arg value="-fo"/>
<arg value="${url.dir}"/>
<arg value="${url.dir}/URL.g"/>
</java>
</target>
<target name="compile" depends="init, ivy-retrieve-build">
<mkdir dir="${build.classes}"/>
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="${build.classes}" includeantruntime="false">
<src path="${src.java}"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="compile-test" depends="compile">
<mkdir dir="${test.classes}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="${test.classes}" includeantruntime="false">
<src path="${src.test}"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="test" depends="compile-test">
<mkdir dir="${test.output}"/>
<junit fork="on">
<formatter type="xml" usefile="true"/>
<formatter type="brief" usefile="false"/>
<classpath>
<path refid="classpath"/>
<pathelement location="${test.classes}"/>
</classpath>
<batchtest todir="${test.output}">
<fileset dir="${src.test}" includes="**/*.java"/>
</batchtest>
</junit>
</target>
</project>