<get url="${java2scriptURL}" dest="eclipse-inst/dropins/net.sf.j2s.core.jar" /> -->
</target>
-<target name="build-site" depends="init,prepare">
+
+<target name="build-site" depends="init,prepare,compile-site,unzip-to-site">
+ <!-- closure compile -->
+ <!-- tarball -->
+ <tar compression="gzip" destfile="site.tar.gz">
+ <tarfileset dir="site" />
+ </tar>
+</target>
+<target name="prepare-site" depends="init,prepare">
<property name="swingjsdir" value="swingjs"/>
<property name="eclipse-inst" value="/home/bamboo/buildtools/eclipse/eclipse-js"/>
<property name="eclipse-exec" value="${eclipse-inst}/eclipse"/>
<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"/>
-
+</target>
+<target name="compile-site" depends="prepare-site">
<!-- update transpiler -->
<copy file="${swingjsdir}/net.sf.j2s.core.jar" todir="${eclipse-inst}/dropins" overwrite="true" failonerror="true"/>
<!-- update the git repo linked to the eclipse workspace -->
</exec>
<!-- update and checkout the same commit in the workspace project -->
<exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
- <arg value="pull" />
+ <arg value="pull" />
</exec>
<exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
- <arg value="checkout" />
- <arg value="${git.commit}" />
+ <arg value="checkout" />
+ <arg value="${git.commit}" />
</exec>
<!-- custom classpath for .js builds -->
<copy file=".classpath.js" tofile="${eclipse-workrepo}/.classpath" overwrite="true"/>
-
+
<!-- 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="-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}"/>
+ <arg value="checkout" />
+ <arg value="${git.commit}"/>
<arg value="--"/>
<arg value=".classpath" />
- </exec>
-
+ </exec>
+
<!-- finally copy artefacts from eclipse project checkout to the build site -->
<copy todir="${site}">
<fileset dir="${eclipse-workrepo}/site"/>
</copy>
-
+</target>
+<target name="unzip-to-site" depends="prepare-site">
<property name="swingjs.zip" value="${swingjsdir}/SwingJS-site.zip" />
- <unzip src="${swingjs.zip}" dest="${site}/" overwrite="true"/>
- <copy todir="${site}/swingjs/j2s/">
+ <unzip dest="${site}/" overwrite="true">
+ <fileset dir="${swingjsdir}">
+ <include name="SwingJS-site.zip"/>
+ </fileset>
+ </unzip>
+ <unzip dest="${site}/" overwrite="true">
+ <fileset dir="libjs">
+ <include name="*.zip" />
+ </fileset>
+ </unzip>
+ <copy overwrite="true" todir="${site}/swingjs/j2s/">
<fileset dir="${resourceDir}">
- <include name="**"/>
- </fileset>
+ <include name="**"/>
+ </fileset>
</copy>
-
+
<!-- copy test files into place in site -->
<copy todir="${site}/examples">
- <fileset dir="examples">
- <include name="*.*"/>
+ <fileset dir="examples">
+ <include name="*.*"/>
</fileset>
</copy>
- <!-- closure compile -->
- <!-- tarball -->
- <tar compression="gzip" destfile="site.tar.gz">
- <tarfileset dir="site"/>
- </tar>
</target>
</project>