1 <project name="JSmol" default="toJs" basedir=".">
3 <taskdef resource="net/sf/antcontrib/antcontrib.properties">
5 <pathelement location="./utils/ant-contrib-1.0b3.jar" />
9 <target name="build-all-cores" id="build-all-cores">
10 <foreach target="CallToJs" param="classlist">
12 <fileset dir="./classlists/" includes="*.txt" />
17 <target name="CallToJs" id="CallToJs" description="Don't call this directly - used by build-all-cores to configure the toJs task for each set of classes in classlist">
18 <basename property="core.name.txt" file="${classlist}"/>
19 <propertyregex property="core.name" input="${core.name.txt}" replace="" regexp="\.txt"/>
20 <antcall target="toJs"/>
23 <target name="toJs" id="toJs">
24 <!-- sensible defaults for default target -->
25 <property name="site.path" value="site/swingjs" />
26 <property name="core.name" value="_jalview" />
27 <property name="classlist"
28 description="Class list .txt generated by java2script classloader to be bundled into corefile - default is _j2sclasslist.txt"
29 value="_j2sclasslist.txt" />
30 <!-- create a NON svn local directory only containing JS files
32 <echo>Deleting the site directory.</echo>
33 <delete quiet="true" dir="site" />
36 <!-- make core files -->
38 <echo>creating and compressing core files - warnings are OK; "does not exist" is trouble</echo>
39 <echo>reading core class list from file coreclasses</echo>
40 <loadresource property="coreclasses">
41 <file file="${classlist}"/>
44 <antcall target="call-core">
45 <param name="call-core.name" value="${core.name}" />
46 <param name="call-core.list" value="
52 <echo>......Now copy an html file in site/ and add core:"${core.name}", to the Info block.</echo>
53 <copy file="site/jalview_bin_Jalview.html" tofile="site/JalviewJS_${core.name}.html"/>
54 <replace token="NONE" value="${core.name}" file="site/JalviewJS_${core.name}.html"/>
59 <target name="call-core" id="call-core">
60 <echo>......Creating core${call-core.name}.js</echo>
61 <concat destfile="${site.path}/js/core/tmp.js">
62 <filelist dir="${site.path}/j2s" files="${call-core.list}" />
65 <replace dir="${site.path}/js/core" includes="tmp.js" token="Clazz." value="Clazz_"/>
66 <replace dir="${site.path}/js/core" includes="tmp.js" token="Clazz__" value="Clazz._"/>
67 <echo>......Generating ${site.path}/j2s/core/core${call-core.name}.js</echo>
68 <concat destfile="${site.path}/j2s/core/core${call-core.name}.js">
69 <filelist dir="${site.path}/js" files="
75 <echo>......Generating ${site.path}/j2s/core/core${call-core.name}.z.js</echo>
76 <java jar="tools/closure_compiler.jar" fork="true" dir="${site.path}/j2s/core" failonerror="false">
77 <arg line="--js core${call-core.name}.js --js_output_file core${call-core.name}.z.js" />
79 <delete quiet="true" file="${site.path}/js/core/tmp.js" />