-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.xml
167 lines (152 loc) · 6.8 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?xml version="1.0" encoding="UTF-8"?>
<project name="Libvirt Java Bindings" default="build" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property file="build.properties" />
<property name="jar" value="libvirt-${version}" />
<property name="jar.file" value="target/${jar}.jar" />
<property name="jar.docfile" value="target/${jar}-javadoc.jar" />
<property name="jar.srcfile" value="target/${jar}-sources.jar" />
<property name="src" value="libvirt-java-${version}" />
<property name="src.file" value="target/${src}.tar.gz" />
<property name="spec" value="libvirt-java.spec" />
<property name="spec.file" value="target/${spec}" />
<property environment="env"/>
<property name="javac.debug" value="off" />
<path id="compile.classpath">
<fileset dir="${jar.dir}">
<include name="jna.jar" />
</fileset>
</path>
<path id="test.classpath">
<fileset dir="${jar.dir}">
<include name="jna.jar" />
<include name="junit.jar" />
</fileset>
<pathelement location="target/classes" />
<pathelement location="target/testclasses" />
</path>
<target name="init">
<mkdir dir="target/classes" />
<mkdir dir="target/testclasses" />
<mkdir dir="target/cache" />
<copy file="README.in" tofile="README" overwrite="true" filtering="true">
<filterset filtersfile="build.properties" />
</copy>
</target>
<target name="clean" description="cleans up all created artifacts">
<delete dir="target" />
</target>
<target name="jar" description="build the jar" depends="build">
<jar destfile="${jar.file}" basedir="target/classes" />
</target>
<target name="buildtests" description="build test classes" depends="build">
<depend srcdir="src/test/java"
destdir="target/testclasses"
cache="target/cache"
closure="true" />
<javac srcdir="src/test/java" debug="${javac.debug}" source="${java.source}" target="${java.target}" includes="**/*.java" classpathref="test.classpath" destdir="target/testclasses" includeAntRuntime="false" />
</target>
<target name="build" depends="init" description="builds the code">
<depend srcdir="src/main/java"
destdir="target/classes"
cache="target/cache"
closure="true" />
<javac srcdir="src/main/java" debug="${javac.debug}" source="${java.source}" target="${java.target}" includes="**/*.java" classpathref="compile.classpath" destdir="target/classes" includeAntRuntime="false" />
</target>
<target name="test" depends="buildtests" description="tests the code">
<junit printsummary="yes" fork="yes" forkMode="perBatch" failureproperty="tests.failed">
<formatter type="xml" />
<classpath refid="test.classpath" />
<batchtest todir="target">
<fileset dir="src/test/java">
<include name="**/Test*.java" />
</fileset>
</batchtest>
</junit>
<fail message="Tests failed: check test reports." if="tests.failed" />
</target>
<target name="docs" depends="build" description="builds the javadoc">
<mkdir dir="target/javadoc" />
<javadoc sourcepath="src/main/java" classpathref="compile.classpath" destdir="target/javadoc" />
<jar destfile="${jar.docfile}" basedir="target/javadoc" />
</target>
<target name="src" depends="init" description="creates a src tarball">
<mkdir dir="target/libvirt-java-${version}" />
<copy todir="target/libvirt-java-${version}">
<fileset dir="." excludes="target/**,.gitignore,.git/**,.*,.*/**" />
</copy>
<tar basedir="target" includes="libvirt-java-${version}/**" compression="gzip" destfile="${src.file}" />
<jar destfile="${jar.srcfile}" basedir="src/main/java" />
</target>
<target name="spec" depends="init" description="generates the spec file">
<copy file="libvirt-java.spec.in" tofile="${spec.file}" overwrite="true" filtering="true">
<filterset filtersfile="build.properties" />
</copy>
</target>
<target name="package" depends="src,build,docs,spec" description="builds the rpms">
<copy file="${src.file}" todir="${rpm.topdir}/SOURCES" />
<copy file="${spec.file}" todir="${rpm.topdir}/SPECS" />
<rpm specfile="${spec}" command="-ba" topdir="${rpm.topdir}" />
</target>
<target name="maven" depends="build,jar,docs,src" description="publish the maven repo">
<mkdir dir="target/repo" />
<get src="http://repo1.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar" dest="target/maven-ant-tasks-2.1.3.jar" />
<copy file="pom.xml.in" tofile="target/pom.xml" overwrite="true" filtering="true">
<filterset filtersfile="build.properties" />
</copy>
<path id="maven-ant-tasks.classpath" path="target/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />
<input message="Username for copying source files: "
addproperty="scp.username" defaultvalue="${env.USER}"/>
<input message="The homedirectory of the user: "
addproperty="scp.home" defaultvalue="${env.HOME}"/>
<input message="Passphrase: "
addproperty="scp.passphrase"/>
<scp file="${scp.username}@download.libvirt.org:/data/ftp/libvirt/maven2"
todir="target/repo"
keyfile="${scp.home}/.ssh/id_rsa"
sftp="true"
passphrase="${scp.passphrase}"/>
<artifact:pom id="mypom" file="target/pom.xml" />
<artifact:install file="${jar.file}">
<localRepository path="target/repo" />
<pom refid="mypom" />
<attach file="${jar.docfile}" classifier="javadoc"/>
<attach file="${jar.srcfile}" classifier="sources"/>
</artifact:install>
<scp todir="${scp.username}@download.libvirt.org:/data/ftp/libvirt/maven2"
keyfile="${scp.home}/.ssh/id_rsa"
sftp="true"
passphrase="${scp.passphrase}">
<fileset dir="target/repo"/>
</scp>
</target>
<target name="publish_source" depends="build" description="Publish the source tarball">
<input message="Username for copying source files: "
addproperty="scp.username" defaultvalue="${env.USER}"/>
<input message="The homedirectory of the user: "
addproperty="scp.home" defaultvalue="${env.HOME}"/>
<input message="Passphrase: "
addproperty="scp.passphrase"/>
<scp file="${src.file}"
todir="${scp.username}@download.libvirt.org:/data/ftp/libvirt/java"
keyfile="${scp.home}/.ssh/id_rsa"
sftp="true"
passphrase="${scp.passphrase}"/>
</target>
<target name="publish_srpm" depends="build" description="publish the srpm">
<input message="Username for copying source files: "
addproperty="scp.username" defaultvalue="${env.USER}"/>
<input message="The homedirectory of the user: "
addproperty="scp.home" defaultvalue="${env.HOME}"/>
<input message="Passphrase: "
addproperty="scp.passphrase"/>
<scp todir="${scp.username}@download.libvirt.org:/data/ftp/libvirt/java"
keyfile="${scp.home}/.ssh/id_rsa"
sftp="true"
passphrase="${scp.passphrase}">
<fileset dir="${rpm.topdir}/SRPMS">
<include name="libvirt-java-${version}-${release}*.src.rpm"/>
</fileset>
</scp>
</target>
</project>