Source

queryon / build.xml

Full commit
<project name="queryon" xmlns:ivy="antlib:org.apache.ivy.ant">

	<property name="proj.name" value="queryon"/>
	<property file="build.properties"/>
	
	<property name="src.dir" value="src"/>
	<property name="src.test.dir" value="src_test"/>
	<property name="bin.dir"  value="bin"/>
	<property name="lib.dir"  value="lib"/>
	<property name="dist.dir" value="dist"/>
	<property name="deploy.dir" value="dist/deploy"/>
	<property name="test.dir" value="dist/test"/>
	<property name="web.dir" value="web"/>
	<property name="war.file" value="${dist.dir}/${proj.name}.war"/>

	<fileset id="fileset.base" dir="lib">
		<include name="sqldump.jar" />
		<include name="commons-logging-1.1.1.jar" />
		<include name="log4j-1.2.16.jar" />
	</fileset>

	<fileset id="fileset.compile" dir="lib">
		<include name="${servlet.jar}" />
	</fileset>

	<fileset id="fileset.war" dir="lib">
		<include name="${jdbc.jar}" />
	</fileset>
	
	<path id="classpath.compile">
		<fileset refid="fileset.base" />
		<fileset refid="fileset.compile" />
	</path>

	<path id="classpath.sqldump">
		<fileset refid="fileset.base" />
		<fileset refid="fileset.compile" />
		<fileset refid="fileset.war" />
	</path>
	
	<path id="classpath.test">
		<path refid="classpath.sqldump"/>
		<pathelement location="${bin.dir}"/>
		<pathelement location="lib/junit-4.11.jar"/>
		<pathelement location="lib/hamcrest-core-1.3.jar"/>
		
		<pathelement location="lib/apache-any23-core-0.7.0-incubating.jar"/>
		<pathelement location="lib/commons-csv-1.0-SNAPSHOT.jar"/>
		<pathelement location="lib/commons-httpclient-3.1.jar"/>
		<pathelement location="lib/gson-2.2.2.jar"/>
		<pathelement location="lib/json-simple-1.1.1.jar"/>
		<pathelement location="lib/httpcore-4.2.1.jar"/>
		<pathelement location="lib/httpclient-4.2.1.jar"/>
		<pathelement location="lib/kmlutils.jar"/>
		<pathelement location="lib/sesame-model-2.6.1.jar"/>
		<pathelement location="lib/sesame-rio-api-2.6.1.jar"/>
		<pathelement location="lib/sesame-rio-ntriples-2.6.1.jar"/>
		<pathelement location="lib/sesame-rio-rdfxml-2.6.1.jar"/>
		<pathelement location="lib/sesame-rio-turtle-2.6.1.jar"/>
		<pathelement location="lib/sesame-rio-trix-2.6.1.jar"/>
		<pathelement location="lib/sesame-util-2.6.1.jar"/>
		<pathelement location="lib/slf4j-api-1.6.1.jar"/>
		<pathelement location="lib/tika-core-0.6.jar"/>
		<pathelement location="lib/tika-parsers-0.6.jar"/>
		<pathelement location="lib/winstone-0.9.10.jar"/>
	</path>
	
	<target name="prepare">
		<mkdir dir="${bin.dir}"/>
		<mkdir dir="${dist.dir}"/>
		<mkdir dir="${test.dir}"/>
	</target>
	
	<target name="clean">
		<delete dir="${dist.dir}"/>
		<mkdir dir="${dist.dir}"/>
	</target>

	<target name="compile" depends="prepare">
		<javac destdir="${bin.dir}" classpathref="classpath.compile" debug="on" source="1.6" target="1.6">
			<src path="${src.dir}"/>
			<src path="${src.test.dir}"/>
		</javac>
		<copy todir="${bin.dir}" >
			<fileset dir="${src.dir}">
				<include name="**/*.properties"/>
				<include name="**/*.xml"/>
			</fileset>
		</copy>
	</target>
	
	<target name="jar" depends="compile" description="builds jar">
		<jar destfile="${dist.dir}/queryon.jar"
			basedir="${bin.dir}"
			includes="**/*.class, dbms-specific-queryon.properties">
		</jar>
	</target>
	
	<target name="war" depends="compile">
		<war destfile="${war.file}" needxmlfile="false">
			<webinf dir="web/WEB-INF"></webinf>
			<lib refid="fileset.base" />
			<lib refid="fileset.war" />
			<classes dir="bin"></classes>
			<fileset dir="web"></fileset>
		</war>
	</target>
	
	<target name="war-deploy" depends="war" description="deploy war file">
		<copy file="${war.file}" todir="${deploy.dir}" />
	</target>

	<target name="web-deploy" description="deploy static web artifacts">
		<copy todir="${deploy.dir}/${proj.name}">
			<fileset dir="${web.dir}">
				<include name="**/*.js"/>
				<include name="**/*.css"/>
				<include name="**/*.html" />
			</fileset>
		</copy>
	</target>

	<target name="start-db" description="init H2 database">
		<java classpath="${lib.dir}/${h2.jar}" classname="org.h2.tools.Server" fork="true">
			<arg value="-tcp"/>
			<arg value="-web"/>
			<arg value="-baseDir"/>
			<arg value="${h2.basedir}"/>
			<!--arg value="-trace"/-->
		</java>
	</target>
	
	<target name="load-r2rml-db">
		<java classpathref="classpath.sqldump" classname="tbrugz.sqldump.sqlrun.SQLRun" fork="true">
			<jvmarg value="-Dsqlrun.dburl=jdbc:h2:tcp://localhost/r2rml"/>
			<arg value="-propfile=src_test/tbrugz/queryon/r2rml/sqlrun.properties"/>
		</java>
	</target>
	
	<target name="stop-db" description="stop H2 database">
		<java classpath="${lib.dir}/${h2.jar}" classname="org.h2.tools.Server" fork="true">
			<arg value="-tcpShutdown"/>
			<arg value="tcp://localhost:9092"/>
			<arg value="-tcpShutdownForce"/>
		</java>
	</target>
	
	<target name="test" depends="compile">
		<junit printsummary="yes">
			<classpath refid="classpath.test"/>
			<formatter type="xml"/>
			<test name="tbrugz.queryon.QueryOnTestSuite" todir="${test.dir}"/>
		</junit>
	</target>
	
	<target name="resolve-ivy" description="retrieve dependencies with ivy">
		<ivy:retrieve haltonfailure="false"/>
	</target>

	<target name="resolve-get">
		<get dest="${lib.dir}/kmlutils.jar" src="http://cdn.bitbucket.org/tbrugz/kmlutils/downloads/svg2kml.jar" verbose="true"/>
		<get dest="${lib.dir}" src="http://cdn.bitbucket.org/tbrugz/sqldump/downloads/sqldump.jar" verbose="true"/>
	</target>
	
</project>