summaryrefslogtreecommitdiff
path: root/build.xml
blob: f6ef8be8c64c5293371a002ea0669c3dd5d98818 (plain)
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project SSSync with libraries in sub-folder">
	<!-- Hand-written (with help of Eclipse) -->

	<!-- ANT 1.8 annoying warning work-around -->
	<presetdef name="javac">
		<javac includeantruntime="false"/>
	</presetdef>

	<target name="clean">
		<ant antfile="build.xml" dir="src/main/" inheritAll="false" target="cleanall"/>
		<delete file="build/SSSync.jar"/>
		<delete file="build/sssync"/>
		<delete dir="build/lib"/>
		<delete dir="build/conf"/>
		<delete dir="build/data"/>
	</target>

	<target name="build">
		<ant antfile="build.xml" dir="src/main/" inheritAll="false" target="build"/>
	</target>

	<target depends="build" name="create_run_jar">
		<mkdir dir="build"/>

		<jar destfile="build/SSSync.jar">
			<manifest>
				<attribute name="Main-Class" value="SSSync"/>
				<attribute name="Class-Path" value=". lib/junit.jar lib/org.hamcrest.core_1.1.0.jar lib/guava-16.0.1.jar lib/log4j-1.2.17.jar lib/snakeyaml-1.11.jar lib/commons-csv-1.0-SNAPSHOT.jar lib/ojdbc6.jar lib/mysql-connector-java-5.1.31-bin.jar lib/unboundid-ldapsdk-se.jar"/>
			</manifest>
			<fileset dir="src/main/bin">
				<exclude name="**/*Test.class"/>
				<exclude name="**/*Tests.class"/>
			</fileset>
			<fileset dir="src/core/bin">
				<exclude name="**/*Test.class"/>
				<exclude name="**/*Tests.class"/>
			</fileset>
			<fileset dir="src/connectors/bin">
				<exclude name="**/*Test.class"/>
				<exclude name="**/*Tests.class"/>
			</fileset>
		</jar>

		<!-- copy doesn't preserve file's permission -->
		<copy file="src/main/sssync.sh" tofile="build/sssync"/>
		<exec executable="chmod">
			<arg value="a+x"/>
			<arg value="build/sssync"/>
		</exec>

		<delete dir="build/lib"/>
		<mkdir dir="build/lib"/>
		<copy file="src/core/lib/guava-16.0.1.jar" todir="build/lib"/>
		<copy file="src/main/lib/log4j-1.2.17.jar" todir="build/lib"/>
		<copy file="src/main/lib/snakeyaml-1.11.jar" todir="build/lib"/>
		<copy file="src/connectors/lib/commons-csv-1.0-SNAPSHOT.jar" todir="build/lib"/>
		<copy file="src/connectors/lib/ojdbc6.jar" todir="build/lib"/>
		<copy file="src/connectors/lib/mysql-connector-java-5.1.31-bin.jar" todir="build/lib"/>
		<copy file="src/connectors/lib/unboundid-ldapsdk-se.jar" todir="build/lib"/>

		<delete dir="build/conf"/>
		<mkdir dir="build/conf"/>
		<copy file="src/main/conf/connections.yaml" todir="build/conf"/>
		<copy file="src/main/conf/sssync.yaml" todir="build/conf"/>
		<copy file="src/main/conf/log4j.properties" todir="build/conf"/>

		<mkdir dir="build/conf/queries"/>
		<copy file="src/main/conf/queries/people.sql" todir="build/conf/queries"/>
		<copy file="src/main/conf/queries/structures.sql" todir="build/conf/queries"/>

		<delete dir="build/data"/>
		<mkdir dir="build/data"/>
		<copy file="src/main/data/people_append.csv" todir="build/data"/>
		<copy file="src/main/data/people_replace.csv" todir="build/data"/>
	</target>
</project>