20eb275a32330f31e4b530e6113dea4ad0a4365f
[jalview.git] / buildcore.xml
1 <project name="JSmol" default="toJs" basedir=".">
2
3   <taskdef resource="net/sf/antcontrib/antcontrib.properties">
4     <classpath>
5       <pathelement location="./utils/ant-contrib-1.0b3.jar" />
6     </classpath>
7   </taskdef>
8
9   <target name="build-all-cores" id="build-all-cores">
10     <foreach target="CallToJs" param="classlist">
11       <path>
12         <fileset dir="./classlists/" includes="*.txt" />
13       </path>
14     </foreach>
15   </target>
16
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     <propertyregex property="core.name" input="${classlist}" replace="" regexp="\.txt"/>
19     <antcall target="toJs"/>
20   </target>
21
22   <target name="toJs" id="toJs">
23     <!-- sensible defaults for default target -->
24     <property name="site.path" value="site/swingjs" />
25     <property name="core.name" value="_jalview" />
26     <property name="classlist"  
27       description="Class list .txt generated by java2script classloader to be bundled into corefile - default is _j2sclasslist.txt" 
28       value="_j2sclasslist.txt" />
29     <!-- create a NON svn local directory only containing JS files
30         
31         <echo>Deleting the site directory.</echo>
32                 <delete quiet="true" dir="site" />
33     -->
34
35     <!-- make core files -->
36
37     <echo>creating and compressing core files - warnings are OK; "does not exist" is trouble</echo>
38     <echo>reading core class list from file coreclasses</echo>
39     <loadresource property="coreclasses">
40       <file file="${classlist}"/>
41     </loadresource>
42
43     <antcall target="call-core">
44       <param name="call-core.name" value="${core.name}" />
45       <param name="call-core.list" value="
46                         core/coreswingjs.js
47                 ${coreclasses}
48                 " />
49     </antcall>
50
51     <echo>......Now copy an html file in site/ and add   core:"${core.name}",    to the Info block.</echo>
52
53   </target>
54
55
56   <target name="call-core" id="call-core">
57     <echo>......Creating core${call-core.name}.js</echo>
58     <concat destfile="${site.path}/js/core/tmp.js">
59       <filelist dir="${site.path}/j2s" files="${call-core.list}" />
60     </concat>
61
62     <replace dir="${site.path}/js/core" includes="tmp.js" token="Clazz." value="Clazz_"/>
63     <replace dir="${site.path}/js/core" includes="tmp.js" token="Clazz__" value="Clazz._"/>
64     <echo>......Generating ${site.path}/j2s/core/core${call-core.name}.js</echo>
65     <concat destfile="${site.path}/j2s/core/core${call-core.name}.js">
66       <filelist dir="${site.path}/js" files="
67                         core/coretop2.js
68                         core/tmp.js
69                         core/corebottom2.js
70                         " />
71     </concat>
72     <echo>......Generating ${site.path}/j2s/core/core${call-core.name}.z.js</echo>
73     <java jar="tools/closure_compiler.jar" fork="true" dir="${site.path}/j2s/core" failonerror="false">
74       <arg line="--js core${call-core.name}.js --js_output_file core${call-core.name}.z.js" />
75     </java>
76     <delete quiet="true" file="${site.path}/js/core/tmp.js" />
77   </target>
78
79
80
81 </project>