Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 81366 invoked from network); 24 Jul 2009 14:38:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jul 2009 14:38:38 -0000 Received: (qmail 28529 invoked by uid 500); 24 Jul 2009 14:39:44 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 28487 invoked by uid 500); 24 Jul 2009 14:39:44 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 28478 invoked by uid 99); 24 Jul 2009 14:39:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2009 14:39:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2009 14:39:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B7D532388877; Fri, 24 Jul 2009 14:39:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r797496 - in /ant/core/trunk: ./ docs/manual/OptionalTasks/ src/etc/testcases/taskdefs/optional/ src/main/org/apache/tools/ant/taskdefs/optional/splash/ Date: Fri, 24 Jul 2009 14:39:18 -0000 To: notifications@ant.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090724143918.B7D532388877@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Fri Jul 24 14:39:17 2009 New Revision: 797496 URL: http://svn.apache.org/viewvc?rev=797496&view=rev Log: configurable display text and more control over progressbar in splash task. Submitted by Tomasz Bech. PR 39957 Added: ant/core/trunk/src/etc/testcases/taskdefs/optional/splash-test.xml (with props) Modified: ant/core/trunk/CONTRIBUTORS ant/core/trunk/WHATSNEW ant/core/trunk/contributors.xml ant/core/trunk/docs/manual/OptionalTasks/splash.html ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java Modified: ant/core/trunk/CONTRIBUTORS URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=797496&r1=797495&r2=797496&view=diff ============================================================================== Binary files - no diff available. Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=797496&r1=797495&r2=797496&view=diff ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Fri Jul 24 14:39:17 2009 @@ -804,6 +804,10 @@ the http condition. Bugzilla Report 30244 + * now supports a configurable display text and a regular + expression based way to determine progress based on logged messages. + Bugzilla Report 39957. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= Modified: ant/core/trunk/contributors.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=797496&r1=797495&r2=797496&view=diff ============================================================================== --- ant/core/trunk/contributors.xml (original) +++ ant/core/trunk/contributors.xml Fri Jul 24 14:39:17 2009 @@ -1244,6 +1244,10 @@ May + Tomasz + Bech + + Trejkaz Xaoz Modified: ant/core/trunk/docs/manual/OptionalTasks/splash.html URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/OptionalTasks/splash.html?rev=797496&r1=797495&r2=797496&view=diff ============================================================================== --- ant/core/trunk/docs/manual/OptionalTasks/splash.html (original) +++ ant/core/trunk/docs/manual/OptionalTasks/splash.html Fri Jul 24 14:39:17 2009 @@ -52,10 +52,28 @@ splash in milliseconds. No 5000 ms - + + + progressregexp + Progress regular expression which is used to + parse the output and dig out current progress. Exactly one group + pattern must exists, and it represents the progress number (0-100) + (i.e "Progress: (.*)%")
+ since Ant 1.8.0 + No + progress is increased every action + and log output line + + + displaytext + display text presented in the splash window
+ since Ant 1.8.0 + No + Building ... +

Deprecated properties

- + The following properties can be used to configure the proxy settings to retrieve an image from behind a firewall. However, the settings apply not just to this task, but to all following tasks. Therefore they are now mostly deprecated in @@ -63,7 +81,7 @@ the build exactly what is going on. We say mostly as this task's support includes proxy authentication, so you may still need to use its proxy attributes. - + @@ -110,8 +128,27 @@ showduration="5000"/> -

Splashes the jakarta logo, for -an initial period of 5 seconds.

+

Splashes the jakarta logo, for an initial period of 5 seconds.

+ +

Splash with controlled progress and nondefault text

