-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
240 lines (208 loc) · 8.33 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<project name="scoroutine" default="build">
<target name="init">
<!-- Create symlink pointing to your scala main directories:
scala-current points to 2.8.0-final
scala-dev points to dev of 2.8.0 for scaladoc
-->
<property name="scala.dir" value="scala-current"/>
<property name="scala.dev" value="scala-dev"/>
<property name="src.dir" value="src/main/scala"/>
<property name="arch.dir" value="Arch"/>
<property name="release.dir" value="release"/>
<property name="example.src.dir" value="src/example/scala"/>
<property name="build.dir" value="build"/>
<property name="class.dir" value="${build.dir}/class"/>
<property name="apidoc.dir" value="${build.dir}/doc/api"/>
<property file="VERSION"/>
<property name="lib.jar"
value="${build.dir}/scoroutine-${version.number}.jar"/>
<property name="rel.subdir" value="${version.name}-${version.number}"/>
<property name="rel.subname"
value="${version.name}-src-${version.number}"/>
<property name="rel.dir" value="${release.dir}/${rel.subdir}" />
<property name="rel.zip" value="${release.dir}/${rel.subname}.zip" />
<property name="relbin.files"
value="README VERSION LICENSE COPYRIGHT HISTORY"/>
<property name="relsrc.files"
value="build.xml ${src.dir}/**/*.scala
${example.src.dir}/**/*.scala" />
<property name="scala.compiler.jar"
value="${scala.dir}/lib/scala-compiler.jar"/>
<property name="scala.library.jar"
value="${scala.dir}/lib/scala-library.jar"/>
<!-- The classpath for compiling our scala classes. -->
<path id="compile.classpath">
<pathelement location="${class.dir}"/>
</path>
<!-- The classpath for compiling our scala classes. -->
<path id="scala.classpath">
<pathelement location="${scala.compiler.jar}"/>
<pathelement location="${scala.library.jar}"/>
<pathelement location="${class.dir}"/>
</path>
<!-- The classpath for creating our scaladoc docs. -->
<path id="scaladoc.classpath">
<pathelement location="${scala.library.jar}"/>
<path refid="compile.classpath"/>
</path>
<!-- Define the scalac task -->
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath refid="scala.classpath"/>
</taskdef>
</target>
<target name="mkdirs" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${class.dir}"/>
<mkdir dir="${release.dir}"/>
</target>
<target name="build" depends="jar"/>
<target name="compile" depends="scalac"/>
<target name="scalac" depends="init,mkdirs">
<fileset id="scala.src.fileset" dir="${src.dir}">
<include name="**/*.scala"/>
</fileset>
<pathconvert refid="scala.src.fileset" pathsep=" "
property="src.files"/>
<pathconvert refid="scala.classpath" property="scala.cp"/>
<exec executable="${scala.dir}/bin/scalac">
<arg value="-g"/>
<arg value="-P:continuations:enable"/>
<arg value="-sourcepath"/>
<arg value="${src.dir}"/>
<arg value="-cp"/>
<arg value="${scala.cp}"/>
<arg value="-d"/>
<arg value="${class.dir}"/>
<arg value="-unchecked"/>
<arg line="${src.files}"/>
</exec>
</target>
<target name="example-scalac" depends="init">
<antcall target="scalac">
<param name="src.dir" value="${example.src.dir}"/>
</antcall>
</target>
<target name="x-scalac" depends="init,mkdirs">
<!-- fsc task is same as scalac, but uses cached "fast scala compiler" -->
<!-- To clear out the compiler cache, run "fsc -reset" -->
<scalac
srcdir="${src.dir}"
destdir="${class.dir}"
addparams="-g:vars"
classpathref="scala.classpath"
force="changed"
deprecation="on"
>
<include name="**/*.scala"/>
<exclude name="**/*.old/**/*.scala"/>
</scalac>
</target>
<target name="jar" depends="compile"
description="Build the library jar file">
<jar
jarfile="${lib.jar}"
basedir="${class.dir}"
>
<manifest>
<attribute name="Main-class" value="${main.class}"/>
</manifest>
</jar>
</target>
<target name="clean" depends="init"
description="Remove all generated files">
<delete dir="${build.dir}"/>
</target>
<!-- Make the documentation -->
<target name="doc" depends="apidoc"
description="Compile all the documentation"/>
<target name="apidoc" depends="init"
description="Create the scaladoc documentation">
<uptodate targetfile="${apidoc.dir}/index.html"
property="apidoc-uptodate">
<srcfiles dir="${src.dir}"
includes="**/*.scala"
excludes="**/*.old/**/*.scala"/>
</uptodate>
<antcall target="create-apidoc"/>
</target>
<target name="create-apidoc" depends="init" unless="apidoc-uptodate">
<mkdir dir="${apidoc.dir}"/>
<fileset id="scala.src.fileset" dir="${src.dir}">
<include name="**/*.scala"/>
</fileset>
<pathconvert refid="scala.src.fileset" pathsep=" "
property="src.files"/>
<exec executable="${scala.dev}/bin/scaladoc">
<arg value="-P:continuations:enable"/>
<arg value="-d"/>
<arg value="${apidoc.dir}"/>
<arg value="-doc-title"/>
<arg value="net.jimmc.scoroutine scaladoc"/>
<arg line="${src.files}"/>
</exec>
</target>
<target name="x-create-apidoc" depends="init" unless="apidoc-uptodate">
<mkdir dir="${apidoc.dir}"/>
<scaladoc
srcdir="${src.dir}"
destdir="${apidoc.dir}"
classpathref="scaladoc.classpath"
>
<include name="**/*.scala"/>
<exclude name="**/*.old/**/*.scala"/>
</scaladoc>
</target>
<target name="all" depends="jar,doc"
description="Build all files for release"/>
<target name="arch" depends="init"
description="Copy the relzip and README files to the Arch dir">
<property name="arch.version.dir"
value="${arch.dir}/v${version.number}"/>
<mkdir dir="${arch.version.dir}"/>
<copy file="${rel.zip}"
tofile="${arch.version.dir}/${rel.zip}"
preservelastmodified="true"/>
<copy file="README"
tofile="${arch.version.dir}/README-${version.number}"
preservelastmodified="true"/>
<chmod dir="${arch.version.dir}" includes="*" perm="-w"/>
</target>
<target name="gittag" depends="init"
description="Tag all files in git for the current release">
<echo message="Tagging files as ${version.name}-${version.number}"/>
<exec executable="git" failonerror="true" >
<arg line="tag -a -m 'Auto-tag version ${version.number}' ${version.name}-${version.number}"/>
</exec>
</target>
<target name="rel" depends="relbin,relsrc"
description="Create the release directory"/>
<target name="relbin" depends="init">
<mkdir dir="${rel.dir}"/>
<copy todir="${rel.dir}" flatten="true" preservelastmodified="true">
<fileset dir="." includes="${relbin.files}"/>
</copy>
<chmod dir="${rel.dir}" includes="mim" perm="+x"/>
<copy todir="${rel.dir}" file="${lib.jar}"
preservelastmodified="true"/>
<copy todir="${rel.dir}/doc/api" preservelastmodified="true">
<fileset dir="${apidoc.dir}" includes="**/*"/>
</copy>
</target>
<target name="relsrc" depends="init">
<copy todir="${rel.dir}" preservelastmodified="true">
<fileset dir="." includes="${relsrc.files}"/>
</copy>
</target>
<target name="relapidoczip" depends="init">
<zip basedir="." destfile="${rel.dir}/apidoc.zip"
includes="${apidoc.dir}/**/*"
/>
</target>
<!-- Make the release zip file from the release directory -->
<target name="relzip" depends="init"
description=
"Create the distributable jar file from the release directory">
<zip basedir="${release.dir}" zipfile="${rel.zip}"
includes="${rel.subdir}/**" />
</target>
</project>