Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 72444 invoked from network); 24 Mar 2000 08:39:34 -0000 Received: from smtp01do.de.uu.net (192.76.144.61) by locus.apache.org with SMTP; 24 Mar 2000 08:39:34 -0000 Received: from sbodewig.bost.de ([195.127.75.69]) by smtp01do.de.uu.net (5.5.5/5.5.5) with ESMTP id JAA12202 for ; Fri, 24 Mar 2000 09:39:32 +0100 (MET) Received: (from bodewig@localhost) by sbodewig.bost.de (8.9.3/8.9.3) id JAA01527; Fri, 24 Mar 2000 09:39:31 +0100 X-Authentication-Warning: sbodewig.bost.de: bodewig set sender to bodewig@bost.de using -f To: ant-dev@jakarta.apache.org Subject: Generalization of available (setif and setunless) From: Stefan Bodewig Date: 24 Mar 2000 09:39:31 +0100 Message-ID: Lines: 72 User-Agent: Gnus/5.0803 (Gnus v5.8.3) XEmacs/21.1 (Arches) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Hi, I'm subscribed to this group a very short time. As I don't know if these things have been discussed before I won't submit code right know - maybe somebody else has already done something similar (which would have happened to my own version of a JUnit task). What I'm thinking about is a more general form of the Available task, something like Where conditiontester would implement something like interface ConditionTester { public void setCondition(String condition); public boolean testCondition() throws BuildException; } This would set the property named NAME to VALUE if CONDITION has been evaluated to true (false in the case of setunless) by an instance of CLASSNAME. Furthermore setif/unless should allow for some built-in conditions (for a proposal how to add new built-ins without changing too much code see my other mail): * fileavailable, resourceavailable and classavailable can quite easily be implemented by minor modifications to Available to implement ConditionTester * isset checks whether another property is set * istrue checks whether another property is set and evaluates to true * equals compares to Strings with a Syntax similar to KeySubst. The separator char could be the first char. Something like would make it easy to conditionally phase out files from compilation. * javaversion some way to check the JVM version at (ant-) runtime. Maybe make this three built-ins javaversionequals, javaversiongreater, javaversionless. * isexecutable checks whether a given command can be executed. I can't think of a portable way to implement this without actually running the command. I have already implemented such Tasks and most of the proposed built-ins but the code would need some brush up before I submit it. My primary goal is to get feedback on this first. Stefan