-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
179 lines (157 loc) · 6.66 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
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
<project name="xruby" default="dist" basedir=".">
<!-- Give user a chance to override without editing this file or typing -D -->
<property file="build.properties"/>
<property file="${user.home}/.ant.properties"/>
<!-- Name of project and version, used to create filenames -->
<property name="name" value="xruby"/>
<property name="version" value="0.3.3"/>
<!-- set global properties for this build -->
<property name="src.dir" location="src"/>
<property name="lib.dir" location="lib"/>
<property name="build.dir" location="build"/>
<property name="parser.dir" location="${src.dir}/com/xruby/compiler/parser"/>
<property name="rubycode.dir" location="c:\\ruby"/>
<property name="antlr.jar" location="${lib.dir}/antlr/antlr-2.7.6.jar"/>
<property name="jarjar.jar" location="${lib.dir}/jarjar/jarjar-0.9.jar"/>
<property name="asm.jar" location="${lib.dir}/asm/asm-all-3.0.jar"/>
<property name="junit.jar" location="${lib.dir}/junit/junit-3.8.1.jar"/>
<property name="commons-cli.jar" location="${lib.dir}/commons-cli/commons-cli-1.0.jar"/>
<property name="jakarta-oro.jar" location="${lib.dir}/jakarta-oro/jakarta-oro-2.0.8.jar"/>
<property name="xruby.jar" location="${name}-${version}.jar"/>
<property name="main-class" value="com.xruby.Main"/>
<target name="clean" description="clean up" >
<!-- Delete the ${build} directory trees and jar file -->
<delete dir="${build.dir}"/>
<delete file="${xruby.jar}"/>
<delete>
<fileset dir="${parser.dir}" includes="RubyLexerBase.java"/>
<fileset dir="${parser.dir}" includes="RubyParserBase.java"/>
<fileset dir="${parser.dir}" includes="RubyTreeParser.java"/>
<fileset dir="${parser.dir}" includes="RubyTokenTypes.java"/>
<fileset dir="${parser.dir}" includes="RubyTokenTypes.txt"/>
<fileset dir="${parser.dir}" includes="RubyTreeParserTokenTypes.txt"/>
<fileset dir="${parser.dir}" includes="RubyTreeParserTokenTypes.java"/>
<fileset dir="${parser.dir}" includes="*.smap"/>
</delete>
</target>
<target name="parser" description="generate parser" >
<antlr target="${parser.dir}/ruby.g">
<classpath path="${antlr.jar}" />
</antlr>
</target>
<target name="treeparser" depends="parser" description="generate tree parser" >
<antlr target="${parser.dir}/ruby.tree.g">
<classpath path="${antlr.jar}" />
</antlr>
</target>
<target name="compile" depends="treeparser" description="compile the source" >
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}"/>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="on">
<classpath path="${antlr.jar}" />
<classpath path="${asm.jar}" />
<classpath path="${commons-cli.jar}" />
<classpath path="${jakarta-oro.jar}" />
<classpath path="${junit.jar}" />
<!--compilerarg value="-Xlint:unchecked"/-->
</javac>
</target>
<target name="generate-method-classes" depends="compile" description="generate method class" >
<java classname="${main-class}" fork="true" failonerror="true">
<classpath>
<pathelement location="${antlr.jar}" />
<pathelement location="${asm.jar}" />
<pathelement location="${commons-cli.jar}" />
<pathelement location="${jakarta-oro.jar}" />
<pathelement location="${build.dir}" />
</classpath>
<sysproperty key="xruby.method.dump" value="true"/>
<sysproperty key="xruby.method.dump_path" value="${build.dir}"/>
<arg value="-e 'puts'"/>
</java>
</target>
<target name="builtin" depends="generate-method-classes" description="compile builtin.rb" >
<java classname="${main-class}" fork="true" failonerror="true">
<classpath>
<pathelement location="${antlr.jar}" />
<pathelement location="${asm.jar}" />
<pathelement location="${commons-cli.jar}" />
<pathelement location="${jakarta-oro.jar}" />
<pathelement location="${build.dir}" />
</classpath>
<arg value="-c"/>
<arg value="src/builtin.rb"/>
</java>
</target>
<target name="stdlib" depends="builtin" description="compile ruby stdlib" >
<java classname="${main-class}" fork="true" failonerror="true">
<classpath>
<pathelement location="${antlr.jar}" />
<pathelement location="${asm.jar}" />
<pathelement location="${commons-cli.jar}" />
<pathelement location="${jakarta-oro.jar}" />
<pathelement location="${build.dir}" />
</classpath>
<arg value="-c"/>
<arg value="lib/ruby/1.8"/>
</java>
</target>
<target name="dist" depends="stdlib" description="generate the distribution" >
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${jarjar.jar}"/>
<!-- Put everything except tests in ${build} into the jar file -->
<jarjar jarfile="${xruby.jar}">
<fileset dir="${build.dir}" excludes="**/*Test.class,**/Testing*.class"/>
<zipfileset src="${antlr.jar}"/>
<zipfileset src="${asm.jar}"/>
<zipfileset src="${commons-cli.jar}"/>
<zipfileset src="${jakarta-oro.jar}"/>
<zipfileset src="builtin.jar"/>
<zipfileset src="1.8.jar"/>
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
<rule pattern="org.**" result="xruby.org.@1"/>
<rule pattern="antlr.**" result="xruby.antlr.@1"/>
</jarjar>
<!--delete file="builtin.jar"/-->
<!--delete file="1.8.jar"/-->
</target>
<target name="test" depends="dist" description="test" >
<junit haltonfailure="yes">
<classpath>
<pathelement location="${antlr.jar}" />
<pathelement location="${asm.jar}" />
<pathelement location="${commons-cli.jar}" />
<pathelement location="${jakarta-oro.jar}" />
<pathelement location="${build.dir}" />
<pathelement location="builtin.jar" />
</classpath>
<formatter type="brief" usefile="false"/>
<assertions>
<enable/>
</assertions>
<batchtest fork="yes">
<fileset dir="${build.dir}" includes="**/*Test.class" excludes="**/*SmokeTest.class"/>
</batchtest>
</junit>
</target>
<target name="lexersmoketest" depends="compile" description="run lexer smoke test">
<java classname="com.xruby.compiler.parser.RubyLexerSmokeTest">
<arg value="${rubycode.dir}"/>
<classpath>
<pathelement location="${antlr.jar}" />
<pathelement location="${build.dir}"/>
</classpath>
</java>
</target>
<target name="parsersmoketest" depends="compile" description="run parser smoke test">
<java classname="com.xruby.compiler.parser.RubyParserSmokeTest">
<arg value="${rubycode.dir}"/>
<classpath>
<pathelement location="${antlr.jar}" />
<pathelement location="${build.dir}"/>
</classpath>
</java>
</target>
</project>