-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
142 lines (117 loc) · 4.49 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="build_jar" name="Create all Jars for Project KdbxReader">
<loadfile property="version" srcFile="build.version" failonerror="false" />
<property name="version" value="noVersion" />
<property name="projectsPath" value="${user.home}/git" />
<echo message="projectsPath: ${projectsPath}" />
<property name="buildPath" value="build" />
<echo message="buildPath: ${buildPath}" />
<target name="build_jar" depends="cleanup_before, create_jar, test, cleanup_after" />
<target name="cleanup_before">
<mkdir dir="${buildPath}" />
<delete includeEmptyDirs="true">
<fileset dir="${buildPath}">
<include name="*" />
</fileset>
</delete>
<mkdir dir="${buildPath}/bin" />
<mkdir dir="${buildPath}/testbin" />
</target>
<target name="download_dependencies">
<mkdir dir="lib" />
<delete includeEmptyDirs="true">
<fileset dir="lib">
<include name="*" />
</fileset>
</delete>
<get src="https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.70/bcprov-jdk15on-1.70.jar" dest="lib/" />
<mkdir dir="lib_test/" />
<delete includeEmptyDirs="true">
<fileset dir="lib_test/">
<include name="*" />
</fileset>
</delete>
<get src="https://repo1.maven.org/maven2/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar" dest="lib_test/" />
<get src="https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/2.2/hamcrest-core-2.2.jar" dest="lib_test/" />
<get src="https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar" dest="lib_test/" />
</target>
<target name="create_jar" depends="cleanup_before, download_dependencies">
<path id="build.classpath">
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</path>
<javac debug="true" nowarn="true" deprecation="false" destdir="${buildPath}/bin" fork="yes" source="1.8" target="1.8" srcdir="src/main/java" includeantruntime="false" encoding="UTF-8">
<classpath refid="build.classpath" />
</javac>
<jar destfile="${buildPath}/kdbx-${version}.jar">
<manifest>
<attribute name="Version" value="${version}" />
</manifest>
<fileset dir="${buildPath}/bin" />
<fileset dir="" includes="LICENSE.txt"/>
</jar>
<checksum file="${buildPath}/kdbx-${version}.jar" fileext=".md5" forceOverwrite="yes" />
<checksum file="${buildPath}/kdbx-${version}.jar" algorithm="SHA-1" fileext=".sha1" forceOverwrite="yes" />
<jar destfile="${buildPath}/kdbx-${version}_sources.jar">
<manifest>
<attribute name="Version" value="${version}" />
</manifest>
<fileset dir="src/main/java" includes="**/*.java"/>
<fileset dir="" includes="LICENSE.txt"/>
</jar>
<checksum file="${buildPath}/kdbx-${version}_sources.jar" fileext=".md5" forceOverwrite="yes"/>
<checksum file="${buildPath}/kdbx-${version}_sources.jar" algorithm="SHA-1" fileext=".sha1" forceOverwrite="yes" />
</target>
<target name="test" depends="create_jar">
<path id="test.build.classpath">
<fileset dir="lib_test">
<include name="*.jar" />
</fileset>
<fileset dir="${buildPath}">
<include name="*.jar" />
</fileset>
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</path>
<javac debug="true" nowarn="true" deprecation="false" destdir="${buildPath}/testbin" fork="yes" source="1.8" target="1.8" srcdir="src/test/java" includeantruntime="false" encoding="UTF-8">
<classpath refid="test.build.classpath" />
</javac>
<copy todir="${buildPath}/testbin">
<fileset dir="src/test/resources" />
</copy>
<path id="test.classpath">
<fileset dir="lib_test">
<include name="*.jar" />
</fileset>
<fileset dir="${buildPath}">
<include name="*.jar" />
</fileset>
<dirset dir="${buildPath}">
<include name="testbin" />
</dirset>
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</path>
<junit printsummary="yes" haltonfailure="yes">
<classpath refid="test.classpath" />
<batchtest todir="build">
<formatter type="plain" usefile="true"/>
<fileset dir="src/test/java">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="cleanup_after" depends="create_jar, test">
<delete dir="${buildPath}/bin" />
<delete dir="${buildPath}/testbin" />
<delete includeEmptyDirs="true">
<fileset dir="${buildPath}">
<include name="TEST-*" />
</fileset>
</delete>
</target>
</project>