SQL Workbench/J Git Repository https://www.sql-workbench.eu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

140 lines
5.5 KiB

<?xml version="1.0"?>
<project name="website" default="no-dev" basedir=".">
<path id="script.path">
<pathelement location="bsf.jar"/>
<pathelement location="commons-logging-1.1.jar"/>
<pathelement location="js.jar"/>
</path>
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="../../manual/libs/xmltask-v1.16.jar"/>
<property file="..\scripts\release.property"/>
<target name="update-rss">
<tstamp>
<format pattern="EEE, dd MMM yyyy HH:mm:ss +0200" property="pubDate" locale="en"/>
</tstamp>
<xslt in="../scripts/history.xml"
out="history_rss.txt"
style="history2rss.xslt">
</xslt>
<loadfile property="rss.description" srcFile="history_rss.txt"/>
<xmltask source="wb_news.xml" dest="wb_news.xml" outputter="simple" encoding="UTF-8">
<insert path="/rss/channel/item[1]" position="before" expandProperties="true">
<![CDATA[
<item>
<title>New ${pub.build.name} build (${pub.build.number}) released</title>
<description>${rss.description}</description>
<link>${rss.url}</link>
<guid>sql-workbench-build-${pub.build.number}</guid>
<author>support@sql-workbench.eu (Thomas Kellerer)</author>
<pubDate>${pubDate}</pubDate>
</item>
]]>
</insert>
</xmltask>
<!-- <delete file="history_rss.txt"/> -->
</target>
<scriptdef name="get-filesize" language="javascript" classpathref="script.path">
<attribute name="file"/>
<![CDATA[
fileName = attributes.get("file");
propName = attributes.get("property");
file = new java.io.File(fileName);
size = file.length();
sizeKB = size >> 10;
sizeMB = sizeKB / 1024;
symb = new java.text.DecimalFormatSymbols();
symb.setDecimalSeparator('.');
f = new java.text.DecimalFormat("#.##", symb);
project.setNewProperty("filesize", size);
project.setNewProperty("filesizeKB", sizeKB);
project.setNewProperty("filesizeMB", f.format(sizeMB));
]]>
</scriptdef>
<target name="update-pad">
<tstamp>
<format pattern="yyyy" property="pub.year"/>
</tstamp>
<tstamp>
<format pattern="MM" property="pub.month"/>
</tstamp>
<tstamp>
<format pattern="dd" property="pub.day"/>
</tstamp>
<property name="distfile" value="Workbench-Build${pub.build.number}.zip"/>
<get-filesize file="../release/build${pub.build.number}/${distfile}"/>
<xmltask source="workbench_pad.xml" dest="workbench_pad.xml" encoding="UTF-8" outputter="simple">
<replace path="/XML_DIZ_INFO/Program_Info/Program_Version/text()" withText="${release.build.number}"/>
<replace path="/XML_DIZ_INFO/Program_Info/Program_Release_Year/text()" withText="${pub.year}"/>
<replace path="/XML_DIZ_INFO/Program_Info/Program_Release_Month/text()" withText="${pub.month}"/>
<replace path="/XML_DIZ_INFO/Program_Info/Program_Release_Day/text()" withText="${pub.day}"/>
<replace path="/XML_DIZ_INFO/Program_Info/File_Info/File_Size_Bytes/text()" withText="${filesize}"/>
<replace path="/XML_DIZ_INFO/Program_Info/File_Info/File_Size_K/text()" withText="${filesizeKB}"/>
<replace path="/XML_DIZ_INFO/Program_Info/File_Info/File_Size_MB/text()" withText="${filesizeMB}"/>
<replace path="/XML_DIZ_INFO/Web_Info/Download_URLs/Primary_Download_URL/text()" withText="https://www.sql-workbench.eu/${distfile}"/>
</xmltask>
</target>
<target name="clean">
<delete failonerror="false">
<fileset dir=".">
<include name="*.html"/>
<include name="history_rss.txt"/>
</fileset>
</delete>
</target>
<target name="release" depends="set-release-build, make-html, update-rss, update-pad"/>
<target name="dev-release" depends="set-dev-build, make-html, update-rss"/>
<target name="no-dev" depends="set-release-build, make-html"/>
<target name="with-dev" depends="set-dev-build, make-html"/>
<target name="set-release-build">
<property name="pub.build.name" value="stable"/>
<property name="pub.build.number" value="${release.build.number}"/>
<property name="dev.build" value="0"/>
<property name="rss.url" value="https://www.sql-workbench.eu/downloads.html"/>
</target>
<target name="set-dev-build">
<property name="pub.build.name" value="development"/>
<property name="pub.build.number" value="${dev.build.number}"/>
<property name="dev.build" value="1"/>
<property name="rss.url" value="https://www.sql-workbench.eu/dev-download.html"/>
</target>
<target name="make-html" depends="clean">
<tstamp>
<format pattern="yyyy-MM-dd" property="currentDate"/>
</tstamp>
<dirname property="current.dir" file="build.xml"/>
<xslt in="workbench.xml" out="${current.dir}/index.html" destdir="${current.dir}" style="workbench.xslt" force="true">
<param name="filedir" expressioN="${current.dir}"/>
<param name="buildNumber" expression="${release.build.number}"/>
<param name="devBuildDate" expression="${dev.build.date}"/>
<param name="devBuildNumber" expression="${dev.build.number}"/>
<param name="buildDate" expression="${release.build.date}"/>
<param name="includeDev" expression="${dev.build}"/>
<param name="currentDate" expression="${currentDate}"/>
</xslt>
</target>
</project>