build.xml 5.7 KB
Newer Older
1 2
<project name="h2" default="all" basedir=".">

3
	<target name="all" depends="jar">
4 5
	</target>

6
	<target name="clean" depends="init">
7 8 9 10 11 12 13 14 15
		<mkdir dir="bin"/>
		<mkdir dir="docs"/>
		<delete includeemptydirs="true">
			<fileset dir="." includes="*.sql,*.txt,*.lock,**/*.db,node*"/>
			<fileset dir="bin" includes="**/*" excludes="**/*.bat,**/*.sh"/>
			<fileset dir="docs" includes="**/*"/>
		</delete>
	</target>

16
	<target name="compile" depends="switchSourceAuto, resources, download">
17
		<javac destdir="bin" debug="true" debuglevel="lines,source" >
18 19
			<classpath location="ext/servlet-api-2.4.jar" />
		    <classpath location="ext/lucene-core-2.2.0.jar" />
20
		    <classpath location="ext/slf4j-api-1.5.0.jar" />
21 22 23
		    <src path="src/main"/>
	       	<src path="src/test"/>
	       	<src path="src/tools"/>
24
	    </javac>
25
		<copy todir="bin" overwrite="true">
26
			<fileset dir="src/main" includes="META-INF/services/*"/>
27
			<fileset dir="src/installer" includes="*.bat"/>
28
			<fileset dir="src/installer" includes="*.sh"/>
29
			<fileset dir="src/test" excludes="**/*.java,**/package.html"/>
30 31
		</copy>
	</target>
32

33 34 35 36
    <target name="compileCoverage" depends="compile">
		<copy todir="bin" overwrite="true">
			<fileset dir="src/main"/>
		</copy>
37
		<java classname="org.h2.test.coverage.Coverage" classpath="." dir="bin" fork="true">
38
			<arg line="-r org/h2"/>
39
		</java>
40
		<javac srcdir="bin" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/**"/>
41
    </target>
42
    
43
    <target name="download" depends="init" unless="ext.present">
44 45 46 47
        <get dest="ext/servlet-api-2.4.jar"
            src="http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar" />
        <get dest="ext/lucene-core-2.2.0.jar"
            src="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.2.0/lucene-core-2.2.0.jar" />
48 49
        <get dest="ext/slf4j-api-1.5.0.jar"
            src="http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.5.0/slf4j-api-1.5.0.jar" />
50
    </target>
51

52
	<target name="init">
53
		<mkdir dir="ext"/>
54 55 56 57 58 59 60
	    <condition property="ext.present">
			<and>
	  			<available file="ext/servlet-api-2.4.jar"/>
	  			<available file="ext/lucene-core-2.2.0.jar"/>
	  			<available file="ext/slf4j-api-1.5.0.jar"/>
			</and>
		</condition>	    
61
	</target>
62

63
	<target name="jar" depends="compile, manifest">
64
		<manifest file="bin/META-INF/MANIFEST.MF" mode="update">
65
			<attribute name="Main-Class" value="org.h2.tools.Console"/>
66 67 68
		</manifest>
		<jar jarfile="bin/h2.jar" basedir="bin" manifest="bin/META-INF/MANIFEST.MF">
			<include name="**/*.*"/>
69 70
			<exclude name="org/h2/build/**/*.*"/>
			<exclude name="org/h2/dev/**/*.*"/>
71
			<exclude name="org/h2/samples/**/*.*"/>
72
			<exclude name="org/h2/test/**/*.*"/>
73
			<exclude name="**/*.bat"/>
74
			<exclude name="**/*.sh"/>
75 76 77 78
			<exclude name="**/*.txt"/>
		</jar>
	</target>

79
	<target name="jarDb" depends="resources, manifest">
80
		<javac srcdir="src/main" destdir="bin" debug="false">
81
			<include name="org/h2/*" />
82 83
			<include name="org/h2/engine/**" />
			<include name="org/h2/jdbc/**" />
84 85
			<include name="org/h2/jdbcx/**" />
		</javac>
86
		<jar jarfile="bin/h2db.jar" basedir="bin" manifest="bin/META-INF/MANIFEST.MF">
87 88
			<include name="**/*.*"/>
			<exclude name="**/*.bat"/>
89
			<exclude name="**/*.sh"/>
90
		</jar>
91
	</target>
92

93 94 95 96 97
    <target name="manifest">
		<mkdir dir="bin/META-INF"/>
		<manifest file="bin/META-INF/MANIFEST.MF">
			<attribute name="Implementation-Title" value="H2 Database Engine"/>
			<attribute name="Implementation-URL" value="http://www.h2database.com"/>
98
			<attribute name="Build-Jdk" value="${java.specification.version}"/>
99 100
		</manifest>
	</target>
101
    
102 103 104 105 106 107 108 109
	<target name="resources" depends="clean">
	    <mkdir dir="bin/org/h2/util"/>
	    <zip destfile="bin/org/h2/util/data.zip" 
	        basedir="src/main" 
	        compress="false"
	        excludes="**/*.java,**/package.html,**/java.sql.Driver" />
	</target>

110
	<target name="switchSourcePrepare" depends="clean">
111
		<javac srcdir="src/tools" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/build/code/SwitchSource.java"/>
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
	</target>

    <target name="switchSourceAndroid" depends="switchSourcePrepare">
		<java classname="org.h2.build.code.SwitchSource" classpath="bin">
			<arg line="-version 1.3 -AWT -dir src/main/org/h2"/>
		</java>
	</target>

	<target name="switchSourceAuto" depends="switchSourcePrepare">
		<java classname="org.h2.build.code.SwitchSource" classpath="bin">
			<arg line="-auto -dir src/main/org/h2"/>
		</java>
	</target>

	<target name="switchSourceJdk13" depends="switchSourcePrepare">
		<java classname="org.h2.build.code.SwitchSource" classpath="bin">
			<arg line="-version 1.3 +AWT -dir src/main/org/h2"/>
		</java>
	</target>

	<target name="switchSourceJdk14" depends="switchSourcePrepare">
		<java classname="org.h2.build.code.SwitchSource" classpath="bin">
			<arg line="-version 1.4 +AWT -dir src/main/org/h2"/>
		</java>
	</target>

	<target name="switchSourceJdk16" depends="switchSourcePrepare">
		<java classname="org.h2.build.code.SwitchSource" classpath="bin">
			<arg line="-version 1.6 +AWT -dir src/main/org/h2"/>
		</java>
	</target>
143 144 145 146 147

	<target name="test" depends="compile">
		<java classname="org.h2.test.TestAll" fork="true" classpath="bin" />
	</target>

148
	<target name="testCoverage" depends="compileCoverage">
149
		<java classname="org.h2.test.TestAll" fork="true" classpath="." dir="bin">
150 151 152 153
			<arg line="codeCoverage"/>
		</java>
	</target>

154
	<target name="warConsole" depends="jar">
155
		<war destfile="bin/h2console.war" webxml="src/tools/WEB-INF/web.xml" basedir="src/tools/WEB-INF" includes="console.html">
156 157 158
			<lib file="bin/h2.jar" />
		</war>
	</target>
159 160

</project>