forked from eclipse-archived/ceylon-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.xml
More file actions
222 lines (195 loc) · 8.99 KB
/
common.xml
File metadata and controls
222 lines (195 loc) · 8.99 KB
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
<project>
<echo message="${ant.project.name} basedir:${basedir}, build: ${build}"/>
<property environment="env"/>
<condition property="ceylon.repo.dir">
<isset property="${env.CEYLON_HOME}" />
</condition>
<property file="../build.properties"/>
<property name="module.build.properties" value="${ant.project.name}.build.properties"/>
<property file="${ant.project.name}.build.properties"/>
<!-- usually the modules build properties don't need to set a module.name
because the following default just works, but not for sdk-test -->
<property name="module.name" value="ceylon.${ant.project.name}"/>
<!-- set these if not already set by the master build.xml.
build dir is different if you do a top-level build or a module specific
build. This allows you to build each module independently.
But only if you've done a top-level ant build first, so the
repo.dependencies repo is populated -->
<property name="build" location="../build"/>
<property name="build.modules" location="${build}/modules"/>
<property name="repo.out" location="${build}/modules"/>
<property name="test.reports" location="${build}/test-reports"/>
<property name="repo.dependencies" location="../build/modules"/>
<propertyset id="props.debug">
<propertyref name="ant.project.name"/>
<propertyref name="basedir"/>
<propertyref name="build"/>
<propertyref prefix="build."/>
<propertyref prefix="module."/>
<propertyref prefix="repo."/>
<propertyref prefix="ceylon."/>
<propertyref prefix="publish.repo"/>
<propertyref prefix="publish.username"/>
</propertyset>
<condition property="tests.exist">
<resourceexists>
<file file="test"/>
</resourceexists>
</condition>
<path id="ant-tasks">
<pathelement location="${ceylon.ant.lib}"/>
</path>
<taskdef name="ceylonc" classname="com.redhat.ceylon.ant.Ceylonc" classpathref="ant-tasks"/>
<taskdef name="ceylond" classname="com.redhat.ceylon.ant.Ceylond" classpathref="ant-tasks"/>
<taskdef name="ceylon" classname="com.redhat.ceylon.ant.Ceylon" classpathref="ant-tasks"/>
<taskdef name="ceylonmd" classname="com.redhat.ceylon.ant.CeylonModuleDescriptorTask" classpathref="ant-tasks"/>
<target name="clean-module"
description="Deletes the build directory">
<echo message="${ant.project.name} clean basedir:${basedir}, build: ${build}"/>
<delete dir="${build}"/>
</target>
<target name="-init">
<echo message="${ant.project.name} -init basedir:${basedir}, build: ${build}"/>
<mkdir dir="${build}"/>
<ceylonmd versionProperty="module.version" module="${module.name}"/>
<fail unless="module.version"
message="${module.build.properties} didn't specify a module.version property and the module descriptors version couldn't be found either"/>
</target>
<target name="compile-module" depends="-init"
description="Compiles the module">
<echo message="${ant.project.name} compile basedir:${basedir}, build: ${build}"/>
<!--echoproperties>
<propertyset refid="props.debug"/>
</echoproperties-->
<ceylonc executable="${basedir}/../../ceylon-dist/dist/bin/ceylon"
out="${repo.out}"
user="${publish.username}"
pass="${publish.password}">
<rep url="${repo.dependencies}"/>
<module name="${module.name}"/>
</ceylonc>
</target>
<extension-point name="setup-test-module"/>
<target name="test-module" depends="compile-module,setup-test-module" if="tests.exist"
description="Compiles and runs the test module, if it exists">
<echo message="${ant.project.name} test basedir:${basedir}, build: ${build}"/>
<!--echoproperties>
<propertyset refid="props.debug"/>
</echoproperties-->
<!-- compile the tests -->
<ceylonc executable="${basedir}/../../ceylon-dist/dist/bin/ceylon"
src="test"
out="${repo.out}">
<rep url="${repo.dependencies}"/>
<module name="test.${module.name}"/>
</ceylonc>
<!-- Run the tests -->
<ceylon executable="${basedir}/../../ceylon-dist/dist/bin/ceylon"
run="test.${module.name}.run" module="test.${module.name}/${module.version}">
<rep url="${repo.dependencies}"/>
<rep url="${repo.out}"/>
</ceylon>
</target>
<target name="doc-module" depends="-init"
description="Generates module API documentation">
<echo message="${ant.project.name} doc basedir:${basedir}, build: ${build}"/>
<!--echoproperties>
<propertyset refid="props.debug"/>
</echoproperties-->
<ceylond executable="${basedir}/../../ceylon-dist/dist/bin/ceylon"
out="${repo.out}"
user="${publish.username}"
pass="${publish.password}">
<rep url="${repo.dependencies}"/>
<module name="${module.name}"/>
</ceylond>
</target>
<target name="local-module" depends="-init"
description="Publishes the module locally (~/.ceylon/repo)">
<echo message="${ant.project.name} local-module basedir:${basedir}, build: ${build}"/>
<!--echoproperties>
<propertyset refid="props.debug"/>
</echoproperties-->
<property name="publish.repo" value="${user.home}/.ceylon/repo"/>
<!-- first check the module tests docs ok -->
<antcall target="clean-module">
<param name="repo.out" value="${build.modules}"/>
</antcall>
<antcall target="test-module">
<param name="repo.out" value="${build.modules}"/>
<!-- we need to be able to build with dependencies already deployed -->
<param name="repo.dependencies" value="${publish.repo}"/>
</antcall>
<antcall target="doc-module">
<param name="repo.out" value="${build.modules}"/>
<!-- we need to be able to build with dependencies already deployed -->
<param name="repo.dependencies" value="${publish.repo}"/>
</antcall>
<!-- if we got this far we're good -->
<antcall target="compile-module">
<param name="repo.out" value="${publish.repo}"/>
<param name="repo.dependencies" value="${publish.repo}"/>
</antcall>
<antcall target="doc-module">
<param name="repo.out" value="${publish.repo}"/>
<param name="repo.dependencies" value="${publish.repo}"/>
</antcall>
<zip destfile="${publish.repo}/ceylon/${ant.project.name}/${module.version}.zip">
<fileset dir="${publish.repo}"
includes="ceylon/${ant.project.name}/${module.version}/**/*"/>
</zip>
</target>
<target name="herd-module" depends="compile-module, doc-module"
description="Publishes the module to the Herd">
<echo message="${ant.project.name} herd-module basedir:${basedir}, build: ${build}"/>
<!--echoproperties>
<propertyset refid="props.debug"/>
</echoproperties-->
<input message="modules.ceylon-lang.org username:>" addproperty="upload.username"/>
<input message="modules.ceylon-lang.org password:>" addproperty="upload.password">
<handler classname="org.apache.tools.ant.input.SecureInputHandler"/>
</input>
<input message="Upload URL:" addproperty="upload.url"/>
<property name="publish.repo" value="https://modules.ceylon-lang.org/modules"/>
<!-- first check the module tests docs ok -->
<antcall target="clean-module">
<param name="repo.out" value="${build.modules}"/>
</antcall>
<antcall target="test-module">
<param name="repo.out" value="${build.modules}"/>
<!-- we need to be able to build with dependencies already deployed -->
<param name="repo.dependencies" value="${publish.repo}"/>
</antcall>
<antcall target="doc-module">
<param name="repo.out" value="${build.modules}"/>
<!-- we need to be able to build with dependencies already deployed -->
<param name="repo.dependencies" value="${publish.repo}"/>
</antcall>
<!-- if we got this far we're good -->
<!--<property name="publish.repo" value="https://modules.ceylon-lang.org/modules"/>-->
<antcall target="compile-module">
<param name="repo.out" value="${upload.url}"/>
<param name="repo.dependencies" value="${publish.repo}"/>
<param name="publish.username" value="${upload.username}"/>
<param name="publish.password" value="${upload.password}"/>
</antcall>
<antcall target="doc-module">
<param name="repo.out" value="${upload.url}"/>
<param name="repo.dependencies" value="${publish.repo}"/>
<param name="publish.username" value="${upload.username}"/>
<param name="publish.password" value="${upload.password}"/>
</antcall>
<!--<echo message="${ant.project.name} publish basedir:${basedir}, build: ${build}"/>
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo"/>
<property name="publish.dir" location="${ceylon.repo.dir}/"/>-->
<!-- TODO When publishing to Herd we want to:
1 Check everything is in git
2 Test and doc locally
3 Create a git tag locally
4 publish to Herd
5 Push the tag
6 Increment the module version
7 Commit and push the module descriptor change
-->
</target>
</project>