Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 94621 invoked from network); 12 Dec 2006 08:55:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2006 08:55:12 -0000 Received: (qmail 78173 invoked by uid 500); 12 Dec 2006 08:55:20 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 77996 invoked by uid 500); 12 Dec 2006 08:55:19 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 77985 invoked by uid 99); 12 Dec 2006 08:55:19 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 00:55:19 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of peter.kitt.reilly@gmail.com designates 64.233.182.189 as permitted sender) Received: from [64.233.182.189] (HELO nf-out-0910.google.com) (64.233.182.189) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 00:54:38 -0800 Received: by nf-out-0910.google.com with SMTP id o63so151016nfa for ; Tue, 12 Dec 2006 00:54:16 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=a1PUHWyHy+RT586XLd++zObKIcE/C8ddvmyXZ/ipbGhTQ6le7FGNZCiQ4ZR4tI9brXEJ0cKdR6joKTG0+wPg7ErjiEuvCyEcl7QQaT0a02N1FjSMx1svZy5dbw5ROfVYdH0Up0gyuEUli5pNBmyNldYPzYXO0PfjsUUXldEvX0U= Received: by 10.82.165.1 with SMTP id n1mr372455bue.1165913656321; Tue, 12 Dec 2006 00:54:16 -0800 (PST) Received: by 10.82.152.11 with HTTP; Tue, 12 Dec 2006 00:54:16 -0800 (PST) Message-ID: Date: Tue, 12 Dec 2006 08:54:16 +0000 From: "Peter Reilly" To: "Ant Developers List" Subject: Re: Java6 possible condition HasFreeSpace In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org On 12/12/06, Kevin Jackson wrote: > Hi all, > > I've coded up a new condition to take advantage of (one of) the new > features of the the java.io.File api > > Currently this works and I have an antunit test and everything! > > >>>> > public class HasFreeSpace implements Condition { > > private String partition; > private String needed; > > public boolean eval() throws BuildException { > try { > if (JavaEnvUtils.isAtLeastJavaVersion("1.6")) { > long free = Java6FileUtils.freeSpace(partition); > return free >= StringUtils.parseHumanSizes(needed); > } else { > throw new BuildException("HasFreeSpace condition not supported on > Java5 or less."); > } > } catch (Exception e) { > throw new BuildException(e); > } > } > > <<<< > >>>> > > xmlns:au="antlib:org.apache.ant.antunit"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > <<<< > > Now the problem is that I currently use a Java6FileUtils to allow me > to keep the special Java6 methods out of the base FileUtils, but none > of this code will compile on fine). I'd like to separate out the java6 specific stuff in a way > that allows me to bootstrap/build correctly on jdk5, but right now it > fails as the bootstrap script expects everything in the conditions > package to be bwc with jdk1.2. I just use reflection for the javax.scripting stuff. It is not too bad - see o.a.t.a.util.ReflectUtil and ReflectWrapper. Peter > > I want to check in the StringUtils changes as they will build fine on > pre-jdk6, but they'd be unused unless I checked in my new condition. > So any helpful suggestions as to how to structure everything to work > in a bwc way and ignore my new condition when on jdk5 & lower? > > (I've added a o.a.t.a.u.java6 package which my Java6FileUtils resides > in, so I can conditionally compile that, it's just that the > HasFreeSpace condition is in with the rest of the conditions and this > is failing on Java5) > > Thanks, > Kev > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org > For additional commands, e-mail: dev-help@ant.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org