From notifications-return-8385-apmail-ant-notifications-archive=ant.apache.org@ant.apache.org Sat Jun 06 09:12:47 2009 Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 55753 invoked from network); 6 Jun 2009 09:12:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Jun 2009 09:12:47 -0000 Received: (qmail 58467 invoked by uid 500); 6 Jun 2009 09:12:59 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 58440 invoked by uid 500); 6 Jun 2009 09:12:59 -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 58431 invoked by uid 99); 6 Jun 2009 09:12:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Jun 2009 09:12:59 +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; Sat, 06 Jun 2009 09:12:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C74DB23888D7; Sat, 6 Jun 2009 09:12:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r782214 - in /ant/sandbox/antlibs/compress/trunk: README src/etc/testcases/compress.xml src/etc/testcases/testscripts/bbc.css src/main/org/apache/ant/js/compressor/YUICompressorTask.java Date: Sat, 06 Jun 2009 09:12:36 -0000 To: notifications@ant.apache.org From: kevj@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090606091236.C74DB23888D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kevj Date: Sat Jun 6 09:12:36 2009 New Revision: 782214 URL: http://svn.apache.org/viewvc?rev=782214&view=rev Log: -added CssCompressor and css tests Added: ant/sandbox/antlibs/compress/trunk/src/etc/testcases/testscripts/bbc.css (with props) Modified: ant/sandbox/antlibs/compress/trunk/README ant/sandbox/antlibs/compress/trunk/src/etc/testcases/compress.xml ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/js/compressor/YUICompressorTask.java Modified: ant/sandbox/antlibs/compress/trunk/README URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/README?rev=782214&r1=782213&r2=782214&view=diff ============================================================================== --- ant/sandbox/antlibs/compress/trunk/README (original) +++ ant/sandbox/antlibs/compress/trunk/README Sat Jun 6 09:12:36 2009 @@ -12,11 +12,4 @@ - - -TODO ----- - -# Make the type parameter work so that the code creates the correct compressor depending on the type -# Make the charset parameter work - + \ No newline at end of file Modified: ant/sandbox/antlibs/compress/trunk/src/etc/testcases/compress.xml URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/etc/testcases/compress.xml?rev=782214&r1=782213&r2=782214&view=diff ============================================================================== --- ant/sandbox/antlibs/compress/trunk/src/etc/testcases/compress.xml (original) +++ ant/sandbox/antlibs/compress/trunk/src/etc/testcases/compress.xml Sat Jun 6 09:12:36 2009 @@ -40,6 +40,12 @@ + + + + + + Added: ant/sandbox/antlibs/compress/trunk/src/etc/testcases/testscripts/bbc.css URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/etc/testcases/testscripts/bbc.css?rev=782214&view=auto ============================================================================== --- ant/sandbox/antlibs/compress/trunk/src/etc/testcases/testscripts/bbc.css (added) +++ ant/sandbox/antlibs/compress/trunk/src/etc/testcases/testscripts/bbc.css Sat Jun 6 09:12:36 2009 @@ -0,0 +1,198 @@ +/* STORY */ +.storybody{ + float:left; + width:466px; + line-height:1.4em; + font-size:1.3em; +} +.storybodywide{ + float:left; + display:block; + line-height:1.4em; + font-size:1.3em; +} +.storybody p,.storybodywide p{padding:0 0 10px 0;} +.storybody pre{font-size:1.1em;} +.storybody form,.storybodywide form{font-size:1.2em;} +.storybody form input,.storybodywide form input{margin:3px 0 0 0;} +.storybody .di .arr, .storybody form .di .arr,.storybodywide .di .arr, .storybodywide form .di .arr{font-size:0.6em;} +.storybody table td div .cap{padding:0;} +.storybodywide{width:800px;} +.sh{font-size:18px;font-weight:bold;color:#464646;} +.storybody .avinline { + margin:4px 0; + font-size:0.9em +} +.storybody .avinline img{margin:3px 0 0 0;} +td.sib606 { + background:#EEE none repeat scroll 0%; + font-size:11px; +} +.ibqlinks { +border-top:1px dotted #666666; +padding:5px; +} +.storybody .arr, .storybodywide .arr{font-size:1.1em;} +.storybody .arr a.bodl, .storybodywide .arr a.bodl{font-size:0.9em;} +/* -------- STRUCTURE -------- */ +table.main{ + clear:both; + border:0; +} +table.main td.sidebar1{ + width:160px; + border-right:14px solid #fff; + vertical-align:top; +} +table.datetools{width:800px;} +td.storybody{ + width:466px; + vertical-align:top; + } +table.storycontent .sh{ + font-size:2.4em; + margin:10px 0 10px 0; +} +td.storyextra{ + width:306px; + border-left:14px solid #fff; + vertical-align:top; + line-height:1.5em; +} +td.contentwrapper, td.contentwrapperwide{vertical-align:top;} +.storyextra .nlp{font-size:1.1em;text-transform:uppercase;font-weight:bold;font-family:verdana;} +.storycontent h1, td.contentwrapperwide .sh{ + font-family:arial; + font-size:2.4em; + margin:5px 0 15px 0; + font-weight:normal; +} + +.contentwrapperwide .datetools .mxb .h1,.contentwrapperwide .datetools .mxb h1{ + font-family:arial; + font-size:2.4em; + margin:5px 0 15px 0; + font-weight:normal; +} + +.sah { + font-family:arial; + background:#666 none repeat scroll 0%; + color:#FFF; + font-size:1.1em; + font-weight:bold; + padding:4px 0 4px 5px; + text-transform:uppercase; +} +hr.pufff { + border:0pt none; + height:2px; + width:100%; + margin:5px 0 0 0; +} +#tabnavbox { + clear:both; + width: 100%; + height: 24px; + font-size: 100%; + padding:0; + border-bottom: 1px dashed #999; + background: #eee; +} +#tabnav { + height:25px; + margin: 0; + padding: 0; +} +#tabnav li { + margin: 0; + padding: 0; + display: inline; + list-style: none; + width: 104px; + height: 25px; + float: left; + text-align: center; + font-size: 10px; + line-height: 22px; + font-weight: bold; + color: #333; +} +#tabnav a:link, #tabnav a:visited { + font-size: 10px; + line-height: 22px; + font-weight: bold; + padding: 3px 4px 3px 4px; + margin:0 4px; + text-decoration: none; + color: #ff0; + text-align: center; + height: 18px !important; + height /**/: 20px; + /* for IE5/Win */ +} +#tabnav a:hover {text-decoration: underline;} +#liveTopBox1 { + width: 480px; + float: left; +} +#liveTopBox1 .sh{ + margin:8px 0 0 0; + color:#464646; + font-size:18px; + font-weight:normal; +} +#liveTopBox1 .avinline{ + padding:6px 0 0 0; + font-size:1.2em; +} +#liveTopBox1 .avinline a img{margin:1px 0 0 0;} +#liveTopBox2 { + line-height:1.4em; + padding:30px 0pt 0pt; + width: 306px; + float: left; +} +#tabnav li {background:#000;} +.cap{ + color:#666; + font-weight:normal; + margin:3px 0 0 0; + font-size:11px; + line-height:13px; +} +.msd{font-size:11px;font-weight:bold;color:#666} +.comm{background:#606;color:#FFF;font-size:12px;font-weight:bold;padding:0 0 0 5px;} +.cfaxh{font-size:16px;font-weight:bold;} +.sib606 .sihf { + font-weight: normal; + font-family:arial; + font-size: 12px; + padding:4px 0 4px 5px; +} +#q1 { + height: 13px; + width: 20px; + background-repeat: no-repeat; + float: left; +} +.sib606 .mva {line-height:1.3em;} +#q2 { + height: 13px; + width: 20px; + background-repeat: no-repeat; + float: right; +} +.sibStdQuote{font-size:11px;line-height:1.3em;} +.sibStdQuote #q1 { + height: 13px; + width: 20px; + background-repeat: no-repeat; + float: left; +} +.sibStdQuote #q2 { + height: 13px; + width: 20px; + background-repeat: no-repeat; + float: right; +} \ No newline at end of file Propchange: ant/sandbox/antlibs/compress/trunk/src/etc/testcases/testscripts/bbc.css ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/js/compressor/YUICompressorTask.java URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/js/compressor/YUICompressorTask.java?rev=782214&r1=782213&r2=782214&view=diff ============================================================================== --- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/js/compressor/YUICompressorTask.java (original) +++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/js/compressor/YUICompressorTask.java Sat Jun 6 09:12:36 2009 @@ -6,6 +6,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; +import java.io.Reader; import java.io.Writer; import java.util.ArrayList; import java.util.Iterator; @@ -19,6 +20,7 @@ import org.mozilla.javascript.ErrorReporter; import org.mozilla.javascript.EvaluatorException; +import com.yahoo.platform.yui.compressor.CssCompressor; import com.yahoo.platform.yui.compressor.JavaScriptCompressor; import com.yahoo.platform.yui.compressor.YUICompressor; @@ -47,17 +49,15 @@ for(Iterator i = inputResources.iterator(); i.hasNext();) { FileSet fs = (FileSet)i.next(); for(Iterator j = fs.iterator(); j.hasNext();) { - Commandline cmd = buildArgs(); FileResource f = (FileResource)j.next(); if(verbose) { log("Minifying: "+f.getFile().getAbsolutePath()); } - - //TODO - //get the charset from the property - //check the specified type and create the appropriate compressor - InputStreamReader in = new InputStreamReader(new FileInputStream(f.getFile().getAbsolutePath()), "UTF-8"); - JavaScriptCompressor c = getJavaScriptCompressor(in); + //Ensure charset is set + if(null == charset || charset.trim() == "") { + charset = "UTF-8"; + } + InputStreamReader in = new InputStreamReader(new FileInputStream(f.getFile().getAbsolutePath()), charset); Writer out; if(null != outputPath && outputPath.trim() != "") { out = new OutputStreamWriter(new FileOutputStream(outputPath + File.separator + f.getFile().getName())); @@ -65,13 +65,21 @@ out = new OutputStreamWriter(new FileOutputStream(f.getFile().getAbsolutePath())); } - c.compress(out, - (null == getLineBreak() || getLineBreak() == "" ? -1 : Integer.parseInt(getLineBreak())), - isNomunge(), - isVerbose(), - isPreserveSemi(), - isDisableOptimization() - ); + if(null != type && type.trim() != "" && "js".equals(type)) { + JavaScriptCompressor c = getJavaScriptCompressor(in); + c.compress(out, + (null == getLineBreak() || getLineBreak() == "" ? -1 : Integer.parseInt(getLineBreak())), + isNomunge(), + isVerbose(), + isPreserveSemi(), + isDisableOptimization() + ); + } else if(null != type && type != "" && "css".equals(type)) { + CssCompressor c = getCssCompressor(in); + c.compress(out, (null == getLineBreak() || getLineBreak() == "" ? -1 : Integer.parseInt(getLineBreak()))); + } + in.close(); + out.close(); } } @@ -81,7 +89,7 @@ } } - protected JavaScriptCompressor getJavaScriptCompressor(InputStreamReader in) throws IOException { + protected JavaScriptCompressor getJavaScriptCompressor(Reader in) throws IOException { JavaScriptCompressor compressor = new JavaScriptCompressor(in, new ErrorReporter() { @@ -113,6 +121,10 @@ return compressor; } + protected CssCompressor getCssCompressor(Reader in) throws IOException { + return new CssCompressor(in); + } + protected Commandline buildArgs() { Commandline cmd = new Commandline(); if(verbose) {