JAL-3337 publish help as html pages with GA tracker (ant task rescued from old build...
authorJim Procter <jprocter@issues.jalview.org>
Tue, 2 Jul 2019 11:01:57 +0000 (12:01 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 2 Jul 2019 11:01:57 +0000 (12:01 +0100)
build.gradle
utils/publishHelp.xml [new file with mode: 0644]

index 995afaf..9c57524 100644 (file)
@@ -747,6 +747,12 @@ task linkCheck(type: JavaExec) {
   outputs.file(helplinkscheckertouchfile)
 }
 
+// import the pubhtmlhelp target
+ant.properties.basedir = "$jalviewDir"
+ant.properties.helpBuildDir = jalviewDirAbsolutePath+"/$classes/$helpDir"
+ant.importBuild "$utilsDir/publishHelp.xml"
+
+
 task cleanPackageDir(type: Delete) {
   delete fileTree("$jalviewDir/$packageDir").include("*.jar")
 }
@@ -1204,3 +1210,10 @@ task sourceDist (type: Tar) {
 
 }
 
+task helppages  {
+  dependsOn copyHelp
+  dependsOn pubhtmlhelp
+  
+  inputs.dir("$classes/$helpDir")
+  outputs.file("build/distribution/help/helpTOC.html")
+}
\ No newline at end of file
diff --git a/utils/publishHelp.xml b/utils/publishHelp.xml
new file mode 100644 (file)
index 0000000..17ef9e2
--- /dev/null
@@ -0,0 +1,64 @@
+<project name="Publish Help Webpages for Jalview" default="pubhtmlhelp">
+
+<target name="pubhtmlhelp">
+  <property name="appletHelpDir" value="../build/distribution/help"/>
+        <!-- finally, publish the help files -->
+        <javac srcdir="." destdir="." includes="help2Website.java"/>
+        <java fork="true" dir="${helpBuildDir}" classpath="." classname="help2Website"/>
+        <delete dir="${appletHelpDir}"/>
+        <copy preservelastmodified="true" overwrite="true" 
+           todir="${appletHelpDir}">
+          <fileset dir="${helpBuildDir}">
+            <include name="*htm*"/>
+            <include name="icons/**.*"/>
+            <include name="html/**/*.*"/>
+            <exclude name="**/CVS"/>
+            <exclude name="CVS"/>
+          </fileset>
+        </copy>
+        <replace dir="${appletHelpDir}">
+        <include name="**/*.htm*"/>
+        <replacetoken><![CDATA[</body>]]></replacetoken>
+        <replacevalue><![CDATA[
+<script type="text/javascript">
+    var gaJsHost = (("https:" == document.location.protocol) ?
+        "https://ssl." : "http://www.");
+    document.write(unescape("%3Cscript src=\'" + gaJsHost +
+        "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try{
+    var pageTracker = _gat._getTracker("'UA-9060947-1'");
+    pageTracker._trackPageview();
+} catch(err) {}
+</script>
+</body>
+]]></replacevalue>
+</replace>
+<echo file="${appletHelpDir}/help.html">
+<![CDATA[<html><head>
+<title>Jalview Documentation</title>
+</head>
+<frameset cols="300,*">
+<frame src="helpTOC.html" name=tocframe scrolling=yes >
+<frame src="html/index.html" name=bodyframe >
+<noframes><body>
+This page requires a browser that supports frames.
+<script type="text/javascript">
+    var gaJsHost = (("https:" == document.location.protocol) ?
+        "https://ssl." : "http://www.");
+    document.write(unescape("%3Cscript src=\'" + gaJsHost +
+        "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try{
+    var pageTracker = _gat._getTracker("'UA-9060947-1'");
+    pageTracker._trackPageview();
+} catch(err) {}
+</script></body>
+<noframes></frameset>
+</html>
+]]></echo>
+
+  </target>
+</project>