From user-return-70360-apmail-ant-user-archive=ant.apache.org@ant.apache.org Wed May 05 13:26:27 2010 Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 24749 invoked from network); 5 May 2010 13:26:27 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 May 2010 13:26:27 -0000 Received: (qmail 91836 invoked by uid 500); 5 May 2010 13:26:26 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 91751 invoked by uid 500); 5 May 2010 13:26:25 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 91743 invoked by uid 99); 5 May 2010 13:26:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 May 2010 13:26:25 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [15.192.0.46] (HELO g5t0009.atlanta.hp.com) (15.192.0.46) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 May 2010 13:26:15 +0000 Received: from G3W0631.americas.hpqcorp.net (g3w0631.americas.hpqcorp.net [16.233.59.15]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by g5t0009.atlanta.hp.com (Postfix) with ESMTPS id B40473084C for ; Wed, 5 May 2010 13:25:53 +0000 (UTC) Received: from G5W0326.americas.hpqcorp.net (16.228.8.70) by G3W0631.americas.hpqcorp.net (16.233.59.15) with Microsoft SMTP Server (TLS) id 8.2.176.0; Wed, 5 May 2010 13:24:27 +0000 Received: from GVW1115EXC.americas.hpqcorp.net ([16.228.11.78]) by G5W0326.americas.hpqcorp.net ([16.228.8.70]) with mapi; Wed, 5 May 2010 13:24:27 +0000 From: "Bailey, Darragh" To: "user@ant.apache.org" Date: Wed, 5 May 2010 13:24:25 +0000 Subject: Better alternative than using foreach, for and if/then/else? Thread-Topic: Better alternative than using foreach, for and if/then/else? Thread-Index: AcrsVkg6kRSgFD2VQpOdRfQQFR3a0w== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Have recently just started using Ant, with the goal to using it as the defa= ult build tool across an entire project. While most of the project will be = java based, there are a few parts that won't be and I'm trying to make ant = work as effectively as possible for these sections. One of them just happens to be a kernel module. While there will be a makef= ile called by the Ant target in the end, I'm trying to set Ant up as the en= try point so that developers moving between different parts of the project = will get the same interface and the same targets to be called. It also simp= lifies the work around a continuous build tool, in that it doesn't have to = run differently for the different components. For the kernel module build, I'm trying to allow for more than 1 kernel ver= sion and different kernel variants. In most cases the kernel version will b= e 2.6.18-194.el5 (RHEL5 Update 5 kernel) and the variant will be the defaul= t. However at times developers will want to build against multiple kernel v= ersions and/or variants when developing/debugging issues. Examples: Default Properties kernel.versions =3D 2.6.18-194.el5 kernel.variants =3D "" Additionally "kernel.${kernel.version}.variants =3D xxx" can be used to spe= cify the variants for a particular version, rather than using the default s= et. I use "" to represent the default variant simply because that is the me= thod that works best when building kmod-* rpm packages as I'm using a spec = template similar to what fedora uses. Properties set by a Developer kernel.versions =3D 2.6.18-194.el5 2.6.33-k.org kernel.variants =3D "" kernel.2.6.18-194.el5.variants =3D xen Coming from a make background I was previously used to expanding targets dy= namically based on values set in properties in the makefile in order to ref= erence multiple kernel versions and variants and then using pattern based r= ules to build the necessary target. Right now I've got something partially = working in Ant using the foreach/for tasks from ant-contrib, but I'm not su= re that this is the best way to accomplish this. I'm also using if/the/else= to work around the use of "" which Ant doesn't really like when it comes t= o specifying an empty value for a property. I know I have a bug in the xml below, in that the for loop I attempt to cha= nge properties which by default Ant won't overwrite after setting them init= ially. Like I mentioned before I'm very much used to make and I've yet to f= ully get to grips with Ant. Any suggestions on other Ant tasks that could simplify this would be very w= elcome: -- Regards, Darragh Bailey Systems Software Engineer Hewlett Packard Galway Ltd. Postal Address:=A0=A0=A0 Hewlett Packard Galway Limited, Ballybrit Business= Park, Galway Registered Office: Hewlett Packard Galway Limited, 63-74 Sir John Rogerson'= s Quay Dublin 2 Registered Number: 361933=20 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org