forked from ceylon/ceylon.language
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
206 lines (180 loc) · 8.02 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
<project name="Ceylon Language module" default="publish" basedir=".">
<property file="build.properties"/>
<!-- Set build directories for all formats. -->
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.dist" location="${build.dir}/dist"/>
<property name="build.lib" location="${build.dir}/lib"/>
<property name="build.test" location="${build.dir}/test"/>
<!-- The Java and Ceylon source files for the runtime -->
<property name="runtime.src" location="runtime"/>
<!-- jar generated -->
<property name="runtime.jar" location="${build.lib}/runtime.jar"/>
<property name="test.src" location="test"/>
<property name="test.reports" location="${build.dir}/test-reports"/>
<tstamp/>
<!-- Local repository -->
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo"/>
<!-- ceylon.language -->
<property name="module.language.src" value="${basedir}/src"/>
<property name="module.language.dir" value="ceylon/language"/>
<property name="module.language.name" value="ceylon.language"/>
<property name="module.language.runtime" value="${basedir}/runtime"/>
<!-- module archives -->
<property name="ceylon.language.dir" value="${module.language.dir}/${module.ceylon.language.version}"/>
<property name="ceylon.language.src" value="${ceylon.language.dir}/${module.language.name}-${module.ceylon.language.version}.src"/>
<property name="ceylon.language.car" value="${ceylon.language.dir}/${module.language.name}-${module.ceylon.language.version}.car"/>
<property name="ceylon.language.repo" value="${ceylon.repo.dir}/${ceylon.language.dir}"/>
<property name="ceylon.language.dist" value="${build.dist}/${ceylon.language.dir}"/>
<property name="ceylon.compiler.loc" value="${basedir}/../ceylon-compiler"/>
<property name="ceylon.compiler.dir" value="com/redhat/ceylon/compiler/java/${module.com.redhat.ceylon.compiler.version}"/>
<property name="ceylon.compiler.jar" value="${ceylon.compiler.dir}/com.redhat.ceylon.compiler.java-${module.com.redhat.ceylon.compiler.version}.jar"/>
<property name="ceylon.compiler.lib" location="${ceylon.repo.dir}/${ceylon.compiler.jar}"/>
<property name="ceylon.ant.dir" value="com/redhat/ceylon/ant/${module.com.redhat.ceylon.compiler.version}"/>
<property name="ceylon.ant.jar" value="${ceylon.ant.dir}/com.redhat.ceylon.ant-${module.com.redhat.ceylon.compiler.version}.jar"/>
<property name="ceylon.ant.lib" location="${ceylon.repo.dir}/${ceylon.ant.jar}"/>
<property name="tests.car" value="${build.test}/default/default.car"/>
<path id="test.compile.classpath">
<pathelement path="${build.classes}"/>
<pathelement path="${junit.lib}"/>
</path>
<path id="test.run.classpath">
<pathelement path="${junit.lib}"/>
<pathelement path="${build.classes}"/>
<pathelement path="${build.test}"/>
</path>
<!-- ################################################################## -->
<!-- constant to declare a file binary for checksumsum -->
<property name="checksum.binary-prefix" value=" *" />
<!-- Helper target, used to create a sha1 checksum file -->
<!-- Requires 'file' as a parameter. -->
<target name="sha1sum">
<fail unless="file"/>
<fail if="filename"/>
<fail if="value"/>
<basename file="${file}" property="filename"/>
<checksum file="${file}" property="value" algorithm="sha1"/>
<echo file="${file}.sha1" message="${value}"/>
</target>
<!-- Rule to clean everything up -->
<target name="clean" description="Clean up everything">
<delete dir="${build.dir}"/>
</target>
<target name="dist"
depends="build"
description="Create Ceylon language distribution">
<mkdir dir="${ceylon.language.dist}"/>
<zip destfile="${build.dist}/${ceylon.language.src}">
<fileset dir="${module.language.src}">
<include name="ceylon/language/**/*.ceylon"/>
</fileset>
<fileset dir="${module.language.runtime}">
<include name="**/*.java"/>
</fileset>
</zip>
<antcall target="sha1sum">
<param name="file" value="${build.dist}/${ceylon.language.src}" />
</antcall>
<copy file="${runtime.jar}" tofile="${build.dist}/${ceylon.language.car}"/>
<antcall target="sha1sum">
<param name="file" value="${build.dist}/${ceylon.language.car}" />
</antcall>
</target>
<!-- Repository targets -->
<target name="publish"
depends="dist,clean.repo,init.repo"
description="Publish Ceylon language module to default repo">
<copy todir="${ceylon.language.repo}">
<fileset dir="${ceylon.language.dist}"/>
</copy>
</target>
<target name="init.repo"
description="Create default local Ceylon module repository">
<mkdir dir="${ceylon.language.repo}"/>
</target>
<target name="clean.repo"
description="Clean default local Ceylon module repository">
<delete dir="${ceylon.language.repo}"/>
</target>
<!-- Tasks related to building the runtime -->
<!-- Rule to build runtime classes from their Java and Ceylon sources -->
<target name="runtime.classes" >
<!--
depends="compiler.jar">
<taskdef name="ceylonc" classname="com.redhat.ceylon.compiler.ant.Ceylonc">
<classpath>
<pathelement location="${compiler.jar}"/>
</classpath>
</taskdef>
<ceylonc
compiler="bin/ceylonc"
srcdir="${runtime.src}"
destdir="${build.classes}"/>
-->
<mkdir dir="${build.classes}"/>
<javac debug="true"
srcdir="${runtime.src}"
destdir="${build.classes}"
includeantruntime="false"/>
</target>
<!-- Rule to build runtime jar -->
<target name="runtime.jar" depends="runtime.classes">
<mkdir dir="${build.lib}"/>
<jar destfile="${runtime.jar}">
<fileset dir="${build.classes}">
<include name="ceylon/**"/>
<include name="com/redhat/ceylon/compiler/java/**"/>
</fileset>
</jar>
</target>
<!-- Rule to compile and test -->
<target name="build" depends="runtime.jar"/>
<target name="ceylonc" depends="build">
<taskdef name="ceylonc" classname="com.redhat.ceylon.ant.Ceylonc" >
<classpath>
<pathelement location="${ceylon.ant.lib}"/>
</classpath>
</taskdef>
</target>
<target name="compile.tests" depends="ceylonc">
<delete dir="${build.test}"/>
<mkdir dir="${build.test}"/>
<ceylonc
executable="${ceylon.compiler.loc}/build/bin/ceylonc"
src="${test.src}"
out="${build.test}">
<files>
<include name="**/*.ceylon"/>
</files>
</ceylonc>
<javac
srcdir="${test.src}"
destdir="${build.test}"
debug="true"
encoding="UTF-8"
classpathref="test.compile.classpath"
includeantruntime="false">
<include name="**/*.java"/>
</javac>
</target>
<target name="test" depends="compile.tests"
description="compile and run the tests">
<java classname="run" classpath="${tests.car};${runtime.jar}"/>
<mkdir dir="${test.reports}"/>
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.run.classpath"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${build.test}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.reports}"/>
</junitreport>
</target>
</project>