mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 18:15:55 +00:00
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.
This commit is contained in:
1 parent
9dd81c3361
commit
a12675e120
5 files changed
+158
-5
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
Reference in new issue
Block a user