JAL-1683 replace version and year in licence header when generating source tarsal
authorJim Procter <jprocter@issues.jalview.org>
Mon, 24 Oct 2016 21:20:48 +0000 (22:20 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 24 Oct 2016 21:20:48 +0000 (22:20 +0100)
build.xml

index d8f12e0..7235950 100755 (executable)
--- a/build.xml
+++ b/build.xml
 </target>
 <target name="sourcedist" description="create jalview source distribution" depends="init">
   <delete file="${source.dist.name}" />
-  <tar destfile="${source.dist.name}" compression="gzip">
-    <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
+  <!-- temporary copy of source to update timestamps -->
+  <copy todir="_sourcedist">
+    <fileset dir=".">
       <include name="LICENSE" />
       <include name="README" />
       <include name="build.xml" />
       <include name="utils/**/*" />
       <include name="${docDir}/**/*" />
       <include name="examples/**/*" />
+    </fileset>
+  </copy>
+
+  <tstamp prefix="build">
+    <format property="year" pattern="yyyy" />
+  </tstamp>
+  <replace value="${JALVIEW_VERSION}">
+    <replacetoken>
+      <![CDATA[$$Version-Rel$$]]>
+    </replacetoken>
+    <fileset dir="_sourcedist">
+      <include name="**/*" />
+    </fileset>
+  </replace>
+  <replace dir="_sourcedist" value="${build.year}">
+    <replacetoken>
+      <![CDATA[$$Year-Rel$$]]>
+    </replacetoken>
+    <fileset dir="_sourcedist">
+      <include name="**/*" />
+    </fileset>
+  </replace>
+
+  <tar destfile="${source.dist.name}" compression="gzip">
+    <tarfileset dir="_sourcedist/" prefix="jalview" preserveLeadingSlashes="true">
     </tarfileset>
   </tar>
+
+  <delete dir="_sourcedist" />
 </target>
 <target name="prepubapplet_1" depends="makeApplet">
   <copy todir="${packageDir}/examples">