From a12675e120cf6c1924f46a48089d65ebe703b0d7 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 21 Dec 2009 14:11:25 +0100 Subject: Added support to fully automatically upload a cutting edge build to projectlombok.org, as well as a page with information about it, gathered from the changelog. --- build.xml | 7 +++ .../src/lombok/website/CompileChangelog.java | 36 +++++++++++-- buildScripts/website.ant.xml | 52 ++++++++++++++++++ website/download-edge.html | 63 ++++++++++++++++++++++ website/download.html | 5 +- 5 files changed, 158 insertions(+), 5 deletions(-) create mode 100644 website/download-edge.html diff --git a/build.xml b/build.xml index 006a546b..f7171052 100644 --- a/build.xml +++ b/build.xml @@ -104,6 +104,13 @@ the common tasks and can be called on to run the main aspects of all the sub-scr + + + + + + diff --git a/buildScripts/src/lombok/website/CompileChangelog.java b/buildScripts/src/lombok/website/CompileChangelog.java index 2508f237..60b70aa3 100644 --- a/buildScripts/src/lombok/website/CompileChangelog.java +++ b/buildScripts/src/lombok/website/CompileChangelog.java @@ -4,12 +4,20 @@ import com.petebevin.markdown.MarkdownProcessor; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class CompileChangelog { public static void main(String[] args) { + String fileIn = args[0]; + String fileOut = args[1]; + boolean edge = args.length > 3 && "-edge".equals(args[2]); + String version = edge ? args[3] : null; + try { - FileInputStream in = new FileInputStream(args[0]); + FileInputStream in = new FileInputStream(fileIn); ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] b = new byte[65536]; while (true) { int r = in.read(b); @@ -18,9 +26,11 @@ public class CompileChangelog { } in.close(); String markdown = new String(out.toByteArray(), "UTF-8"); - String html = new MarkdownProcessor().markdown(markdown); - FileOutputStream file = new FileOutputStream(args[1]); - file.write(html.getBytes("UTF-8")); + + String result = edge ? buildEdge(markdown, version) : build(markdown); + + FileOutputStream file = new FileOutputStream(fileOut); + file.write(result.getBytes("UTF-8")); file.close(); System.exit(0); } catch (Throwable e) { @@ -28,4 +38,22 @@ public class CompileChangelog { System.exit(1); } } + + private static String build(String markdown) { + return new MarkdownProcessor().markdown(markdown); + } + + private static final Pattern LAST_CHANGELOG = Pattern.compile( + "^.*### v$", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); + private static String buildEdge(String markdown, String version) { + if (version.toUpperCase().endsWith("-HEAD") || version.toUpperCase().endsWith("-EDGE")) { + version = version.substring(0, version.length() - 5); + } + + Pattern p = Pattern.compile( + "(?is-m)^.*###\\s*v" + version + ".*?\n(.*?)(?:###\\s*v.*)?$"); + Matcher m = p.matcher(markdown); + String subMarkdown = m.matches() ? m.group(1) : "* No changelog records for this edge release."; + return new MarkdownProcessor().markdown(subMarkdown); + } } diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml index 2f125edb..13a8ff18 100644 --- a/buildScripts/website.ant.xml +++ b/buildScripts/website.ant.xml @@ -208,6 +208,58 @@ such as converting the changelog into HTML, and creating javadoc. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + You don't have the libertad-upload.key; you'll need it to get write access to the server. + + + + + diff --git a/website/download-edge.html b/website/download-edge.html new file mode 100644 index 00000000..4cf794a6 --- /dev/null +++ b/website/download-edge.html @@ -0,0 +1,63 @@ + + + + + + + Project Lombok - Cutting Edge build + + +
+

Download Lombok Cutting Edge build

+
+ version: @VERSION-EDGE@ +
+

+ @CHANGELOG-EDGE@ +

+ + Download now! + +

+ Cutting edge a bit too gutsy for you? You can grab the stable release instead. +

+ +
+ + + diff --git a/website/download.html b/website/download.html index cc8ac1c5..3eb4fa7d 100644 --- a/website/download.html +++ b/website/download.html @@ -4,7 +4,7 @@ - Project Lombok + Project Lombok - Download