forked from ceylon/ceylon-module-resolver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
199 lines (176 loc) · 8.07 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
<project name="Ceylon module-resolver 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"/>
<property name="test.reports" location="${build.dir}/test-reports"/>
<!-- The Java source files for the module-resolver -->
<property name="cmr-api.src" location="${basedir}/api/src/main/java"/>
<property name="cmr-impl.src" location="${basedir}/impl/src/main/java"/>
<property name="cmr-spi.src" location="${basedir}/spi/src/main/java"/>
<property name="cmr-webdav.src" location="${basedir}/webdav/src/main/java"/>
<!-- jar generated -->
<property name="module-resolver.jar" location="${build.lib}/module-resolver.jar"/>
<property name="cmr-impl-test.src" location="${basedir}/impl/src/test/java"/>
<property name="cmr-impl-test.resources" location="${basedir}/impl/src/test/resources"/>
<tstamp/>
<!-- Local repositoryManager -->
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo"/>
<!-- ceylon.module-resolver -->
<property name="module.module-resolver.dir" value="com/redhat/ceylon/module-resolver"/>
<property name="module.module-resolver.name" value="com.redhat.ceylon.module-resolver"/>
<!-- module archives -->
<property name="ceylon.module-resolver.dir"
value="${module.module-resolver.dir}/${module.module-resolver.version}"/>
<property name="ceylon.module-resolver.src"
value="${ceylon.module-resolver.dir}/${module.module-resolver.name}-${module.module-resolver.version}.src"/>
<property name="ceylon.module-resolver.jar"
value="${ceylon.module-resolver.dir}/${module.module-resolver.name}-${module.module-resolver.version}.jar"/>
<property name="ceylon.module-resolver.repo" value="${ceylon.repo.dir}/${ceylon.module-resolver.dir}"/>
<property name="ceylon.module-resolver.dist" value="${build.dist}/${ceylon.module-resolver.dir}"/>
<path id="compiler.classpath">
<pathelement path="${jandex.lib}"/>
<pathelement path="${sardine.lib}"/>
<pathelement path="${httpclient.lib}"/>
<pathelement path="${httpcore.lib}"/>
</path>
<path id="test.build.classpath">
<path refid="compiler.classpath"/>
<pathelement path="${build.classes}"/>
<pathelement path="${junit.lib}"/>
</path>
<path id="test.run.classpath">
<path refid="test.build.classpath"/>
<pathelement path="${cmr-impl-test.resources}"/>
<pathelement path="${build.test}"/>
<pathelement path="${httpclient.lib}"/>
<pathelement path="${httpcore.lib}"/>
<pathelement path="${commons-logging.lib}"/>
<pathelement path="${slf4j.lib}"/>
<pathelement path="${slf4j.simple}"/>
</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}"/>
<delete dir="${cmr-impl-test.resources}/repo/com"/>
</target>
<target name="dist"
depends="build"
description="Create Ceylon module-resolver distribution">
<mkdir dir="${ceylon.module-resolver.dist}"/>
<zip destfile="${build.dist}/${ceylon.module-resolver.src}">
<fileset dir="${cmr-api.src}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${cmr-impl.src}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${cmr-spi.src}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${cmr-webdav.src}">
<include name="**/*.java"/>
</fileset>
</zip>
<antcall target="sha1sum">
<param name="file" value="${build.dist}/${ceylon.module-resolver.src}"/>
</antcall>
<copy file="${module-resolver.jar}" tofile="${build.dist}/${ceylon.module-resolver.jar}"/>
<antcall target="sha1sum">
<param name="file" value="${build.dist}/${ceylon.module-resolver.jar}"/>
</antcall>
</target>
<!-- Repository targets -->
<target name="publish"
depends="dist,clean.repo,init.repo"
description="Publish Ceylon module-resolver module to default repo">
<copy todir="${ceylon.module-resolver.repo}">
<fileset dir="${ceylon.module-resolver.dist}"/>
</copy>
</target>
<target name="init.repo"
description="Create default local Ceylon module repositoryManager">
<mkdir dir="${ceylon.module-resolver.repo}"/>
</target>
<target name="clean.repo"
description="Clean default local Ceylon module repositoryManager">
<delete dir="${ceylon.module-resolver.repo}"/>
</target>
<!-- Tasks related to building the module-resolver -->
<!-- Rule to build module-resolver classes from their Java sources -->
<target name="module-resolver.classes">
<mkdir dir="${build.classes}"/>
<javac debug="true"
srcdir="${cmr-spi.src}"
destdir="${build.classes}"
classpathref="compiler.classpath"
includeantruntime="false"/>
<javac debug="true"
srcdir="${cmr-api.src}"
destdir="${build.classes}"
classpathref="compiler.classpath"
includeantruntime="false"/>
<javac debug="true"
srcdir="${cmr-impl.src}"
destdir="${build.classes}"
classpathref="compiler.classpath"
includeantruntime="false"/>
<javac debug="true"
srcdir="${cmr-webdav.src}"
destdir="${build.classes}"
classpathref="compiler.classpath"
includeantruntime="false"/>
</target>
<!-- Rule to build module-resolver jar -->
<target name="module-resolver.jar" depends="module-resolver.classes">
<mkdir dir="${build.lib}"/>
<jar destfile="${module-resolver.jar}">
<fileset dir="${build.classes}">
</fileset>
</jar>
</target>
<!-- Rule to compile and test -->
<target name="build" depends="module-resolver.jar"/>
<target name="compile.tests" depends="build">
<mkdir dir="${build.test}"/>
<javac debug="true"
srcdir="${cmr-impl-test.src}"
destdir="${build.test}"
classpathref="test.build.classpath"
includeantruntime="false"/>
</target>
<target name="test" depends="compile.tests" description="Runs the JUnit tests">
<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="${cmr-impl-test.src}">
<include name="**/*TestCase.java"/>
</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>