diff options
-rw-r--r-- | build.xml | 10 | ||||
-rw-r--r-- | buildScripts/src/lombok/website/CompileChangelog.java | 36 | ||||
-rw-r--r-- | buildScripts/website.ant.xml | 13 | ||||
-rw-r--r-- | doc/changelog.markdown | 4 | ||||
-rw-r--r-- | src/installer/lombok/installer/InstallerGUI.java | 164 |
5 files changed, 182 insertions, 45 deletions
@@ -232,7 +232,13 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor</echo> <echo file="build/lombok/META-INF/services/org.mapstruct.ap.spi.AstModifyingAnnotationProcessor">lombok.launch.AnnotationProcessorHider$AstModificationNotifier</echo> </target> - <target name="dist" description="Builds THE lombok.jar file which contains everything." depends="version, compile"> + <target name="-latestChanges" depends="version"> + <ant antfile="buildScripts/website.ant.xml" target="latestChanges" inheritAll="false"> + <property name="lombok.version" value="${lombok.version}" /> + </ant> + </target> + + <target name="dist" description="Builds THE lombok.jar file which contains everything." depends="version, compile, -latestChanges"> <mkdir dir="dist" /> <copy file="doc/changelog.markdown" tofile="build/changelog.txt" /> <tstamp> @@ -240,7 +246,7 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor</echo> </tstamp> <echo file="release-timestamp.txt">${releaseTimestamp}</echo> <zip destfile="dist/lombok-${lombok.version}.jar"> - <fileset dir="build" includes="changelog.txt" /> + <fileset dir="build" includes="changelog.txt, latestchanges.html" /> <fileset dir="." includes="LICENSE" /> <fileset dir="." includes="AUTHORS" /> <fileset dir="." includes="release-timestamp.txt" /> diff --git a/buildScripts/src/lombok/website/CompileChangelog.java b/buildScripts/src/lombok/website/CompileChangelog.java index 60b70aa3..276842be 100644 --- a/buildScripts/src/lombok/website/CompileChangelog.java +++ b/buildScripts/src/lombok/website/CompileChangelog.java @@ -1,18 +1,20 @@ package lombok.website; -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; +import com.petebevin.markdown.MarkdownProcessor; + 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; + boolean latest = args.length > 3 && "-latest".equals(args[2]); + String version = args.length > 3 ? args[3] : null; try { FileInputStream in = new FileInputStream(fileIn); @@ -27,7 +29,14 @@ public class CompileChangelog { in.close(); String markdown = new String(out.toByteArray(), "UTF-8"); - String result = edge ? buildEdge(markdown, version) : build(markdown); + String result; + if (edge) { + result = buildEdge(sectionByVersion(markdown, version)); + } else if (latest) { + result = buildLatest(sectionByVersion(markdown, version)); + } else { + result = build(markdown); + } FileOutputStream file = new FileOutputStream(fileOut); file.write(result.getBytes("UTF-8")); @@ -43,9 +52,19 @@ public class CompileChangelog { 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) { + private static String buildEdge(String section) { + String latest = section != null ? section : "* No changelog records for this edge release."; + return new MarkdownProcessor().markdown(latest); + } + + private static String buildLatest(String section) { + String latest = section != null ? section : "* No changelog records for this release."; + String noIssueLinks = latest.replaceAll("\\[[^]]*[Ii]ssue[^]]*\\]\\([^)]*\\)", ""); + String noLinks = noIssueLinks.replaceAll("\\[([^]]*)\\]\\([^)]*\\)", "$1"); + return new MarkdownProcessor().markdown(noLinks); + } + + private static String sectionByVersion(String markdown, String version) { if (version.toUpperCase().endsWith("-HEAD") || version.toUpperCase().endsWith("-EDGE")) { version = version.substring(0, version.length() - 5); } @@ -53,7 +72,6 @@ public class CompileChangelog { 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); + return m.matches() ? m.group(1) : null; } -} +}
\ No newline at end of file diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml index 19b995d3..c1c780ae 100644 --- a/buildScripts/website.ant.xml +++ b/buildScripts/website.ant.xml @@ -243,6 +243,19 @@ such as converting the changelog into HTML, and creating javadoc. </copy> </target> + <target name="latestChanges" depends="-compile-webclasses, version"> + <java fork="true" classname="lombok.website.CompileChangelog" failonerror="true"> + <classpath> + <path refid="build.path" /> + <pathelement location="build/webclasses" /> + </classpath> + <arg value="doc/changelog.markdown" /> + <arg value="build/latestchanges.html" /> + <arg value="-latest" /> + <arg value="${lombok.version}" /> + </java> + </target> + <target name="edgeRelease-build" depends="-compile-webclasses, version"> <mkdir dir="build/website-edge" /> <property name="CHANGELOG_FILE" location="doc/changelog.markdown" /> diff --git a/doc/changelog.markdown b/doc/changelog.markdown index f29da540..cc038fa9 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -4,8 +4,8 @@ Lombok Changelog ### v1.16.13 "Edgy Guinea Pig" * v1.16.12 is the latest stable release of Project Lombok. * FEATURE: Generated classes, methods and fields are now also annotated with `@lombok.Generated` [Issue #1014](https://github.com/rzwitserloot/lombok/issues/1014) -* PLATFORM: Lombok can now be used together with other annotation processors that are looking for lombok-generated methods, but only if lombok is the first annotation processor executed. The most commonly used annotation processor affected by this change is [MapStruct](http://mapstruct.org/); we've worked with the mapstruct team specifically to allow any order. Other annotation processors might follow the framework we've built to make this possible; point the authors of any such processor to us and we'll get it sorted. [MapStruct issue #510](https://github.com/mapstruct/mapstruct/issues/510) [Lombok issue #973](https://github.com/rzwitserloot/lombok/issues/973). -* PLATFORM: Eclipse: Refactor script 'rename field' when lombok has also generated getters and/or setters for this field is nicer now [Issue #210](https://github.com/rzwitserloot/lombok/issues/210). +* PLATFORM: Lombok can now be used together with other annotation processors that are looking for lombok-generated methods, but only if lombok is the first annotation processor executed. The most commonly used annotation processor affected by this change is [MapStruct](http://mapstruct.org/); we've worked with the mapstruct team specifically to allow any order. Other annotation processors might follow the framework we've built to make this possible; point the authors of any such processor to us and we'll get it sorted [MapStruct issue #510](https://github.com/mapstruct/mapstruct/issues/510) [Lombok issue #973](https://github.com/rzwitserloot/lombok/issues/973) +* PLATFORM: Eclipse: Refactor script 'rename field' when lombok has also generated getters and/or setters for this field is nicer now [Issue #210](https://github.com/rzwitserloot/lombok/issues/210) ### v1.16.12 (December 5th, 2016) * FEATURE: `var` is the mutable sister of `val`. For now experimental, and opt-in using `ALLOW` in the flagUsage configuration key. Thanks for the contribution, Bulgakov Alexander. diff --git a/src/installer/lombok/installer/InstallerGUI.java b/src/installer/lombok/installer/InstallerGUI.java index ebdf2035..7a94d595 100644 --- a/src/installer/lombok/installer/InstallerGUI.java +++ b/src/installer/lombok/installer/InstallerGUI.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2016 The Project Lombok Authors. + * Copyright (C) 2009-2017 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -39,6 +39,8 @@ import java.awt.event.ActionListener; import java.awt.font.TextAttribute; import java.io.File; import java.io.FilenameFilter; +import java.io.InputStream; +import java.io.InputStreamReader; import java.net.URI; import java.util.ArrayList; import java.util.Collections; @@ -65,6 +67,8 @@ import javax.swing.JScrollPane; import javax.swing.Scrollable; import javax.swing.SwingUtilities; import javax.swing.filechooser.FileFilter; +import javax.swing.plaf.basic.BasicHTML; +import javax.swing.text.View; import lombok.core.Version; import lombok.installer.OsUtils.OS; @@ -85,6 +89,7 @@ public class InstallerGUI { private Component ideArea; private Component uninstallArea; private Component howIWorkArea; + private Component successArea; private Box uninstallBox; private JHyperLink uninstallButton; @@ -113,6 +118,8 @@ public class InstallerGUI { uninstallArea.setVisible(false); howIWorkArea = buildHowIWorkArea(); howIWorkArea.setVisible(false); + successArea = buildSuccessArea(); + successArea.setVisible(false); buildChrome(appWindow.getContentPane()); appWindow.pack(); } catch (Throwable t) { @@ -153,6 +160,7 @@ public class InstallerGUI { howIWorkArea.setVisible(false); javacArea.setVisible(true); ideArea.setVisible(true); + successArea.setVisible(false); appWindow.pack(); } }); @@ -160,9 +168,76 @@ public class InstallerGUI { constraints.gridy = 2; container.add(buttonBar, constraints); + container.setPreferredSize(new Dimension(462, 415)); return container; } + private void showSuccess(String installSpecific) { + successExplanation.setText(SUCCESS_EXPLANATION.replace("%%%", installSpecific)); + howIWorkArea.setVisible(false); + javacArea.setVisible(false); + ideArea.setVisible(false); + successArea.setVisible(true); + appWindow.pack(); + } + + private JLabel successExplanation; + + private Component buildSuccessArea() { + JPanel container = new JPanel(); + + container.setLayout(new GridBagLayout()); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.anchor = GridBagConstraints.WEST; + + container.add(new JLabel(SUCCESS_TITLE), constraints); + + constraints.gridy = 1; + constraints.insets = new Insets(8, 0, 0, 16); + container.add(successExplanation = new JLabel(SUCCESS_EXPLANATION), constraints); + + constraints.gridy++; + constraints.fill = GridBagConstraints.BOTH; + + JLabel notes = new JLabel(); + notes.setText(readChangeLog()); + + JScrollPane scroller = new JScrollPane(notes); + container.add(scroller, constraints); + scroller.setPreferredSize(new Dimension(380, 240)); + + View view = (View) notes.getClientProperty(BasicHTML.propertyKey); + view.setSize(380, 0.0f); + float w = view.getPreferredSpan(View.X_AXIS); + float h = view.getPreferredSpan(View.Y_AXIS); + notes.setSize((int) w, (int) h); + + container.setPreferredSize(new Dimension(462, 415)); + return container; + } + + private String readChangeLog() { + InputStream in = Installer.class.getResourceAsStream("/latestchanges.html"); + try { + char[] buff = new char[8192]; + StringBuilder contents = new StringBuilder(); + InputStreamReader reader = new InputStreamReader(in, "UTF-8"); + while (true) { + int read = reader.read(buff); + if (read == -1) break; + contents.append(buff, 0, read); + } + return "<html>" + contents + "</html>"; + } catch (Exception e) { + return "No Changelog available"; + } + finally { + try { + in.close(); + } catch (Exception ignore){ /**/} + } + } + private Component buildUninstallArea() { JPanel container = new JPanel(); @@ -210,6 +285,7 @@ public class InstallerGUI { constraints.gridy = 4; container.add(buttonBar, constraints); + container.setPreferredSize(new Dimension(462, 415)); return container; } @@ -232,6 +308,7 @@ public class InstallerGUI { constraints.gridy = 2; container.add(example, constraints); + container.setPreferredSize(new Dimension(462, 105)); return container; } @@ -419,7 +496,7 @@ public class InstallerGUI { uninstallPlaceholder.setVisible(false); container.add(uninstallPlaceholder, constraints); - + container.setPreferredSize(new Dimension(462, 296)); return container; } @@ -427,6 +504,7 @@ public class InstallerGUI { javacArea.setVisible(false); ideArea.setVisible(false); howIWorkArea.setVisible(true); + successArea.setVisible(false); appWindow.pack(); } @@ -453,6 +531,7 @@ public class InstallerGUI { spinner.setOpaque(true); spinner.setLayout(new FlowLayout()); spinner.add(new JLabel(new ImageIcon(Installer.class.getResource("loading.gif")))); + final Container appWindowContent = appWindow.getContentPane(); appWindow.setContentPane(spinner); final AtomicInteger successes = new AtomicInteger(); @@ -500,20 +579,13 @@ public class InstallerGUI { try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { + appWindow.setContentPane(appWindowContent); + appWindow.pack(); StringBuilder installSpecific = new StringBuilder(); for (String installSpecificMessage : installSpecificMessages) { installSpecific.append("<br>").append(installSpecificMessage); } - JOptionPane.showMessageDialog(appWindow, - "<html>Lombok has been installed on the selected IDE installations.<br>" + - "Don't forget to add <code>lombok.jar</code> to your projects, and restart your IDE!" + installSpecific.toString() + "</html>", - "Install successful", - JOptionPane.INFORMATION_MESSAGE); - appWindow.setVisible(false); - synchronized (exitMarker) { - exitMarker.set(0); - exitMarker.notifyAll(); - } + showSuccess(installSpecific.toString()); } }); } catch (Exception e) { @@ -711,6 +783,8 @@ public class InstallerGUI { appWindowContainer.add(howIWorkArea, constraints); + appWindowContainer.add(successArea, constraints); + constraints.gridy++; constraints.gridwidth = 2; constraints.gridx = 0; @@ -719,9 +793,33 @@ public class InstallerGUI { constraints.ipadx = 0; constraints.ipady = 0; constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.anchor = GridBagConstraints.SOUTHEAST; + constraints.anchor = GridBagConstraints.SOUTHWEST; constraints.insets = new Insets(0, 16, 8, 8); + + appWindow.add(buildButtonBar(), constraints); + } + + private Box buildButtonBar() { Box buttonBar = Box.createHorizontalBox(); + + JHyperLink aboutLink = new JHyperLink(Installer.ABOUT_LOMBOK_URL.toString()); + aboutLink.addActionListener(openBrowser(aboutLink, Installer.ABOUT_LOMBOK_URL)); + buttonBar.add(aboutLink); + + buttonBar.add(Box.createRigidArea(new Dimension(16, 1))); + + JLabel versionLabel = new JLabel(); + versionLabel.setText("v" + Version.getVersion()); + + buttonBar.add(versionLabel); + buttonBar.add(Box.createRigidArea(new Dimension(16, 1))); + + JHyperLink changelogLink = new JHyperLink("View full changelog"); + changelogLink.addActionListener(openBrowser(changelogLink, Installer.ABOUT_LOMBOK_URL.resolve("/changelog.html"))); + buttonBar.add(changelogLink); + + buttonBar.add(Box.createHorizontalGlue()); + JButton quitButton = new JButton("Quit Installer"); quitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -729,14 +827,18 @@ public class InstallerGUI { System.exit(0); } }); - final JHyperLink hyperlink = new JHyperLink(Installer.ABOUT_LOMBOK_URL.toString()); - hyperlink.addActionListener(new ActionListener() { + buttonBar.add(quitButton); + return buttonBar; + } + + private ActionListener openBrowser(final JHyperLink hyperlink, final URI location) { + return new ActionListener() { @Override public void actionPerformed(ActionEvent event) { hyperlink.setForeground(new Color(85, 145, 90)); try { //java.awt.Desktop doesn't exist in 1.5. Object desktop = Class.forName("java.awt.Desktop").getMethod("getDesktop").invoke(null); - Class.forName("java.awt.Desktop").getMethod("browse", URI.class).invoke(desktop, Installer.ABOUT_LOMBOK_URL); + Class.forName("java.awt.Desktop").getMethod("browse", URI.class).invoke(desktop, location); } catch (Exception e) { Runtime rt = Runtime.getRuntime(); try { @@ -746,34 +848,27 @@ public class InstallerGUI { cmd[0] = "cmd.exe"; cmd[1] = "/C"; cmd[2] = "start"; - cmd[3] = Installer.ABOUT_LOMBOK_URL.toString(); + cmd[3] = location.toString(); rt.exec(cmd); break; case MAC_OS_X: - rt.exec("open " + Installer.ABOUT_LOMBOK_URL.toString()); + rt.exec("open " + location.toString()); break; default: case UNIX: - rt.exec("firefox " + Installer.ABOUT_LOMBOK_URL.toString()); + rt.exec("firefox " + location.toString()); break; } } catch (Exception e2) { JOptionPane.showMessageDialog(appWindow, "Well, this is embarrassing. I don't know how to open a webbrowser.\n" + - "I guess you'll have to open it. Browse to:\n" + Installer.ABOUT_LOMBOK_URL + + "I guess you'll have to open it. Browse to:\n" + location + " for more information about Lombok.", "I'm embarrassed", JOptionPane.INFORMATION_MESSAGE); } } } - }); - buttonBar.add(hyperlink); - buttonBar.add(Box.createRigidArea(new Dimension(16, 1))); - buttonBar.add(new JLabel("<html><font size=\"-1\">v" + Version.getVersion() + "</font></html>")); - - buttonBar.add(Box.createHorizontalGlue()); - buttonBar.add(quitButton); - appWindow.add(buttonBar, constraints); + }; } /** @@ -791,7 +886,7 @@ public class InstallerGUI { } private static final String IDE_TITLE = - "<html><font size=\"+1\"><b><i>IDEs</i></b></font></html>"; + "<html><font size=\"+1\"><b><i>IDEs </i></b></font></html>"; private static final String IDE_EXPLANATION = "<html>Lombok can update your Eclipse or eclipse-based IDE to fully support all Lombok features.<br>" + @@ -801,7 +896,7 @@ public class InstallerGUI { "Scanning your drives for IDE installations..."; private static final String JAVAC_TITLE = - "<html><font size=\"+1\"><b><i>Javac</i></b></font> (and tools that invoke javac such as <i>ant</i> and <i>maven</i>)</html>"; + "<html><font size=\"+1\"><b><i>Javac </i></b></font> (and tools that invoke javac such as <i>ant</i> and <i>maven</i>)</html>"; private static final String JAVAC_EXPLANATION = "<html>Lombok works 'out of the box' with javac.<br>Just make sure the lombok.jar is in your classpath when you compile."; @@ -810,13 +905,13 @@ public class InstallerGUI { "<html>Example: <code>javac -cp lombok.jar MyCode.java</code></html>"; private static final String UNINSTALL_TITLE = - "<html><font size=\"+1\"><b><i>Uninstall</i></b></font></html>"; + "<html><font size=\"+1\"><b><i>Uninstall </i></b></font></html>"; private static final String UNINSTALL_EXPLANATION = "<html>Uninstall Lombok from the following IDE Installations?</html>"; private static final String HOW_I_WORK_TITLE = - "<html><font size=\"+1\"><b><i>What this installer does</i></b></font></html>"; + "<html><font size=\"+1\"><b><i>What this installer does </i></b></font></html>"; private static final String HOW_I_WORK_EXPLANATION = "<html><h2>Eclipse</h2><ol>" + @@ -826,6 +921,11 @@ public class InstallerGUI { "On Mac OS X, eclipse.ini is hidden in<br>" + "<code>Eclipse.app/Contents/MacOS</code> so that's where I place the jar files.</html>"; + private static final String SUCCESS_TITLE = "<html><font size=\"+1\"><b><i>Install successful </i></b></font></html>"; + private static final String SUCCESS_EXPLANATION = "<html>Lombok has been installed on the selected IDE installations.<br>" + + "Don't forget to add <code>lombok.jar</code> to your projects, and <b>exit and start</b> your IDE!%%%</html>"; + + private static class JHyperLink extends JButton { private static final long serialVersionUID = 1L; |