-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
237 lines (221 loc) · 10.3 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="dotty-common" default="init" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- set scala3.home -->
<property environment="env" />
<condition property="user.home"
value="${env.USERPROFILE}"
else="${env.HOME}">
<os family="windows" />
</condition>
<property name="ivy.cache" value="${user.home}/.ivy2/cache" />
<condition property="scalafmt.cmd"
value="${env.LOCALAPPDATA}/Coursier/data/bin/scalafmt.bat"
else="${env.HOME}/.local/share/coursier/bin/scalafmt">
<os family="windows" />
</condition>
<property name="cfr.version" value="0.152" />
<property name="akka.version" value="2.10.0" />
<property name="config.version" value="1.4.3" />
<property name="hamcrest.version" value="3.0" />
<property name="junit.version" value="4.13.2" />
<target name="init.local" if="use.local">
<property name="scala3.home" value="${env.SCALA3_HOME}" />
<condition property="dotc.executable"
value="${scala3.home}/bin/scalac.bat"
else="${scala3.home}/bin/scalac">
<os family="windows" />
</condition>
<fail message="Scala 3 compiler not found">
<condition><not>
<available file="${dotc.executable}" />
</not></condition>
</fail>
<echo message="SCALA3_HOME=${scala3.home}" />
<path id="scalac.classpath">
<fileset dir="${scala3.home}/lib" includes="jline-*.jar" />
<fileset dir="${scala3.home}/lib" includes="scala-*.jar" />
<fileset dir="${scala3.home}/lib" includes="scala3-*.jar" />
<fileset dir="${scala3.home}/lib" includes="scaladoc*.jar" />
<fileset dir="${scala3.home}/lib" includes="tasty-*.jar" />
</path>
<path id="scala3.classpath">
<fileset dir="${scala3.home}/lib" includes="scala-library*.jar" />
<fileset dir="${scala3.home}/lib" includes="scala3-library*.jar" />
</path>
</target>
<target name="init.ivy" unless="use.local">
<!-- installed: C:/opt/apache-ant-1.10.10/lib/ivy-2.5.0.jar -->
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" />
<ivy:resolve file="../../ivy.xml" showprogress="false" log="download-only" />
<ivy:cachepath pathid="scalac.classpath" conf="default"/>
<path id="scala3.classpath">
<!--
<fileset dir="${ivy.cache}/ch.epfl.lamp" includes="**/jars/dotty-library*.jar">
<filename regex="_0\.(1[8-9]|2[0-9])-0\.(1[8-9]|2[0-9])\.[0-9]+" /> // e.g. _0.25-0.25.x
</fileset>
-->
<fileset dir="${ivy.cache}/org.scala-lang" includes="**/jars/scala3-library*.jar">
<filename regex="_3-3\.[0-9]\.[0-9](-RC[1-9])?" /> <!-- e.g. _3.0.0-RC1-3.0.0-RC1 -->
</fileset>
<fileset dir="${ivy.cache}/org.scala-lang" includes="**/jars/scala-library*.jar">
<filename regex="-2\.[1-2][3-9]\.[0-9]+" /> <!-- e.g. -2.13.x -->
</fileset>
</path>
<pathconvert property="scala3.classpath.prop" refid="scala3.classpath"/>
<echo message="scala3.classpath=${scala3.classpath.prop}" level="verbose" />
</target>
<target name="init" depends="init.local, init.ivy">
<path id="build.classpath">
<fileset dir="${ivy.cache}/org.scala-lang/scala-library" includes="**/jars/scala-library-2.13.15.jar" />
<fileset dir="${ivy.cache}/com.typesafe/config" includes="**/config-${config.version}.jar" />
<fileset dir="${ivy.cache}/com.typesafe.akka" includes="**/jars/akka-actor_2.13-${akka.version}.jar" />
<pathelement location="${build.dir}" />
</path>
<path id="basedir.ref">
<pathelement location="${basedir}"/>
</path>
<pathconvert property="cfr.jar">
<fileset dir="${ivy.cache}/org.benf" includes="**/cfr-${cfr.version}.jar" />
</pathconvert>
<path id="test.classpath">
<path refid="build.classpath" />
<pathelement location="${test-build.dir}" />
</path>
</target>
<macrodef name="dotc" >
<attribute name="srcdir" default="." />
<attribute name="destdir" default="." />
<attribute name="classpathref" default="basedir.ref" />
<sequential>
<!-- local properties -->
<local name="classpath"/>
<local name="n"/>
<local name="quoted"/>
<local name="s"/>
<local name="scala.sources"/>
<pathconvert property="scala.sources" pathsep=" ">
<fileset dir="@{srcdir}" includes="**/*.scala" />
</pathconvert>
<resourcecount property="n">
<fileset dir="@{srcdir}" includes="**/*.scala" />
</resourcecount>
<condition property="s" value="s" else="">
<not><matches string="${n}" pattern="[0-1]" /></not>
</condition>
<!--
<exec executable="echo" taskname="scalac">
<arg value="Compiling ${n} source file${s} to @{destdir}" />
</exec>
-->
<echo message="Compiling ${n} source file${s} to @{destdir}" level="info" />
<pathconvert property="classpath" refid="@{classpathref}" />
<condition property="quoted" value=""" else="">
<contains string="${classpath}" substring=" " />
</condition>
<java fork="true" classname="dotty.tools.dotc.Main" classpathref="scalac.classpath">
<jvmarg value="-Xmx768m" />
<jvmarg value="-Xms768m" />
<jvmarg value="-Dscala.usejavacp=true" />
<arg value="-deprecation" />
<arg value="-d" />
<arg value="@{destdir}" />
<arg value="-classpath" />
<arg value="${quoted}${classpath}${quoted}" />
<arg line="${scala.sources}" />
</java>
</sequential>
</macrodef>
<macrodef name="dotd" >
<attribute name="srcdir" default="." />
<attribute name="destdir" default="." />
<attribute name="classpathref" default="basedir.ref" />
<sequential>
<!-- local properties -->
<local name="classpath"/>
<local name="n"/>
<local name="quoted"/>
<local name="s"/>
<local name="tasty.files"/>
<pathconvert property="tasty.files" pathsep=" ">
<fileset dir="@{srcdir}" includes="**/*.tasty" />
</pathconvert>
<resourcecount property="n">
<fileset dir="@{srcdir}" includes="**/*.tasty" />
</resourcecount>
<condition property="s" value="s" else="">
<not><matches string="${n}" pattern="[0-1]" /></not>
</condition>
<echo message="Compiling ${n} TASTY file${s} to @{destdir}" level="info" />
<pathconvert property="classpath" refid="@{classpathref}" />
<condition property="quoted" value=""" else="">
<contains string="${classpath}" substring=" " />
</condition>
<java fork="true" classname="dotty.tools.scaladoc.Main" classpathref="scalac.classpath">
<jvmarg value="-Xmx768m" />
<jvmarg value="-Xms768m" />
<jvmarg value="-Dscala.usejavacp=true" />
<arg value="-d" />
<arg value="@{destdir}" />
<arg value="-classpath" />
<arg value="${quoted}${classpath}${quoted}" />
<arg value="-project" />
<arg value="${ant.project.name}" />
<arg line="${tasty.files}" />
</java>
</sequential>
</macrodef>
<macrodef name="cfr" >
<attribute name="srcdir" default="." />
<attribute name="destdir" default="." />
<attribute name="classpathref" default="basedir.ref" />
<sequential>
<!-- local properties -->
<local name="classpath"/>
<local name="n"/>
<local name="quoted"/>
<local name="s"/>
<local name="class.files"/>
<pathconvert property="class.files" pathsep=" ">
<fileset dir="@{srcdir}" includes="**/*.class" />
</pathconvert>
<resourcecount property="n">
<fileset dir="@{srcdir}" includes="**/*.class" />
</resourcecount>
<condition property="s" value="" else="s">
<matches string="${n}" pattern="[0-1]" />
</condition>
<echo message="Decompiling ${n} class file${s} to @{destdir}" level="info" />
<pathconvert property="classpath" refid="@{classpathref}" />
<condition property="quoted" value=""" else="">
<contains string="${classpath}" substring=" " />
</condition>
<java fork="true" jar="${cfr.jar}">
<arg value="--outputdir" />
<arg value="@{destdir}" />
<arg value="--extraclasspath" />
<arg value="${quoted}${classpath}${quoted}" />
<arg line="${class.files}" />
</java>
</sequential>
</macrodef>
<target name="test.install">
<ivy:resolve file="../../ivy-test.xml" showprogress="false" log="download-only" />
<ivy:install
organisation="junit" module="junit" revision="${junit.version}"
transitive="true" overwrite="true" from="public" to="local"
/>
<ivy:install
organisation="org.hamcrest" module="hamcrest" revision="${hamcrest.version}"
transitive="true" overwrite="true" from="public" to="local"
/>
</target>
<target name="test.init" depends="init, test.install">
<path id="test.build.classpath">
<fileset dir="${ivy.cache}/org.scala-lang/scala-library" includes="**/jars/scala-library-2.13.10.jar" />
<fileset dir="${ivy.cache}/com.typesafe/config" includes="**/config-${config.version}.jar" />
<fileset dir="${ivy.cache}/com.typesafe.akka" includes="**/jars/akka-actor_2.13-${akka.version}.jar" />
<path id="build.classpath" />
</path>
</target>
</project>