build.xml 5.3 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
		    <classpath location="ext/org.osgi.core-1.2.0.jar" />
22 23 24
		    <src path="src/main"/>
	       	<src path="src/test"/>
	       	<src path="src/tools"/>
25
	    </javac>
26
		<copy todir="bin" overwrite="true">
27
			<fileset dir="src/main" includes="META-INF/services/*"/>
28
			<fileset dir="src/installer" includes="*.bat"/>
29
			<fileset dir="src/installer" includes="*.sh"/>
30
			<fileset dir="src/test" excludes="**/*.java,**/package.html"/>
31 32
		</copy>
	</target>
33

34 35 36 37
    <target name="compileCoverage" depends="compile">
		<copy todir="bin" overwrite="true">
			<fileset dir="src/main"/>
		</copy>
38
		<java classname="org.h2.test.coverage.Coverage" classpath="." dir="bin" fork="true">
39
			<arg line="-r org/h2"/>
40
		</java>
41
		<javac srcdir="bin" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/**"/>
42
    </target>
43
    
44
    <target name="download" depends="init" unless="ext.present">
45 46 47 48
        <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" />
49 50
        <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" />
51 52
        <get dest="ext/org.osgi.core-1.2.0.jar"
            src="http://repo1.maven.org/maven2/org/apache/felix/org.osgi.core/1.2.0/org.osgi.core-1.2.0.jar" />
53
    </target>
54

55
	<target name="init">
56
		<mkdir dir="ext"/>
57 58 59 60 61
	    <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"/>
62
	  			<available file="ext/org.osgi.core-1.2.0.jar"/>
63 64
			</and>
		</condition>	    
65
	</target>
66

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

83 84 85 86 87
    <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"/>
88
			<attribute name="Build-Jdk" value="${java.specification.version}"/>
89 90
		</manifest>
	</target>
91
    
92 93 94 95 96 97 98 99
	<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>

100
	<target name="switchSourcePrepare" depends="clean">
101 102 103
		<javac source="1.4" srcdir="src/tools" destdir="bin" 
		    debug="true" debuglevel="lines,source" 
		    includes="org/h2/build/code/SwitchSource.java"/>
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
	</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>
135 136 137 138 139

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

140
	<target name="testCoverage" depends="compileCoverage">
141
		<java classname="org.h2.test.TestAll" fork="true" classpath="." dir="bin">
142 143 144 145 146
			<arg line="codeCoverage"/>
		</java>
	</target>

</project>