Return-Path: Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 76842 invoked from network); 6 Oct 2000 15:08:47 -0000 Received: from mail.responsenetworks.com (HELO amber.responsenetworks.com) (216.0.120.134) by locus.apache.org with SMTP; 6 Oct 2000 15:08:47 -0000 Received: by mail.responsenetworks.com with Internet Mail Service (5.5.2650.21) id <4LY4N7HB>; Fri, 6 Oct 2000 11:06:54 -0400 Message-ID: From: KC Baltz To: "'ant-user@jakarta.apache.org'" Subject: RE: Conditionally setting properties Date: Fri, 6 Oct 2000 11:06:53 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N If you are using Ant 1.1 (the latest release) then you are seeing correct behavior. In 1.1, properties are indeed set at parse time and in the order they appear in the build file. Once set, they are immutable. Ant 1.2, which is coming soon, will have mutable, set-at-runtime, properties. You can check your version with ant -version K.C. > -----Original Message----- > From: Norris Boyd [mailto:nboyd@atg.com] > Sent: Friday, October 06, 2000 11:01 AM > To: ant-user@jakarta.apache.org > Subject: Conditionally setting properties > > > I tried to conditionally set properties in my buildfile and it doesn't > seem to work. > > Here's a sample buildfile that demonstrates the problem: > > > > > > > > > > > > > > > > > > > > > > > > > > Now if a file "foo" is present in the directory when I build I get the > following ant output: > > Buildfile: build.xml > > init: > > has-foo: > setting yes > > no-foo: > > print: > foo-present = yes > > BUILD SUCCESSFUL > > Total time: 0 seconds > > But if I remove foo I get the following output: > > Buildfile: build.xml > > init: > > has-foo: > > no-foo: > setting no > > print: > foo-present = yes > > BUILD SUCCESSFUL > > Total time: 0 seconds > > Am I misunderstanding how it should work? It appears that > properties are > set at parse time rather than build time because if I swap > the order of > the "has-foo" and "no-foo" targets, I always get "foo-present = no" > whether or not foo is present. > > Thanks, > Norris >