-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.xml
184 lines (151 loc) · 7.28 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="ozma" default="build">
<description>
Ozma is a language based on Scala, with extensions wrt declarative concurrency. It uses Mozart as a back-end.
</description>
<!-- ===========================================================================
END-USER TARGETS
============================================================================ -->
<target name="build" depends="build.done"
description="Builds the Ozma compiler and library. Executables are in 'bin'."/>
<target name="build-opt"
description="Builds the optimised Ozma compiler and library. Executables are in 'bin'.">
<antcall target="build">
<param name="scalac.args.optimise" value="-optimise"/>
</antcall>
</target>
<target name="clean" depends="build.clean"
description="Removes binaries of compiler and library. Distributions are untouched."/>
<!-- ===========================================================================
PROPERTIES
============================================================================ -->
<property environment="env"/>
<property name="scala.home" value="${env.SCALA_HOME}"/>
<!-- Defines the repository layout -->
<property name="src.dir" value="${basedir}/src"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="bin.dir" value="${basedir}/bin"/>
<property name="build.library.dir" value="${classes.dir}/library"/>
<property name="build.compiler.dir" value="${classes.dir}/compiler"/>
<property name="build.ozastc.dir" value="${build.dir}/ozastc"/>
<property name="build.runtime.dir" value="${build.dir}/runtime"/>
<property name="build.engine.dir" value="${build.dir}/engine"/>
<property name="bin.ozc" value="ozc"/>
<property name="bin.ozastc" value="${bin.dir}/ozastc"/>
<property name="bin.ozmac" value="${bin.dir}/ozmac"/>
<property name="bin.ozma" value="${bin.dir}/ozma"/>
<!-- Loads custom properties definitions -->
<property file="${basedir}/build.properties"/>
<!-- Additional command line arguments for scalac. They are added to all build targets -->
<property name="scalac.args" value=""/>
<property name="javac.args" value=""/>
<property name="copyright.string" value="Copyright 2011, Sébastien Doeraene"/>
<property name="scala-library.jar"
value="${scala.home}/lib/scala-library.jar"/>
<property name="scala-compiler.jar"
value="${scala.home}/lib/scala-compiler.jar"/>
<path id="build.classpath">
<pathelement location="${scala-library.jar}"/>
<pathelement location="${scala-compiler.jar}"/>
</path>
<!-- if ANT_OPTS is already set by the environment, it will be unaltered,
but if it is unset it will take this default value. -->
<property name="env.ANT_OPTS" value="-Xms1536M -Xmx1536M -Xss1M -XX:MaxPermSize=192M -XX:+UseParallelGC" />
<property name="scalacfork.jvmargs" value="${env.ANT_OPTS} ${jvm.opts}"/>
<!-- ===========================================================================
INITIALISATION
============================================================================ -->
<target name="init">
<!-- scalac.args.optimise is selectively overridden in certain antcall tasks. -->
<property name="scalac.args.optimise" value=""/>
<property name="scalac.args.all" value="${scalac.args} ${scalac.args.optimise}"/>
<!-- Setting-up Scala-specific tasks -->
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${scala.home}/lib/scala-compiler.jar"/>
<pathelement location="${scala-library.jar}"/>
</classpath>
</taskdef>
<!-- This is the start time for the distribution -->
<tstamp prefix="time">
<format property="human" pattern="d MMMM yyyy, HH:mm:ss"/>
<format property="short" pattern="yyyyMMddHHmmss"/>
</tstamp>
</target>
<!-- ===========================================================================
ACTUAL TASKS
============================================================================ -->
<target name="build.library" depends="init">
<mkdir dir="${build.library.dir}"/>
<scalac srcdir="${src.dir}/library" destdir="${build.library.dir}"
classpathref="build.classpath"
addparams="${scalac.args.all}">
<include name="**/*.scala"/>
</scalac>
</target>
<target name="build.compiler" depends="init,build.library">
<mkdir dir="${build.compiler.dir}"/>
<scalac srcdir="${src.dir}/compiler" destdir="${build.compiler.dir}"
classpathref="build.classpath"
addparams="${scalac.args.all}">
<include name="**/*.scala"/>
</scalac>
</target>
<target name="build.ozastc" depends="init">
<mkdir dir="${build.ozastc.dir}"/>
<apply executable="${bin.ozc}" dest="${build.ozastc.dir}" parallel="false"
failonerror="true">
<globmapper from="*.oz" to="*.ozf"/>
<arg value="-c"/> <srcfile/> <arg value="-o"/> <targetfile/>
<fileset dir="${src.dir}/ozastc" includes="*.oz" excludes="ASTPatch.oz"/>
</apply>
</target>
<target name="build.runtime" depends="build.compiler,build.ozastc">
<!-- ozc does not like when its destination dir does not exist -->
<mkdir dir="${build.runtime.dir}/java/lang"/>
<mkdir dir="${build.runtime.dir}/scala/runtime"/>
<!-- compile native functors -->
<apply executable="${bin.ozc}" dest="${build.runtime.dir}" parallel="false"
failonerror="true">
<globmapper from="*.oz" to="*.ozf"/>
<arg value="-c"/> <srcfile/> <arg value="-o"/> <targetfile/>
<fileset dir="${src.dir}/javalib" includes="**/*.oz"/>
<fileset dir="${src.dir}/scalalib" includes="**/*.oz"/>
</apply>
<!-- compile classes written in Ozma (part 1) -->
<apply executable="${bin.ozmac}" dest="${build.runtime.dir}"
parallel="false" failonerror="true">
<globmapper from="*.scala" to="*.ozf"/>
<env key="JAVA_OPTS" value="${env.ANT_OPTS}"/>
<arg value="-d"/> <arg path="${build.runtime.dir}"/> <srcfile/>
<fileset dir="${src.dir}/scalalib" includes="scala/runtime/BoxedUnit.scala"/>
</apply>
<!-- compile classes written in Ozma (part 2) -->
<apply executable="${bin.ozmac}" dest="${build.runtime.dir}"
parallel="true" failonerror="true">
<globmapper from="*.scala" to="*.ozf"/>
<env key="JAVA_OPTS" value="${env.ANT_OPTS}"/>
<arg value="-d"/> <arg path="${build.runtime.dir}"/> <srcfile/>
<fileset dir="${src.dir}/javalib" includes="**/*.scala"/>
<fileset dir="${src.dir}/scalalib" includes="**/*.scala"
excludes="scala/runtime/BoxedUnit.scala"/>
<fileset dir="${src.dir}/library" includes="**/*.scala"/>
</apply>
</target>
<target name="build.engine" depends="init">
<mkdir dir="${build.engine.dir}"/>
<apply executable="${bin.ozc}" dest="${build.engine.dir}" parallel="false"
failonerror="true">
<globmapper from="*.oz" to="*.ozf"/>
<arg value="-c"/> <srcfile/> <arg value="-o"/> <targetfile/>
<fileset dir="${src.dir}/engine" includes="*.oz"/>
</apply>
</target>
<target name="build.done" depends="build.library,build.compiler,build.ozastc,build.runtime,build.engine"/>
<target name="build.clean" depends="init">
<delete includeemptydirs="true">
<fileset dir="${build.dir}" includes="**/*"/>
</delete>
</target>
</project>