-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.xml
175 lines (151 loc) · 6.86 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
168
169
170
171
172
173
174
175
<project name="git-st" default="distrib">
<dirname property="project.dir" file="${ant.file}" />
<property name="project.name" value="${ant.project.name}" />
<property name="symbolic.name" value="com.aap.gitst" />
<property name="project.version" value="1.0.0" />
<tstamp>
<format property="build.date" pattern="dd.MM.yy" />
</tstamp>
<property name="src.dir" location="${project.dir}/src/java" />
<property name="build.dir" location="${project.dir}/build" />
<property name="build.classes.dir" location="${build.dir}/classes" />
<property name="bin.dir" location="${project.dir}/bin" />
<property name="config.dir" location="${project.dir}/config" />
<property name="lib.dir" location="${project.dir}/lib" />
<property name="jar.name" value="${project.name}.jar" />
<property name="jar.file" location="${build.dir}/${jar.name}" />
<property name="assemble.dir" location="${build.dir}/assemble" />
<property name="distrib.dir" location="${project.dir}/distribs" />
<property name="distrib.deb.dir" location="${distrib.dir}/${build.date}/deb" />
<property name="distrib.zip.dir" location="${distrib.dir}/${build.date}/zip" />
<property environment="env" />
<available file="dpkg-deb"
filepath="${env.PATH}"
property="dpkg-deb.available" />
<target name="compile11">
<mkdir dir="${build.classes.dir}" />
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
debug="true"
debuglevel="lines,vars,source"
includeantruntime="false"
excludes="com/starteam/**">
<classpath>
<path path="${lib.dir}/starteam110.jar" />
</classpath>
</javac>
<copy todir="${build.classes.dir}/META-INF">
<fileset dir="${project.dir}/META-INF" includes="**/**" />
<filterchain>
<replaceregex pattern="^Bundle-Version: .*$"
replace="Bundle-Version: ${project.version}" />
<replaceregex pattern="^Bundle-SymbolicName: .*$"
replace="Bundle-SymbolicName: ${symbolic.name}" />
</filterchain>
</copy>
</target>
<target name="compile12">
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
debug="true"
debuglevel="lines,vars,source"
includeantruntime="false"
includes="com/starteam/**">
<classpath>
<fileset dir="${lib.dir}" includes="*" excludes="starteam110.jar" />
</classpath>
</javac>
</target>
<target name="compile" depends="compile11, compile12" />
<target name="jar" depends="compile, compile12">
<dirname property="jar.dir" file="${jar.file}" />
<mkdir dir="${jar.dir}" />
<jar destfile="${jar.file}"
basedir="${build.classes.dir}"
manifest="${build.classes.dir}/META-INF/MANIFEST.MF" />
</target>
<target name="assemble-zip" depends="jar">
<property name="assemble.zip.dir" location="${assemble.dir}/zip" />
<property name="assemble.zip.git-core"
location="${assemble.zip.dir}/git-core" />
<delete dir="${assemble.zip.dir}" />
<copy todir="${assemble.zip.git-core}" file="${jar.file}" />
<copy todir="${assemble.zip.git-core}">
<fileset dir="${bin.dir}" includes="*" />
</copy>
<chmod perm="a+x" file="${assemble.zip.git-core}/git-st" />
<chmod perm="a+x" file="${assemble.zip.git-core}/git-remote-st" />
<chmod perm="a+x" file="${assemble.zip.git-core}/git-remote-starteam" />
</target>
<target name="distrib-zip" depends="assemble-zip">
<mkdir dir="${distrib.zip.dir}"/>
<zip destfile="${distrib.zip.dir}/${project.name}_${project.version}.zip">
<zipfileset dir="${assemble.zip.dir}"
includes="**/**"
excludes="**/git-st, **/git-remote-*" />
<zipfileset dir="${assemble.zip.dir}"
filemode="755"
includes="**/git-st, **/git-remote-*" />
</zip>
</target>
<target name="distrib-deb" if="dpkg-deb.available">
<mkdir dir="${distrib.deb.dir}"/>
<antcall target="-distrib-deb">
<param name="arch" value="amd64" />
</antcall>
<antcall target="-distrib-deb">
<param name="arch" value="i386" />
</antcall>
</target>
<target name="distrib" depends="distrib-zip, distrib-deb" />
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${distrib.dir}" />
</target>
<target name="-distrib-deb">
<condition property="a" value="_${arch}" else="">
<not>
<equals arg1="${arch}" arg2="all" />
</not>
</condition>
<property name="assemble.deb.dir" location="${assemble.dir}/deb${a}" />
<delete dir="${assemble.deb.dir}" />
<copy todir="${assemble.deb.dir}/usr/lib/git-core" file="${jar.file}" />
<copy tofile="${assemble.deb.dir}/usr/lib/git-core/libgit-st.so"
file="${lib.dir}/libgit-st${a}.so"
failonerror="false" />
<copy todir="${assemble.deb.dir}/usr/lib/git-core">
<fileset dir="${bin.dir}" includes="*" />
<filterchain>
<replacetokens>
<token key="JAR_NAME" value="'${jar.name}'" />
</replacetokens>
</filterchain>
</copy>
<chmod perm="a+x" file="${assemble.deb.dir}/usr/lib/git-core/git-st" />
<chmod perm="a+x"
file="${assemble.deb.dir}/usr/lib/git-core/git-remote-st" />
<chmod perm="a+x"
file="${assemble.deb.dir}/usr/lib/git-core/git-remote-starteam" />
<exec executable="sh" outputproperty="size">
<arg value="-c" />
<arg value="du -s ${assemble.deb.dir} | awk '{print $1}'" />
</exec>
<echo file="${assemble.deb.dir}/DEBIAN/control">Package: ${project.name}
Version: ${project.version}
Architecture: ${arch}
Maintainer: Andrey Pavlenko
Installed-Size: ${size}
Section: vcs
Homepage: http://code.google.com/p/${project.name}/
Description: Git remote helper for StarTeam.
This remote helper allows Git to interact with remote StarTeam repositories.
</echo>
<exec executable="fakeroot">
<arg value="dpkg-deb" />
<arg value="-b" />
<arg file="${assemble.deb.dir}" />
<arg value="${distrib.deb.dir}/${project.name}_${project.version}${a}.deb" />
</exec>
</target>
</project>