This repository was archived by the owner on Aug 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.xml
More file actions
158 lines (148 loc) · 5.59 KB
/
build.xml
File metadata and controls
158 lines (148 loc) · 5.59 KB
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
<project name="openark kit" default="dist" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="/usr/share/java/ant-contrib.jar"/>
</classpath>
</taskdef>
<property name="python.distribution.dir" value="py-dist"/>
<property name="debian.distribution.dir" value="deb-dist"/>
<property name="rpm.distribution.dir" value="rpm-dist"/>
<property name="doc.templates.dir" value="doc/templates"/>
<property name="doc.html.dir" value="doc/html"/>
<target name="clean">
<delete dir="build"/>
<delete dir="dist"/>
<delete dir="${python.distribution.dir}"/>
<delete dir="${debian.distribution.dir}"/>
<delete dir="${rpm.distribution.dir}"/>
</target>
<target name="revnumber" description="Get the SVN greatest revision number">
<mkdir dir="ant-tmp"/>
<exec dir="." executable="svn" output="ant-tmp/svn_output" failifexecutionfails="false" description="Get SVN info for all files recursively">
<arg value="info"/>
<arg value="--recursive"/>
</exec>
<exec dir="." executable="awk" input="ant-tmp/svn_output" outputproperty="svn.revision" failifexecutionfails="false" description="Extract highest revision number">
<arg value="BEGIN {max=0} /Revision:/ {if ($2 > max) max=$2} END {print max}"/>
</exec>
<condition property="svn.revision" value="0">
<not>
<isset property="svn.revision"/>
</not>
</condition>
<delete dir="ant-tmp"/>
<tstamp description="To be used as build number"/>
<echo>revision: ${svn.revision}</echo>
</target>
<target name="scripts" depends="revnumber">
<mkdir dir="build/scripts"/>
<copy todir="build/scripts">
<fileset dir="src/oak">
<exclude name="**/__init__.py"/>
</fileset>
<globmapper from="*.py" to="*"/>
</copy>
</target>
<target name="python-module" depends="scripts">
<mkdir dir="${python.distribution.dir}"/>
<copy file="py-dist-cfg/setup.py" todir="build"/>
<replace file="build/setup.py" token="revision.placeholder" value="${svn.revision}"/>
<copy file="py-dist-cfg/MANIFEST.in" todir="build"/>
<copy todir="build/">
<fileset dir="doc"/>
</copy>
<exec dir="build" executable="python">
<arg value="setup.py"/>
<arg value="sdist"/>
</exec>
<move todir="${python.distribution.dir}">
<fileset dir="build/dist"/>
</move>
</target>
<target name="deb" depends="scripts">
<mkdir dir="${debian.distribution.dir}/openark-kit/usr/bin"/>
<mkdir dir="${debian.distribution.dir}/openark-kit/DEBIAN"/>
<copy todir="${debian.distribution.dir}/openark-kit/DEBIAN">
<fileset dir="deb-dist-cfg/control"/>
</copy>
<replace file="${debian.distribution.dir}/openark-kit/DEBIAN/control" token="revision.placeholder" value="${svn.revision}"/>
<copy todir="${debian.distribution.dir}/openark-kit/usr/bin">
<fileset dir="build/scripts"/>
</copy>
<chmod perm="755">
<fileset dir="${debian.distribution.dir}/openark-kit/usr/bin"/>
</chmod>
<exec dir="${debian.distribution.dir}" executable="dpkg-deb">
<arg value="--build"/>
<arg value="openark-kit"/>
<arg value="openark-kit-${svn.revision}-1.deb"/>
</exec>
</target>
<target name="rpm" depends="revnumber, scripts">
<mkdir dir="${rpm.distribution.dir}"/>
<copy file="py-dist-cfg/setup.py" todir="build"/>
<replace file="build/setup.py" token="revision.placeholder" value="${svn.revision}"/>
<copy file="py-dist-cfg/MANIFEST.in" todir="build"/>
<copy todir="build/">
<fileset dir="doc"/>
</copy>
<exec dir="build" executable="python">
<arg value="setup.py"/>
<arg value="bdist_rpm"/>
</exec>
<move todir="${rpm.distribution.dir}">
<fileset dir="build/dist"/>
</move>
</target>
<target name="dist" depends="clean, deb, rpm, python-module">
<mkdir dir="dist"/>
<copy todir="dist">
<fileset dir="py-dist"/>
</copy>
<copy todir="dist">
<fileset dir="${debian.distribution.dir}">
<include name="*.deb"/>
</fileset>
<fileset dir="${rpm.distribution.dir}">
<include name="*.rpm"/>
</fileset>
</copy>
<echo>dist: rev ${svn.revision}</echo>
</target>
<target name="doc">
<foreach param="tooldoc_filename" target="tooldoc">
<path>
<fileset dir="${doc.templates.dir}/tools">
<include name="*.html"/>
</fileset>
</path>
</foreach>
<foreach param="generaldoc_filename" target="generaldoc">
<path>
<fileset dir="${doc.templates.dir}/general">
<include name="*.html"/>
</fileset>
</path>
</foreach>
</target>
<target name="tooldoc">
<basename property="doc_basename" file="${tooldoc_filename}"/>
<basename property="toolname" file="${tooldoc_filename}" suffix=".html"/>
<echo message="Generating documentation for ${toolname} tool" />
<concat destfile="${doc.html.dir}/${doc_basename}">
<filelist dir="${doc.templates.dir}" files="head.html.template, ${tooldoc_filename}, tail.html.template"/>
</concat>
<replace file="${doc.html.dir}/${doc_basename}" token="pagetitle" value="${toolname}"/>
<replace file="${doc.html.dir}/${doc_basename}" token="pagename" value="${toolname}"/>
</target>
<target name="generaldoc">
<basename property="doc_basename" file="${generaldoc_filename}"/>
<basename property="docname" file="${generaldoc_filename}" suffix=".html"/>
<echo message="Generating documentation for ${docname} file" />
<concat destfile="${doc.html.dir}/${doc_basename}">
<filelist dir="${doc.templates.dir}" files="head.html.template, ${generaldoc_filename}, tail.html.template"/>
</concat>
<replace file="${doc.html.dir}/${doc_basename}" token="pagetitle" value="${docname}"/>
<replace file="${doc.html.dir}/${doc_basename}" token="pagename" value="${docname}"/>
</target>
</project>