Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

adding build.xml support so that dist jar contains the commit id in m…

…eta-data
  • Loading branch information...
commit 53a1d635d53874e21b9744789dead480b4caac2c 1 parent 3481984
Xiaoyang Gu xiaoyang authored

Showing 2 changed files with 35 additions and 2 deletions. Show diff stats Hide diff stats

  1. +7 0 .gitignore
  2. +28 2 build.xml
7 .gitignore
... ... @@ -0,0 +1,7 @@
  1 +build
  2 +dist
  3 +doc
  4 +ivy
  5 +lib
  6 +build-test
  7 +SerialDocSet
30 build.xml
@@ -123,8 +123,34 @@
123 123 </target>
124 124
125 125 <echo>"jar destfile is : ${dist}/${project.name}-${version}.jar"</echo>
126   - <target name="jar" depends="compile">
127   - <jar destfile="${dist}/${project.name}-${version}.jar" basedir="${build}" />
  126 + <target name="gitversion" description="--> create git version information">
  127 + <exec executable="git" outputproperty="gitversion">
  128 + <arg value="log" />
  129 + <arg value="-1" />
  130 + <arg value="--pretty=oneline" />
  131 + </exec>
  132 + <exec executable="git" outputproperty="gitusername">
  133 + <arg value="config" />
  134 + <arg value="--get" />
  135 + <arg value="user.name" />
  136 + </exec>
  137 + <exec executable="git" outputproperty="gituseremail">
  138 + <arg value="config" />
  139 + <arg value="--get" />
  140 + <arg value="user.email" />
  141 + </exec>
  142 + </target>
  143 + <target name="jar" depends="compile,gitversion">
  144 + <tstamp>
  145 + <format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
  146 + </tstamp>
  147 + <manifest file="MANIFEST.MF">
  148 + <attribute name="Built-By" value="${gitusername} ${gituseremail}" />
  149 + <attribute name="Git-Version" value="${gitversion}" />
  150 + <attribute name="Built-Date" value="${TODAY}" />
  151 + </manifest>
  152 + <jar destfile="${dist}/${project.name}-${version}.jar" manifest="MANIFEST.MF" basedir="${build}" />
  153 + <delete file="MANIFEST.MF"/>
128 154 </target>
129 155 <target name="javadoc" depends="init">
130 156 <javadoc packagenames="com.kamikaze.*" sourcepath="src" defaultexcludes="yes" destdir="${doc}" author="true" version="true" use="true" windowtitle="Kamikaze">

0 comments on commit 53a1d63

Please sign in to comment.
Something went wrong with that request. Please try again.