sqldump / build.xml

<project name="sqldump" xmlns:ivy="antlib:org.apache.ivy.ant">
	
	<property name="src.dir" value="src"/>
	<property name="src.diff.dir" value="src_diff"/>
	<property name="src.graphml.dir" value="src_graphml"/>
	<property name="src.mondrian.dir" value="src_mondrian"/>
	<property name="src.run.dir" value="src_run"/>
	<property name="src.test.dir" value="src_test"/>
	<property name="src.xtra.dir" value="src_xtra"/>
	
	<property name="bin.dir"  value="bin"/>
	<property name="dist.dir" value="dist"/>
	<property name="lib.dir" value="lib"/>
	<property name="javadoc.dir" value="dist/javadoc"/>
	
	<property name="sqldump.mainclass" value="tbrugz.sqldump.SQLDump"/>
	<property name="sqldump.sqlrun.mainclass" value="tbrugz.sqldump.sqlrun.SQLRun"/>
	<property name="sqldump.sqldiff.mainclass" value="tbrugz.sqldiff.SQLDiff"/>
	
	<property file="build.properties"/>

	<path id="classpath.compile">
		<pathelement location="${lib.dir}/commons-logging-1.1.1.jar"/>
		<pathelement location="${lib.dir}/log4j-1.2.16.jar"/>
		<pathelement location="${lib.dir}/kmlutils.jar"/>
		<pathelement location="${lib.dir}/mondrianschema2graphml.jar"/>
	</path>
	
	<path id="classpath.run">
		<path refid="classpath.compile"/>
		<pathelement location="${bin.dir}"/>
		<pathelement location="${run.xtralib}"/>
	</path>

	<path id="classpath.run.jaxb">
		<path refid="classpath.run"/>
		<pathelement location="${jaxb.lib}"/>
	</path>

	<path id="classpath.run.derby">
		<path refid="classpath.run"/>
		<pathelement location="${lib.dir}/derby-10.8.2.2.jar"/>
	</path>

	<path id="classpath.run.hsqldb">
		<path refid="classpath.run"/>
		<pathelement location="${lib.dir}/hsqldb-2.2.8.jar"/>
	</path>
	
	<target name="prepare">
		<mkdir dir="${bin.dir}"/>
		<mkdir dir="${lib.dir}"/>
		<mkdir dir="${dist.dir}"/>
		<mkdir dir="${javadoc.dir}"/>
		<!--if>
			<available file="sqldump.properties"/>
			<then></then>
			<else>
				<copy file="sqldump.properties.template" tofile="sqldump.properties" verbose="on"/>
			</else>
		</if-->
	</target>

	<target name="compile" depends="prepare">
		<javac destdir="${bin.dir}" classpathref="classpath.compile" debug="on">
			<src path="${src.dir}"/>
			<src path="${src.graphml.dir}"/>
			<src path="${src.diff.dir}"/>
			<src path="${src.run.dir}"/>
			<src path="${src.mondrian.dir}"/>
			<src path="${src.xtra.dir}"/>
		</javac>
		<copy todir="${bin.dir}" >
			<fileset dir="${src.dir}">
				<include name="**/*.properties"/>
				<include name="**/jaxb.index"/>
			</fileset>
			<fileset dir="${src.graphml.dir}">
				<include name="**/*.properties"/>
			</fileset>
			<fileset dir="${src.mondrian.dir}">
				<include name="**/*.properties"/>
			</fileset>
		</copy>
	</target>

	<target name="run" depends="compile">
		<java classpathref="classpath.run" classname="${sqldump.mainclass}">
			<arg value="${run.arg}"/>
		</java>
	</target>
	
	<!-- full test: 
		1- dump jaxb model
		2- load into different databases (sqlrun)
		3- dump from all databases
		4- compare with original (sqldiff) --> 
	<target name="test-roundtrip1" depends="compile">
		<!-- 1 -->
		<echo message="roundtrip1: phase 1: dump [jaxb]" />
		<java classpathref="classpath.run.jaxb" classname="${sqldump.mainclass}">
			<arg value="-propfile=test/r1-sqldump-jaxb-test.properties"/>
		</java>
		<!-- 2 -->
		<echo message="roundtrip1: phase 2: run [derby]" />
		<java classpathref="classpath.run.derby" classname="${sqldump.sqlrun.mainclass}" fork="true">
			<arg value="-propfile=test/r2-sqlrun-derby-test.properties"/>
		</java>
		<echo message="roundtrip1: phase 2: run [hsqldb]" />
		<java classpathref="classpath.run.hsqldb" classname="${sqldump.sqlrun.mainclass}" fork="true">
			<arg value="-propfile=test/r2-sqlrun-hsqldb-test.properties"/>
		</java>
		<!-- 3 -->
		<echo message="roundtrip1: phase 3: dump [derby]" />
		<java classpathref="classpath.run.derby" classname="${sqldump.mainclass}" fork="true">
			<arg value="-propfile=test/r3-sqldump-derby-test.properties"/>
		</java>
		<echo message="roundtrip1: phase 3: dump [hsqldb]" />
		<java classpathref="classpath.run.hsqldb" classname="${sqldump.mainclass}" fork="true">
			<arg value="-propfile=test/r3-sqldump-hsqldb-test.properties"/>
		</java>
		<!-- 4 -->
		<echo message="roundtrip1: phase 4: diff [jaxb/jaxb-derby]" />
		<java classpathref="classpath.run.jaxb" classname="${sqldump.sqldiff.mainclass}">
			<arg value="-propfile=test/r4-sqldiff-test1.properties"/>
		</java>
		<echo message="roundtrip1: phase 4: diff [jaxb/jaxb-hsqldb]" />
		<java classpathref="classpath.run.jaxb" classname="${sqldump.sqldiff.mainclass}">
			<arg value="-propfile=test/r4-sqldiff-test2.properties"/>
		</java>
		<echo message="roundtrip1: phase 4: diff [jaxb-derby/jaxb-hsqldb]" />
		<java classpathref="classpath.run.jaxb" classname="${sqldump.sqldiff.mainclass}">
			<arg value="-propfile=test/r4-sqldiff-test3.properties"/>
		</java>
	</target>
	
	<target name="jar" depends="compile">
		<jar destfile="${dist.dir}/sqldump.jar"
			basedir="${bin.dir}"
			includes="**/*.class, *.properties, **/jaxb.index">
			<manifest>
				<attribute name="Main-Class" value="${sqldump.mainclass}"/>
			</manifest>
		</jar>
		<!--jar destfile="${dist.dir}/sqldump-jaxb.jar"
			basedir="${src.test.dir}"
			includes="**/jaxb.properties">
		</jar-->
	</target>

	<target name="javadoc" depends="prepare">
		<javadoc destdir="${javadoc.dir}" sourcepath="${src.dir}" />
	</target>
	
	<target name="all" depends="javadoc,jar">
		<!--copy todir="${dist.dir}/" verbose="on" file="sqldump.properties"/-->
	</target>

	<target name="clean">
		<delete dir="${bin.dir}"/>
		<delete dir="${dist.dir}"/>
		<delete dir="output"/>
		<!-- for testing ivy -->
		<!--delete>
			<fileset dir="${lib.dir}">
				<include name="**"/>
			</fileset>
		</delete-->
	</target>
	
	<!-- ========= dependencies tasks ========== -->
	<!-- use: resolve-ivy OR resolve-get -->
	<!-- hint: ant -autoproxy -lib <ivy-dir> resolve -->
	<!-- XXX: install ivy? see: ivy/example/go-ivy -->
	
	<target name="check-kmlutils" description="checks existence of kmlutils.jar">
	    <available file="${lib.dir}/kmlutils.jar" property="kmlutils.present"/>
	</target>

	<target name="check-mondrianschema2graphml" description="checks existence of mondrianschema2graphml.jar">
	    <available file="${lib.dir}/mondrianschema2graphml.jar" property="mondrianschema2graphml.present"/>
	</target>
	
	<target name="resolve-kmlutils" depends="check-kmlutils" description="retrieve kmlutils dependency" unless="kmlutils.present">
		<get dest="${lib.dir}/kmlutils.jar" src="http://cdn.bitbucket.org/tbrugz/kmlutils/downloads/svg2kml.jar" verbose="true"/>
	</target>

	<target name="resolve-mondrianschema2graphml" depends="check-mondrianschema2graphml" description="retrieve kmlutils dependency" unless="mondrianschema2graphml.present">
		<get dest="${lib.dir}" src="http://cdn.bitbucket.org/tbrugz/mondrianschema2graphml/downloads/mondrianschema2graphml.jar" verbose="true"/>
	</target>
	
	<target name="resolve-base" depends="resolve-kmlutils,resolve-mondrianschema2graphml">
	</target>

	<target name="resolve-ivy" description="retrieve dependencies with ivy" depends="resolve-base">
		<ivy:retrieve />
		<!--ivy:report todir="${dist.dir}" /-->
	</target>	

	<target name="resolve-get" description="retrieve dependencies with 'get'" depends="resolve-base">
		<get dest="${lib.dir}">
			<url url="http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/>
			<url url="http://repo1.maven.org/maven2/log4j/log4j/1.2.16/log4j-1.2.16.jar"/>
		</get>
		<!-- markdownj: markdown testing -->
		<get dest="${lib.dir}/markdownj-1.0.2b4-0.3.0.jar" src="http://code.google.com/p/markdownj/downloads/detail?name=markdownj-1.0.2b4-0.3.0.jar&amp;can=2&amp;q=" verbose="true"/>
	</target>	

	<!-- ========= /dependencies tasks ========== -->
	
	<!-- http://cruisecontrol.sourceforge.net/ ? jenkins? -->
</project>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.