forked from gmantele/vollt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildADQL.xml
156 lines (130 loc) · 7.23 KB
/
buildADQL.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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="adql" basedir="." default="buildLib">
<property name="version" value="1.5-1" />
<property name="srcDir" value="src" />
<property name="testDir" value="test" />
<property name="compileDir" value="antBuild" />
<property name="junitBuildDir" value="junitBuild" />
<property name="classesDir" value="${compileDir}"/>
<property name="javadocDir" value="javadoc/adql" />
<property name="adqlPath" value="adql/**" />
<property name="utilsPath" value="cds/utils/**" />
<property name="licensePath" value="COPYING.LESSER" />
<property name="includesList" value="${adqlPath},${utilsPath},${licensePath}" />
<property name="jarDest" value="." />
<property name="libJarFile" value="${jarDest}/adql_${version}.jar" />
<property name="adqlParserJarFile" value="${jarDest}/adqlParser_${version}.jar" />
<property name="srcJarFile" value="${jarDest}/adql_src_${version}.jar" />
<property name="javadocJarFile" value="${jarDest}/adql_javadoc_${version}.jar" />
<property name="adqlParserLink" value="adqlParser.jar" />
<property name="testsDir" value="test" />
<property name="junitReportsDir" value="reports/adql" />
<fail message="The property POSTGRES must be set! It provides the path toward a directory or a JAR which contains all classes inside org.postgresql.">
<condition><not><isset property="POSTGRES"/></not></condition>
</fail>
<fail message="The property JUNIT-API must be set! It provides the path toward a directory or a JAR which contains all classes needed to use JUnit.">
<condition><not><isset property="JUNIT-API"/></not></condition>
</fail>
<!-- JAVA VERSION COMPATIBILITY -->
<property name="ant.build.javac.source" value="1.7"/>
<property name="ant.build.javac.target" value="1.7"/>
<!-- CLASSPATHS -->
<path id="adql.classpath">
<pathelement location="${POSTGRES}" />
</path>
<path id="junit.class.path">
<path refid="adql.classpath" />
<pathelement path="${JUNIT-API}" />
<pathelement location="bin" />
</path>
<!-- START -->
<echo>ADQL LIBRARY VERSION = ${version}</echo>
<!-- BUILD ALL TASK -->
<target name="buildAll" depends="buildLibAndSrc,buildJavadoc"
description="Build four JARs: the library (classes), the runnable ADQL parser, its sources and its Javadoc. Then, except the JAR, all the compiled javadoc files are deleted." >
<antcall target="cleanJavadocBuild" />
</target>
<target name="cleanAll" depends="clean,cleanJUnitReports,cleanJavadoc" description="Delete all files generated by this ANT file for the set version." />
<!-- JUNIT VALIDATION -->
<target name="cleanJUnitReports" description="Clean the JUnit reports directory of the ADQL library ONLY.">
<delete dir="${junitReportsDir}" failonerror="false" />
</target>
<target name="junitValidation" depends="cleanJUnitReports,compileJUnit" description="Executes all JUnit tests before building the library and stop ANT at any error.">
<mkdir dir="${junitReportsDir}"/>
<junit errorproperty="adqlTestsFailure" failureproperty="adqlTestsFailure">
<classpath refid="junit.class.path" />
<classpath>
<pathelement location="${compileDir}" />
<pathelement location="${junitBuildDir}" />
</classpath>
<formatter type="brief" usefile="yes" />
<batchtest todir="${junitReportsDir}">
<fileset dir="${testsDir}" includes="adql/**/Test*.java" />
</batchtest>
</junit>
<delete dir="${junitBuildDir}" failonerror="false" />
<fail if="${adqlTestsFailure}" message="Failed JUnit validation for ADQL Lib.!" />
</target>
<target name="compileJUnit" depends="compileLib" description="Build all the classes to test the ADQL library.">
<mkdir dir="${junitBuildDir}" />
<javac destdir="${junitBuildDir}" includes="${includesList}" includeantruntime="false" encoding="utf8" bootclasspath="${adql.bootclasspath}" debug="true">
<src path="${testDir}" />
<classpath refid="junit.class.path" />
<classpath refid="adql.classpath" />
<classpath>
<pathelement location="${compileDir}" />
</classpath>
</javac>
</target>
<!-- LIB & SOURCES -->
<target name="clean" description="Delete the JARs for the library (classes), the runnable ADQL parser and for its sources for the set version.">
<delete file="${libJarFile}" failonerror="false" />
<delete file="${srcJarFile}" failonerror="false" />
<delete file="${adqlParserJarFile}" failonerror="false" />
<symlink action="delete" link="${adqlParserLink}" failonerror="false" />
<delete dir="${compileDir}" failonerror="false" />
<delete dir="${junitBuildDir}" failonerror="false" />
</target>
<target name="compileLib" depends="clean" description="Build all the classes of the ADQL library. This target is particularly usefull because it lets highlighting missing dependencies.">
<mkdir dir="${compileDir}" />
<javac destdir="${compileDir}" srcdir="${srcDir}" includes="${includesList}" includeantruntime="false" encoding="utf8" bootclasspath="${adql.bootclasspath}" debug="true">
<classpath refid="adql.classpath" />
</javac>
</target>
<target name="buildLib" depends="compileLib,junitValidation" description="After 'clean', build the library JAR (only classes) and the runnable ADQL parser.">
<echo>Generate the library:</echo>
<jar basedir="${classesDir}" destfile="${libJarFile}" includes="${includesList}" />
<echo>Generate the ADQL parser:</echo>
<jar basedir="${classesDir}" destfile="${adqlParserJarFile}" filesetmanifest="mergewithoutmain" includes="${includesList}">
<manifest>
<attribute name="Main-Class" value="adql.parser.ADQLParser"/>
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
<echo>And its symbolic link:</echo>
<symlink action="single" link="${adqlParserLink}" resource="${adqlParserJarFile}" failonerror="false" />
<echo>Delete compiled classes:</echo>
<delete dir="${compileDir}" failonerror="true" />
</target>
<target name="buildLibAndSrc" depends="buildLib" description="After 'clean' and 'buildLib', build the sources JAR (only .java).">
<jar compress="false" destfile="${srcJarFile}">
<zipfileset dir="${srcDir}" includes="${includesList},${licensePath}" prefix="${srcDir}" />
</jar>
</target>
<!-- JAVADOC -->
<target name="cleanJavadocBuild" description="Delete the whole generated/compiled Javadoc directory.">
<delete dir="${javadocDir}" failonerror="false" />
</target>
<target name="cleanJavadoc" depends="cleanJavadocBuild" description="Delete the Javadoc JAR AND the whole generated/compiled Javadoc directory.">
<delete file="${jarDest}/${javadocJarFile}" failonerror="false" />
</target>
<target name="compileJavadoc" depends="cleanJavadoc" description="After 'cleanJavadoc', compile the whole Javadoc.">
<javadoc encoding="utf-8" charset="utf-8" docencoding="utf-8" access="protected" author="true" classpath="." destdir="${javadocDir}" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.7" splitindex="true" use="true" version="true">
<packageset dir="${srcDir}" includes="${includesList}" />
</javadoc>
</target>
<target name="buildJavadoc" depends="compileJavadoc" description="After 'compileJavadoc', build the Javadoc JAR.">
<jar destfile="${javadocJarFile}" basedir="${javadocDir}" />
</target>
</project>