aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-12-21 14:11:25 +0100
committerReinier Zwitserloot <reinier@tipit.to>2009-12-21 14:11:25 +0100
commita12675e120cf6c1924f46a48089d65ebe703b0d7 (patch)
treeea84f8cf93f90e2415c889fca090b1275fc72bed
parent9dd81c336165fe36373a0136aa66cc04ff6ce873 (diff)
downloadlombok-a12675e120cf6c1924f46a48089d65ebe703b0d7.tar.gz
lombok-a12675e120cf6c1924f46a48089d65ebe703b0d7.tar.bz2
lombok-a12675e120cf6c1924f46a48089d65ebe703b0d7.zip
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.
-rw-r--r--build.xml7
-rw-r--r--buildScripts/src/lombok/website/CompileChangelog.java36
-rw-r--r--buildScripts/website.ant.xml52
-rw-r--r--website/download-edge.html63
-rw-r--r--website/download.html5
5 files changed, 158 insertions, 5 deletions
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
<target name="publish-all" depends="clean, version, website-publish, maven-publish, publish"
description="Publishes lombok itself, updates the maven repository, and the website" />
+ <target name="edge-release" depends="clean, version, dist"
+ description="Publishes an edge release for those who need to test a cutting edge build">
+ <ant antfile="buildScripts/website.ant.xml" target="edgeRelease" inheritAll="false">
+ <property name="lombok.version" value="${lombok.version}" />
+ </ant>
+ </target>
+
<target name="website" depends="version" description="Prepares the website for distribution">
<ant antfile="buildScripts/website.ant.xml" target="website" inheritAll="false">
<property name="lombok.version" value="${lombok.version}" />
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.
</copy>
</target>
+ <target name="edgeRelease-build" depends="-compile-webclasses, version">
+ <mkdir dir="build/website-edge" />
+ <property name="CHANGELOG_FILE" location="doc/changelog.markdown" />
+ <property name="CHANGELOG_HTML" location="build/website-edge/changelog-edge.html" />
+ <java fork="true" classname="lombok.website.CompileChangelog" failonerror="true">
+ <classpath>
+ <path refid="buildScripts.deps.path" />
+ <pathelement location="build/webclasses" />
+ </classpath>
+ <arg value="${CHANGELOG_FILE}" />
+ <arg value="${CHANGELOG_HTML}" />
+ <arg value="-edge" />
+ <arg value="${lombok.version}" />
+ </java>
+ <loadfile property="changelog.edge" srcFile="build/website-edge/changelog-edge.html" encoding="UTF-8" />
+
+ <copy todir="build/website-edge" overwrite="true">
+ <fileset dir="website">
+ <include name="download-edge.html" />
+ </fileset>
+ <filterchain>
+ <replacetokens>
+ <token key="VERSION-EDGE" value="${lombok.version}" />
+ <token key="CHANGELOG-EDGE" value="${changelog.edge}" />
+ </replacetokens>
+ </filterchain>
+ </copy>
+
+ <delete file="build/website-edge/changelog-edge.html" />
+ <copy file="dist/lombok.jar" tofile="build/website-edge/lombok-edge.jar" />
+
+ <tar destfile="dist/website-edge.tar.bz2" compression="bzip2">
+ <tarfileset dir="build/website-edge" />
+ </tar>
+ </target>
+
+ <target name="edgeRelease" depends="edgeRelease-build">
+ <available file="libertad-upload.key" property="libertad.key.available" />
+ <fail unless="libertad.key.available">You don't have the libertad-upload.key; you'll need it to get write access to the server.</fail>
+
+ <scp
+ localFile="dist/website-edge.tar.bz2"
+ todir="lombokup@projectlombok.org:/staging"
+ keyfile="libertad-upload.key" passphrase=""
+ sftp="true" verbose="true" trust="true" />
+ <sshexec
+ host="projectlombok.org"
+ username="lombokup"
+ keyfile="libertad-upload.key" passphrase=""
+ trust="true" command="./deployEdge" />
+ </target>
+
<target name="changelogToHtml" depends="-compile-webclasses">
<mkdir dir="build/website" />
<property name="CHANGELOG_FILE" location="doc/changelog.markdown" />
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 @@
+<!DOCTYPE html>
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link rel="stylesheet" type="text/css" href="logi/reset.css" />
+ <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
+ <meta name="description" content="Spice up your java" />
+ <title>Project Lombok - Cutting Edge build</title>
+ <style type="text/css">
+ code {
+ font-size: 12px;
+ font-family: monospaced;
+ }
+
+ #downloadLink {
+ font-size: 14px;
+ }
+
+ .meat {
+ margin: 16px auto 0 auto;
+ width: 800px;
+ }
+
+ .backLink {
+ padding-top: 100px;
+ width: 100%;
+ text-align: right;
+ }
+
+ h1 {
+ padding-bottom: 0;
+ margin-bottom: 4px;
+ }
+ </style>
+</head><body>
+ <div class="meat download edge">
+ <h1>Download Lombok Cutting Edge build</h1>
+ <div class="versionInfo">
+ version: @VERSION-EDGE@
+ </div>
+ <p id="changelog">
+ @CHANGELOG-EDGE@
+ </p>
+ <a href="lombok-edge.jar" id="downloadLink">
+ Download now!
+ </a>
+ <p>
+ Cutting edge a bit too gutsy for you? You can grab the <a href="download.html">stable release</a> instead.
+ </p>
+ <div class="backLink">
+ <a href="index.html">back to the project homepage</a>
+ </div>
+ </div>
+ <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-9884254-1");
+ pageTracker._trackPageview();
+ } catch(err) {}
+ </script>
+</body></html>
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 @@
<link rel="stylesheet" type="text/css" href="logi/reset.css" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<meta name="description" content="Spice up your java" />
- <title>Project Lombok</title>
+ <title>Project Lombok - Download</title>
<style type="text/css">
code {
font-size: 12px;
@@ -51,6 +51,9 @@
<p>
<a href="mavenrepo/index.html">Using maven? Click here!</a>
</p>
+ <p>
+ Interested in the cutting edge build? More information on the <a href="download-edge.html">cutting edge</a> page.
+ </p>
<div class="backLink">
<a href="index.html">back to the project homepage</a>
</div>