+
+        <target name="test_new_features">
+                <echo>New features</echo>
+                <splash progressRegExp="Progress: (.*)%" showduration="0" displayText="Test text"/>
+                <sleep seconds="1"/>
+                <echo>Progress: 10%</echo>
+                <sleep seconds="1"/>
+                <echo>Progress: 20%</echo>
+                <sleep seconds="1"/>
+                <echo>Progress: 50%</echo>
+                <sleep seconds="1"/>
+                <echo>Progress: 70%</echo>
+                <sleep seconds="1"/>
+                <echo>Progress: 100%</echo>
+                <sleep seconds="3"/>
+        </target>
+
+ Added: ant/core/trunk/src/etc/testcases/taskdefs/optional/splash-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/optional/splash-test.xml?rev=797496&view=auto ============================================================================== --- ant/core/trunk/src/etc/testcases/taskdefs/optional/splash-test.xml (added) +++ ant/core/trunk/src/etc/testcases/taskdefs/optional/splash-test.xml Fri Jul 24 14:39:17 2009 @@ -0,0 +1,45 @@ + + + + + + Old behaviour + + + + + + + + + + New features + + + Progress: 10% + + Progress: 20% + + Progress: 50% + + Progress: 70% + + Progress: 100% + + + Propchange: ant/core/trunk/src/etc/testcases/taskdefs/optional/splash-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java?rev=797496&r1=797495&r2=797496&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java Fri Jul 24 14:39:17 2009 @@ -25,6 +25,9 @@ import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JLabel; @@ -41,17 +44,35 @@ private int total; private static final int MIN = 0; private static final int MAX = 200; + private Pattern progressRegExpPattern; public SplashScreen(String msg) { - init(null); - setText(msg); + this(msg, null, null); } public SplashScreen(ImageIcon img) { - init(img); + this(img, null, null); + } + + public SplashScreen(String msg, String progressRegExp, String displayText) { + init(null, progressRegExp, displayText); + setText(msg); + } + + public SplashScreen(ImageIcon img, String progressRegExp, + String displayText) { + init(img, progressRegExp, displayText); } protected void init(ImageIcon img) { + init(img, null, null); + } + + protected void init(ImageIcon img, String progressRegExp, + String displayText) { + if (progressRegExp != null) { + progressRegExpPattern = Pattern.compile(progressRegExp); + } JPanel pan = (JPanel) getContentPane(); JLabel piccy; @@ -62,7 +83,10 @@ } piccy.setBorder(BorderFactory.createLineBorder(Color.black, 1)); - text = new JLabel("Building....", JLabel.CENTER); + if (displayText == null) { + displayText = "Building...."; + } + text = new JLabel(displayText, JLabel.CENTER); text.setFont(new Font("Sans-Serif", Font.BOLD, FONT_SIZE)); text.setBorder(BorderFactory.createEtchedBorder()); @@ -94,12 +118,14 @@ } public void actionPerformed(ActionEvent a) { - if (total < MAX) { - total++; - } else { - total = MIN; + if (!hasProgressPattern()) { + if (total < MAX) { + total++; + } else { + total = MIN; + } + pb.setValue(total); } - pb.setValue(total); } public void buildStarted(BuildEvent event) { @@ -129,6 +155,26 @@ public void messageLogged(BuildEvent event) { actionPerformed(null); + if (hasProgressPattern()) { + String message = event.getMessage(); + Matcher matcher = progressRegExpPattern.matcher(message); + if (matcher != null && matcher.matches()) { + String gr = matcher.group(1); + try { + int i = Math.min(new Integer(gr).intValue() * 2, MAX); + pb.setValue(i); + } catch (NumberFormatException e) { + //TODO: how to reach logger?!? + //log("Number parsing error in progressRegExp", Project.MSG_VERBOSE); + + } + } + } + } + + protected boolean hasProgressPattern() { + return progressRegExpPattern != null; } + } Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java?rev=797496&r1=797495&r2=797496&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java Fri Jul 24 14:39:17 2009 @@ -47,6 +47,8 @@ private String port = "80"; private int showDuration = DEFAULT_SHOW_DURATION; private boolean useProxy = false; + private String progressRegExp = null; + private String displayText = null; private static SplashScreen splash = null; @@ -113,6 +115,29 @@ /** + * Progress regular expression which is used to parse the output + * and dig out current progress optional; if not provided, + * progress is increased every action and log output line + * @param progressRegExp Progress regular expression, exactly one + * group pattern must exists, and it represents the progress + * number (0-100) (i.e "Progress: (.*)%") + * @since Ant 1.8.0 + */ + public void setProgressRegExp(String progressRegExp) { + this.progressRegExp = progressRegExp; + } + + /** + * Sets the display text presented in the splash window. + * optional; defaults to "Building ..." + * @param displayText the display text presented the splash window + * @since Ant 1.8.0 + */ + public void setDisplayText(String displayText) { + this.displayText = displayText; + } + + /** * Execute the task. * @throws BuildException on error */ @@ -201,7 +226,7 @@ try { ImageIcon img = new ImageIcon(bout.toByteArray()); - splash = new SplashScreen(img); + splash = new SplashScreen(img, progressRegExp, displayText); success = true; } catch (Throwable e) { logHeadless(e); @@ -221,7 +246,8 @@ } } else { try { - splash = new SplashScreen("Image Unavailable."); + splash = new SplashScreen("Image Unavailable.", progressRegExp, + displayText); success = true; } catch (Throwable e) { logHeadless(e); @@ -245,4 +271,5 @@ + e.getClass().getName() + " with message: " + e.getMessage(), Project.MSG_WARN); } + }
useproxy