forked from aglover/droid-migrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
118 lines (106 loc) · 4.31 KB
/
build.xml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<project name="droid-migrate" basedir="." default="jar">
<property name="version" value="0.7" />
<property name="lib.dir" value="lib" />
<property name="build.dir" value="target" />
<property name="build.test.dir" value="${build.dir}/test" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="stubs.dir" value="${build.dir}/ext-classes" />
<property name="final.templates.dir" value="${build.dir}/templates/com/b50/migrations/generators" />
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="dist" />
</target>
<target name="compile.stubs">
<mkdir dir="${stubs.dir}" />
<javac includeantruntime="false" srcdir="stubs" destdir="${stubs.dir}"
source="1.6" target="1.6"
classpathref="classpath" />
</target>
<target name="compile" depends="compile.stubs"
description="compiles source code and puts classes in target/ directory">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="src" destdir="${classes.dir}"
source="1.6" target="1.6"
debug="true" classpathref="classpath">
<classpath>
<path refid="classpath" />
<pathelement path="${stubs.dir}" />
</classpath>
</javac>
</target>
<target name="cp-templates">
<mkdir dir="${final.templates.dir}" />
<copy todir="${final.templates.dir}">
<fileset dir="${basedir}/templates">
<include name="**/*.ftl" />
</fileset>
</copy>
</target>
<target name="jar" depends="test, cp-templates" description="creates jar file for distribution">
<jar destfile="${build.dir}/${ant.project.name}-all-${version}.jar">
<fileset dir="${classes.dir}" includes="**/*.class" />
<fileset dir="${build.dir}/templates" />
<manifest>
<attribute name="Main-Class" value="com.b50.migrations.DroidMigrate" />
</manifest>
</jar>
</target>
<target name="jar-min" depends="jar" description="creates minimal required jar file for devices">
<jar destfile="${build.dir}/${ant.project.name}-${version}.jar">
<fileset dir="${classes.dir}">
<include name="com/b50/migrations/AbstractMigration.class" />
<include name="com/b50/migrations/MigrationException.class" />
<include name="com/b50/migrations/Migrator.class" />
<include name="com/b50/migrations/MigrationsDatabaseHelper.class" />
</fileset>
</jar>
<copy file="${build.dir}/${ant.project.name}-${version}.jar" tofile="${build.dir}/${ant.project.name}-min.jar"/>
</target>
<target name="dist" depends="jar-min" description="creates disto library and puts it into dist dir">
<mkdir dir="dist" />
<copy file="${build.dir}/${ant.project.name}-all-${version}.jar" todir="dist"/>
<move file="dist/${ant.project.name}-all-${version}.jar" tofile="dist/${ant.project.name}-all.jar"/>
<move file="${build.dir}/${ant.project.name}-min.jar" tofile="dist/${ant.project.name}-min.jar"/>
</target>
<target name="compile-tests" depends="compile">
<mkdir dir="${build.dir}/test-classes" />
<javac srcdir="test/" destdir="${build.dir}/test-classes"
includeAntRuntime="false" source="1.5" debug="true">
<classpath>
<path refid="classpath" />
<pathelement path="${classes.dir}" />
<pathelement path="${stubs.dir}" />
</classpath>
</javac>
</target>
<target name="test" depends="compile-tests">
<junit fork="true" forkmode="once" haltonfailure="false" haltonerror="false"
failureproperty="tests.failures" errorproperty="tests.errors"
includeantruntime="true" showoutput="true" printsummary="true">
<classpath>
<path refid="classpath" />
<pathelement path="${classes.dir}" />
<pathelement path="${build.dir}/test-classes" />
<pathelement path="${stubs.dir}" />
</classpath>
<formatter type="xml" />
<batchtest fork="yes" todir="./${build.dir}/">
<fileset dir="test/">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<mkdir dir="./${build.dir}/reports" />
<junitreport todir="./${build.dir}/reports">
<fileset dir="./${build.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="./${build.dir}/reports/html" />
</junitreport>
<fail if="tests.failures"
message="There were JUnit failures -- see the reports in ./${build.dir}/reports" />
</target>
</project>