JAL-3033 update the eclipse project before building, edit class path, and copy artefa...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 25 Jun 2018 15:48:00 +0000 (16:48 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 25 Jun 2018 15:48:00 +0000 (16:48 +0100)
build.xml

index dbe9f71..1b2aac1 100755 (executable)
--- a/build.xml
+++ b/build.xml
   <property name="eclipse-exec" value="${eclipse-inst}/eclipse"/>
   <property name="site" value="site"/>
   <!-- where the eclipse js workspace has been initialised -->
-  <property name="eclipse-work" value="/cluster/gjb_lab/jprocter/eclipse-js-workspace"/>
-  
-  <!-- execute eclipse build, trap log and dump to stdout here -->
+  <property name="eclipse-work" value="/home/bamboo/buildtools/eclipse/eclipse-js-workspace"/>
+  <!-- git repository linked to project in workspace -->
+  <property name="eclipse-workrepo" value="/home/bamboo/buildtools/eclipse/eclipse-js-workspace/jalview-js"/>
+    
+  <!-- update transpiler -->
   <copy file="${swingjsdir}/net.sf.j2s.core.jar" todir="${eclipse-inst}/dropins"/>
+  <!-- update the git repo linked to the eclipse workspace -->
+  <exec executable="/usr/bin/git" outputproperty="git.commit" failifexecutionfails="true">
+    <arg value="rev-parse" />
+    <arg value="--short" />
+    <arg value="HEAD" />
+  </exec>
+  <!-- and checkout the same commit in the workspace project -->
+  <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
+  <arg value="checkout" />
+  <arg value="${git.commit}" />
+  </exec>
   
-  <!-- the build may fail but valid javascript may still be produced, so we ignore return codes -->
+  <copyfile src="${eclipse-workrepo}/.classpath.js" dest="${eclipse-workrepo}/.classpath"/>
+  
+  <!-- execute the eclipse build - the build may fail but valid javascript may still be produced, so we ignore return codes -->
   <exec executable="${eclipse-exec}" failonerror="no">
     <arg value="-nosplash"/>
     <arg value="--launcher.suppressErrors"/>
     <arg value="-data"/>
     <arg value="${eclipse-work}"/>
   </exec>
-
+    
   <!-- TODO: run jslint and something else here to check we have a complete set of .js files for java -->
   <!-- possibly compare timestamps between .js files and their mate in source - any newer or not present triggers a new build -->
   <!-- <mkdir dir="${packageDir}/${site}" /> -->
   <!--   <property name="swingjs.zipurl" value="https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip?raw=true" /> -->
+  
+  <!-- and reset the .classpath -->
+  <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
+      <arg value="checkout" />
+      <arg value="${git.commit} .classpath" />
+      </exec>
+  
+  <!-- finally copy artefacts from eclipse project checkout to the build site -->
+  <copydir src="${eclipse-workrepo}/site" dest="${site}"/>
+  
   <property name="swingjs.zip" value="${swingjsdir}/SwingJS-site.zip" />
   <unzip src="${swingjs.zip}" dest="${site}/" overwrite="true"/>
   <copy todir="${site}/swingjs/j2s/">
        <include name="**"/>
        </fileset>
   </copy>
+  
   <copy todir="${site}/examples">
   <fileset dir="examples">
   <include name="*.*"/>