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.
 
 
 
 

141 lines
5.4 KiB

  1. <?xml version="1.0"?>
  2. <project name="website" default="no-dev" basedir=".">
  3. <path id="script.path">
  4. <pathelement location="bsf.jar"/>
  5. <pathelement location="commons-logging-1.1.jar"/>
  6. <pathelement location="js.jar"/>
  7. </path>
  8. <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="../scripts/xmltask-v1.16.jar"/>
  9. <property file="..\scripts\release.property"/>
  10. <target name="update-rss">
  11. <tstamp>
  12. <format pattern="EEE, dd MMM yyyy HH:mm:ss +0200" property="pubDate" locale="en"/>
  13. </tstamp>
  14. <xslt in="../scripts/history.xml"
  15. out="history_rss.txt"
  16. style="history2rss.xslt">
  17. </xslt>
  18. <loadfile property="rss.description" srcFile="history_rss.txt"/>
  19. <xmltask source="wb_news.xml" dest="wb_news.xml" outputter="simple" encoding="UTF-8">
  20. <insert path="/rss/channel/item[1]" position="before" expandProperties="true">
  21. <![CDATA[
  22. <item>
  23. <title>New ${pub.build.name} build (${pub.build.number}) released</title>
  24. <description>${rss.description}</description>
  25. <link>${rss.url}</link>
  26. <guid>sql-workbench-build-${pub.build.number}</guid>
  27. <author>support@sql-workbench.eu (Thomas Kellerer)</author>
  28. <pubDate>${pubDate}</pubDate>
  29. </item>
  30. ]]>
  31. </insert>
  32. </xmltask>
  33. <!-- <delete file="history_rss.txt"/> -->
  34. </target>
  35. <scriptdef name="get-filesize" language="javascript" classpathref="script.path">
  36. <attribute name="file"/>
  37. <![CDATA[
  38. fileName = attributes.get("file");
  39. propName = attributes.get("property");
  40. file = new java.io.File(fileName);
  41. size = file.length();
  42. sizeKB = size >> 10;
  43. sizeMB = sizeKB / 1024;
  44. symb = new java.text.DecimalFormatSymbols();
  45. symb.setDecimalSeparator('.');
  46. f = new java.text.DecimalFormat("#.##", symb);
  47. project.setNewProperty("filesize", size);
  48. project.setNewProperty("filesizeKB", sizeKB);
  49. project.setNewProperty("filesizeMB", f.format(sizeMB));
  50. ]]>
  51. </scriptdef>
  52. <target name="update-pad">
  53. <tstamp>
  54. <format pattern="yyyy" property="pub.year"/>
  55. </tstamp>
  56. <tstamp>
  57. <format pattern="MM" property="pub.month"/>
  58. </tstamp>
  59. <tstamp>
  60. <format pattern="dd" property="pub.day"/>
  61. </tstamp>
  62. <property name="distfile" value="Workbench-Build${pub.build.number}.zip"/>
  63. <get-filesize file="../release/build${pub.build.number}/${distfile}"/>
  64. <xmltask source="workbench_pad.xml" dest="workbench_pad.xml" encoding="UTF-8" outputter="simple">
  65. <replace path="/XML_DIZ_INFO/Program_Info/Program_Version/text()" withText="${release.build.number}"/>
  66. <replace path="/XML_DIZ_INFO/Program_Info/Program_Release_Year/text()" withText="${pub.year}"/>
  67. <replace path="/XML_DIZ_INFO/Program_Info/Program_Release_Month/text()" withText="${pub.month}"/>
  68. <replace path="/XML_DIZ_INFO/Program_Info/Program_Release_Day/text()" withText="${pub.day}"/>
  69. <replace path="/XML_DIZ_INFO/Program_Info/File_Info/File_Size_Bytes/text()" withText="${filesize}"/>
  70. <replace path="/XML_DIZ_INFO/Program_Info/File_Info/File_Size_K/text()" withText="${filesizeKB}"/>
  71. <replace path="/XML_DIZ_INFO/Program_Info/File_Info/File_Size_MB/text()" withText="${filesizeMB}"/>
  72. <replace path="/XML_DIZ_INFO/Web_Info/Download_URLs/Primary_Download_URL/text()" withText="https://www.sql-workbench.eu/${distfile}"/>
  73. </xmltask>
  74. </target>
  75. <target name="clean">
  76. <delete failonerror="false">
  77. <fileset dir=".">
  78. <include name="*.html"/>
  79. <include name="history_rss.txt"/>
  80. </fileset>
  81. </delete>
  82. </target>
  83. <target name="release" depends="set-release-build, make-html, update-rss, update-pad"/>
  84. <target name="dev-release" depends="set-dev-build, make-html, update-rss"/>
  85. <target name="no-dev" depends="set-release-build, make-html"/>
  86. <target name="with-dev" depends="set-dev-build, make-html"/>
  87. <target name="set-release-build">
  88. <property name="pub.build.name" value="stable"/>
  89. <property name="pub.build.number" value="${release.build.number}"/>
  90. <property name="dev.build" value="0"/>
  91. <property name="rss.url" value="https://www.sql-workbench.eu/downloads.html"/>
  92. </target>
  93. <target name="set-dev-build">
  94. <property name="pub.build.name" value="development"/>
  95. <property name="pub.build.number" value="${dev.build.number}"/>
  96. <property name="dev.build" value="1"/>
  97. <property name="rss.url" value="https://www.sql-workbench.eu/dev-download.html"/>
  98. </target>
  99. <target name="make-html" depends="clean">
  100. <tstamp>
  101. <format pattern="yyyy-MM-dd" property="currentDate"/>
  102. </tstamp>
  103. <dirname property="current.dir" file="build.xml"/>
  104. <xslt in="workbench.xml" out="${current.dir}/index.html" destdir="${current.dir}" style="workbench.xslt" force="true">
  105. <param name="filedir" expressioN="${current.dir}"/>
  106. <param name="buildNumber" expression="${release.build.number}"/>
  107. <param name="devBuildDate" expression="${dev.build.date}"/>
  108. <param name="devBuildNumber" expression="${dev.build.number}"/>
  109. <param name="buildDate" expression="${release.build.date}"/>
  110. <param name="includeDev" expression="${dev.build}"/>
  111. <param name="currentDate" expression="${currentDate}"/>
  112. </xslt>
  113. </target>
  114. </project>