JAL-3442 (Aug 28 commit) option to use/not use cache
[jalview.git] / buildcore.xml
index 20eb275..1ca110a 100644 (file)
@@ -6,7 +6,7 @@
     </classpath>
   </taskdef>
 
-  <target name="build-all-cores" id="build-all-cores">
+  <target name="build-all-cores" id="build-all-cores" depends="toJs">
     <foreach target="CallToJs" param="classlist">
       <path>
         <fileset dir="./classlists/" includes="*.txt" />
   </target>
 
   <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">
-    <propertyregex property="core.name" input="${classlist}" replace="" regexp="\.txt"/>
+    <basename property="core.name.txt" file="${classlist}"/>
+    <propertyregex property="core.name" input="${core.name.txt}" replace="" regexp="\.txt"/>
     <antcall target="toJs"/>
   </target>
 
   <target name="toJs" id="toJs">
     <!-- sensible defaults for default target -->
-    <property name="site.path" value="site/swingjs" />
-    <property name="core.name" value="_jalview" />
+    <property name="site" value="site"/>
+    <property name="site.path" value="${site}/swingjs" />
+    
+       <property name="core.name" value="_jalview" />
     <property name="classlist"  
-      description="Class list .txt generated by java2script classloader to be bundled into corefile - default is _j2sclasslist.txt" 
+      description="Class list generated by java2script classloader to be bundled into corefile - default is _j2sclasslist.txt" 
       value="_j2sclasslist.txt" />
+       
+    <property name="core.name.jmol" value="_jvjmol" />
+    <property name="classlist.jmol"  
+      value="_j2sclasslist_jmol.txt" />
+       
     <!-- create a NON svn local directory only containing JS files
        
        <echo>Deleting the site directory.</echo>
                <delete quiet="true" dir="site" />
     -->
 
+       
+       <!-- concatentate the stevesoft files -->
+    <concat destfile="${site.path}/j2s/com/stevesoft/core.js">
+        <fileset dir="${site.path}/j2s/com/stevesoft/pat">
+          <include name="**/*.js" />
+        </fileset>
+    </concat>
+    <antcall target="call-core">
+      <param name="call-core.name" value="_stevesoft" />
+      <param name="call-core.list" value="com/stevesoft/core.js" />
+    </antcall>
+
+
+       <!-- compress the jmol files -->
+    
+       <loadresource property="coreclassesjmol">
+      <file file="${classlist.jmol}"/>
+    </loadresource>
+
+    <antcall target="call-core">
+      <param name="call-core.name" value="${core.name.jmol}" />
+      <param name="call-core.list" value="
+               ${coreclassesjmol}
+               " />
+    </antcall>
+       
     <!-- make core files -->
 
-    <echo>creating and compressing core files - warnings are OK; "does not exist" is trouble</echo>
-    <echo>reading core class list from file coreclasses</echo>
+    <echo>Building core file '${core.name}' - warnings are OK; "does not exist" is trouble</echo>
+    <echo>Reading core class list from file ${classlist}</echo>
     <loadresource property="coreclasses">
       <file file="${classlist}"/>
     </loadresource>
 
+       <!-- removing                   core/coreswingjs.js  -->
+
     <antcall target="call-core">
       <param name="call-core.name" value="${core.name}" />
       <param name="call-core.list" value="
-                       core/coreswingjs.js
                ${coreclasses}
                " />
     </antcall>
+    <antcall target="publish-core-template"/>
+  </target>
+
+  <target name="publish-core-template" id="publish-core-template" description="Creates a new file ${template.name}_${core.name} from ${template.html} in ${site} which include core file ${core.name} in the Info block">
+    <!-- TODO: extend to process all html templates -->
+    <property name="template.html" value="jalview_bin_Jalview.html"/>
+    <property name="template.name" value="JalviewJS"/>
 
-    <echo>......Now copy an html file in site/ and add   core:"${core.name}",    to the Info block.</echo>
+    <echo>......Now copying ${site}/${template.html} as ${template.name}_${core.name}.html with core:"${core.name}", added to the Info block.</echo>
+    <copy file="${site}/${template.html}" tofile="${site}/${template.name}_${core.name}.html"/>
+    <replace token="NONE" value="${core.name}" file="${site}/${template.name}_${core.name}.html"/>
 
   </target>