/build.xml

http://jmxtrans.googlecode.com/ · XML · 329 lines · 281 code · 42 blank · 6 comment · 0 complexity · bb80502ae0430284efb12d57bd771f92 MD5 · raw file

  1. <?xml version="1.0"?>
  2. <!--
  3. Build file for jmxtrans.
  4. -->
  5. <project name="jmxtrans" default="jar" basedir=".">
  6. <property name="name" value="${ant.project.name}" />
  7. <property name="base.dir" location="." />
  8. <property file="user.properties" />
  9. <property file="${user.home}/build.properties" />
  10. <property file="jar.properties"/>
  11. <property name="alexandria.home" value="${base.dir}" />
  12. <property file="${alexandria.home}/jar.properties" />
  13. <property file="build.credentials.properties" />
  14. <property name="target.dir" location="target" />
  15. <property name="build.dir" location="${target.dir}" />
  16. <property name="build.classes.dir" location="${build.dir}/classes" />
  17. <property name="build.javadoc.dir" location="${build.dir}/javadoc" />
  18. <property name="build.jar.file" location="${build.dir}/${name}.jar" />
  19. <property name="javadoc.dir" value="javadoc" />
  20. <property name="lib.dir" location="lib" />
  21. <property name="src.dir" location="src" />
  22. <tstamp>
  23. <format property="NOW" pattern="yyyyMMdd-hh:mm:ss" />
  24. <!-- Wed, 19 Jan 2011 18:19:37 -0800 -->
  25. <format property="PROPER_NOW" pattern="E, dd MMM yyyy hh:mm:ss ZZ" />
  26. <format property="YEAR" pattern="yyyy" />
  27. </tstamp>
  28. <typedef resource="com/googlecode/sweetened/sweetened.xml" classpath="${alexandria.home}/${sweetened.jar}:${alexandria.home}/${svnkit.jar}" />
  29. <sweetenedVersion />
  30. <taskdef resource="net/sf/antcontrib/antlib.xml">
  31. <classpath>
  32. <pathelement location="${alexandria.home}/${ant-contrib.jar}"/>
  33. </classpath>
  34. </taskdef>
  35. <spath id="sweetened.classpath">
  36. <sfilelist dir="${alexandria.home}">
  37. <sfile name="${commons-cli.jar}" scope="compile" src="${alexandria.home}/${commons-cli.src}" />
  38. <sfile name="${commons-codec.jar}" scope="compile" src="${alexandria.home}/${commons-codec.src}" />
  39. <sfile name="${commons-io.jar}" scope="compile" src="${alexandria.home}/${commons-io.src}" />
  40. <sfile name="${commons-lang.jar}" scope="compile" src="${alexandria.home}/${commons-lang.src}" />
  41. <sfile name="${commons-logging.jar}" scope="compile" src="${alexandria.home}/${commons-logging.src}" />
  42. <sfile name="${commons-pool.jar}" scope="compile" src="${alexandria.home}/${commons-pool.src}" />
  43. <sfile name="${jackson-core.jar}" scope="compile" src="${alexandria.home}/${jackson.src}" />
  44. <sfile name="${jackson-mapper.jar}" scope="compile" src="${alexandria.home}/${jackson.src}" />
  45. <sfile name="${jpathwatch.jar}" scope="compile" />
  46. <sfile name="${jrobin.jar}" scope="compile" src="${alexandria.home}/${jrobin.src}" />
  47. <sfile name="${junit.jar}" scope="unit" src="${alexandria.home}/${junit.src}" />
  48. <sfile name="${log4j.jar}" scope="compile" src="${alexandria.home}/${log4j.src}" />
  49. <sfile name="${quartz.jar}" scope="compile" src="${alexandria.home}/${quartz.src}" />
  50. <sfile name="${slf4j-api.jar}" scope="compile" src="${alexandria.home}/${slf4j-api.src}" />
  51. <sfile name="${slf4j-log4j.jar}" scope="runtime" src="${alexandria.home}/${slf4j-log4j.src}" />
  52. <sfile name="${velocity.jar}" scope="compile" src="${alexandria.home}/${velocity.src}" />
  53. </sfilelist>
  54. </spath>
  55. <spath id="javac.classpath" scope="compile" parent="sweetened.classpath" />
  56. <spath id="javadoc.classpath" scope="all" parent="sweetened.classpath" />
  57. <spath id="unit.classpath" scope="all" parent="sweetened.classpath" />
  58. <spath id="all.classpath" scope="all" parent="sweetened.classpath" />
  59. <path id="run.classpath">
  60. <pathelement location="${build.classes.dir}" />
  61. <path refid="master.classpath" />
  62. </path>
  63. <target name="init">
  64. <typedef resource="com/googlecode/svntask/svntask.xml">
  65. <classpath>
  66. <fileset dir="${lib.dir}">
  67. <include name="**/svnkit.jar"/>
  68. <include name="**/svntask.jar"/>
  69. </fileset>
  70. </classpath>
  71. </typedef>
  72. <svn><info path="${basedir}" revisionProperty="revisionVersion" /></svn>
  73. <taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" classpath="${lib.dir}/ant-googlecode-0.0.2.jar" name="gcupload"/>
  74. <!-- A hack because svnant does not respect Ant's properties can't be overwritten rule. -->
  75. <property name="version" value="${revisionVersion}" />
  76. <property name="build.version" value="${revisionVersion}" />
  77. <property name="build.dist.dir" location="${build.dir}/${ant.project.name}-${version}"/>
  78. <property name="build.dist.zip" location="${build.dir}/${ant.project.name}-${version}.zip"/>
  79. </target>
  80. <target name="clean">
  81. <delete dir="${build.dir}" />
  82. </target>
  83. <target name="classes" depends="init">
  84. <mkdir dir="${build.classes.dir}" />
  85. <javac srcdir="${src.dir}"
  86. destdir="${build.classes.dir}"
  87. optimize="off"
  88. deprecation="off"
  89. debug="on"
  90. debuglevel="lines,vars,source"
  91. source="1.5"
  92. target="1.5"
  93. encoding="UTF-8"
  94. verbose="off"
  95. fork="false"
  96. includeantruntime="false"
  97. >
  98. <classpath path="${toString:javac.classpath}"/>
  99. </javac>
  100. </target>
  101. <target name="jar" depends="classes">
  102. <sync todir="${build.classes.dir}">
  103. <preserveintarget>
  104. <include name="**/*.class"/>
  105. </preserveintarget>
  106. <fileset dir="src" defaultexcludes="yes">
  107. <include name="**/*.xml"/>
  108. <include name="**/*.properties"/>
  109. </fileset>
  110. </sync>
  111. <jar destfile="${build.jar.file}" basedir="${build.classes.dir}">
  112. <manifest>
  113. <attribute name="Specification-Version" value="${version}" />
  114. <attribute name="Implementation-Version" value="${TODAY}" />
  115. <attribute name="Main-Class" value="com.googlecode.jmxtrans.JmxTransformer" />
  116. </manifest>
  117. </jar>
  118. </target>
  119. <target name="jar-all" depends="jar">
  120. <zip destfile="${build.dir}/jmxtrans-all.jar">
  121. <zipgroupfileset dir="lib">
  122. <include name="*.jar" />
  123. <exclude name="ant*.jar" />
  124. <exclude name="*sources*.jar" />
  125. <exclude name="*junit*.jar" />
  126. <exclude name="*svn*.jar" />
  127. </zipgroupfileset>
  128. <zipgroupfileset dir="${build.dir}" includes="jmxtrans.jar"/>
  129. </zip>
  130. </target>
  131. <target name="javadoc" depends="classes">
  132. <javadoc
  133. destdir="${build.javadoc.dir}"
  134. packagenames="*"
  135. author="true"
  136. version="true"
  137. Windowtitle="jmxlogger javadoc"
  138. >
  139. <fileset dir="${src.dir}">
  140. <exclude name="**/*.xml" />
  141. <exclude name="**/*.properties" />
  142. </fileset>
  143. <doctitle><![CDATA[<h1>jmxtrans</h1>]]></doctitle>
  144. <bottom><![CDATA[<i>Copyright &#169; ${YEAR} Jon Stevens and a gang of pencils. All Rights Reserved. Build version: ${build.version}</i>]]></bottom>
  145. <classpath path="${toString:javadoc.classpath}" />
  146. </javadoc>
  147. <sync todir="${javadoc.dir}" includeEmptyDirs="true">
  148. <fileset dir="${build.javadoc.dir}" />
  149. <preserveintarget>
  150. <include name="**/.svn/**"/>
  151. </preserveintarget>
  152. </sync>
  153. </target>
  154. <target name="dist" depends="clean, jar, jar-all, javadoc">
  155. <copy todir="${build.dist.dir}">
  156. <fileset dir="${build.dir}">
  157. <include name="javadoc/**" />
  158. </fileset>
  159. <fileset dir="${base.dir}">
  160. <include name="*.xml" />
  161. <include name="*.json" />
  162. <include name="*.sh" />
  163. <include name="README.html" />
  164. <exclude name="test-*.json" />
  165. <exclude name="*.log" />
  166. <exclude name="build.credentials.properties" />
  167. </fileset>
  168. <fileset dir="${build.dir}">
  169. <include name="*.jar" />
  170. </fileset>
  171. </copy>
  172. <copy todir="${build.dist.dir}/lib">
  173. <fileset dir="lib">
  174. <include name="*.jar" />
  175. <exclude name="*-sources.jar" />
  176. </fileset>
  177. </copy>
  178. <copy todir="${build.dist.dir}/src">
  179. <fileset dir="${base.dir}/src">
  180. <include name="**" />
  181. </fileset>
  182. </copy>
  183. <dirname property="build.dist.dir.dirname" file="${build.dist.dir}" />
  184. <basename property="build.dist.dir.basename" file="${build.dist.dir}" />
  185. <zip zipfile="${build.dist.zip}" basedir="${build.dist.dir.dirname}">
  186. <include name="${build.dist.dir.basename}/**" />
  187. </zip>
  188. </target>
  189. <target name="debian" depends="dist">
  190. <filter token="PACKAGE" value="jmxtrans" />
  191. <filter token="NOW" value="${NOW}" />
  192. <filter token="PROPER_NOW" value="${PROPER_NOW}" />
  193. <filter token="YEAR" value="${YEAR}" />
  194. <filter token="FULL_VERSION" value="${sVersion}" />
  195. <filter token="VERSION" value="${sVersionRevision}" />
  196. <filter token="BRANCH_NAME" value="${sVersionBranchName}" />
  197. <copy todir="${target.dir}/jmxtrans/debian" filtering="true">
  198. <fileset dir="debian">
  199. <include name="**"/>
  200. </fileset>
  201. </copy>
  202. <unzip src="${build.dist.zip}" dest="${target.dir}/jmxtrans/debian/tmp/usr/share" />
  203. <move todir="${target.dir}/jmxtrans/debian/tmp/usr/share/jmxtrans">
  204. <fileset dir="${target.dir}/jmxtrans/debian/tmp/usr/share/jmxtrans-${sVersionRevision}">
  205. <include name="**"/>
  206. </fileset>
  207. </move>
  208. <chmod file="${target.dir}/jmxtrans/debian/rules" perm="ugo+rx"/>
  209. <exec executable="/usr/bin/debuild" dir="${target.dir}/jmxtrans" failonerror="true">
  210. <arg line="-b"/>
  211. </exec>
  212. </target>
  213. <target name="rpm" depends="dist">
  214. <copy todir="${target.dir}/jmxtrans/rpm" >
  215. <fileset dir="rpm">
  216. <include name="**"/>
  217. </fileset>
  218. </copy>
  219. <mkdir dir="${target.dir}/jmxtrans/rpm/BUILD" />
  220. <mkdir dir="${target.dir}/jmxtrans/rpm/RPMS" />
  221. <mkdir dir="${target.dir}/jmxtrans/rpm/SRPMS" />
  222. <mkdir dir="${target.dir}/jmxtrans/rpm/TEMP" />
  223. <copy file="${build.dist.zip}" todir="${target.dir}/jmxtrans/rpm/SOURCES"/>
  224. <exec executable="/usr/bin/rpmbuild" dir="${target.dir}/jmxtrans/rpm" failonerror="true">
  225. <arg line="-ba --define='_topdir ${target.dir}/jmxtrans/rpm' --define='_tmppath ${target.dir}/jmxtrans/rpm/TEMP' --define='VERSION ${version}' --define='RELEASE 0' --define='JMXTRANS_SOURCE jmxtrans-${version}.zip' SPECS/jmxtrans.spec"/>
  226. </exec>
  227. </target>
  228. <target name="upload" depends="init">
  229. <gcupload projectname="${ant.project.name}"
  230. userName="${gc.username}"
  231. password="${gc.password}"
  232. filename="${build.dist.zip}"
  233. targetfilename="${build.dist.zip}"
  234. summary="${ant.project.name} distribution"
  235. labels="Featured, Type-Package, OpSys-All" />
  236. <!-- hacky, but need both path to file and filename -->
  237. <path id="file.deb">
  238. <fileset dir="${target.dir}" includes="*.deb" />
  239. </path>
  240. <property name="file.deb.path" refid="file.deb" />
  241. <pathconvert property="file.deb.target" targetos="unix">
  242. <path>
  243. <fileset dir="${target.dir}" includes="*.deb" />
  244. </path>
  245. <mapper type="flatten"/>
  246. </pathconvert>
  247. <gcupload projectname="${ant.project.name}"
  248. userName="${gc.username}"
  249. password="${gc.password}"
  250. filename="${file.deb.path}"
  251. targetfilename="${file.deb.target}"
  252. summary="${ant.project.name} debian distribution"
  253. labels="Featured, Type-Installer, OpSys-Linux, Debian" />
  254. </target>
  255. <target name=".eclipse" description="Generate eclipse project metadata">
  256. <sweetenedClasspath file=".classpath">
  257. <sweetenedBits refid="unit.classpath" />
  258. <data>
  259. <classpath>
  260. <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  261. <sweetenedEntries />
  262. <classpathentry kind="src" path="src"/>
  263. <classpathentry kind="src" path="test"/>
  264. <classpathentry kind="output" path="_eclipse"/>
  265. </classpath>
  266. </data>
  267. </sweetenedClasspath>
  268. <echoxml file=".project">
  269. <projectDescription>
  270. <name>${name}-${sVersionBranchName}</name>
  271. <comment></comment>
  272. <projects>
  273. </projects>
  274. <buildSpec>
  275. <buildCommand>
  276. <name>org.eclipse.jdt.core.javabuilder</name>
  277. <arguments>
  278. </arguments>
  279. </buildCommand>
  280. </buildSpec>
  281. <natures>
  282. <nature>org.eclipse.jdt.core.javanature</nature>
  283. </natures>
  284. </projectDescription>
  285. </echoxml>
  286. </target>
  287. </project>