Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 29310 invoked from network); 5 May 2010 13:46:46 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 May 2010 13:46:46 -0000 Received: (qmail 34029 invoked by uid 500); 5 May 2010 13:46:45 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 34001 invoked by uid 500); 5 May 2010 13:46:45 -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 33993 invoked by uid 99); 5 May 2010 13:46:45 -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:46:45 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of peter.kitt.reilly@gmail.com designates 74.125.82.45 as permitted sender) Received: from [74.125.82.45] (HELO mail-ww0-f45.google.com) (74.125.82.45) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 May 2010 13:46:37 +0000 Received: by wwd20 with SMTP id 20so35450wwd.4 for ; Wed, 05 May 2010 06:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=kdniFKI9CM32KTNI68cBy7mYXp/UXSXoKuiDhgGhq2g=; b=Jzvm2OS2u3c0WLrJ8RxLhHS55G7t1XTAkWrqfsthDsMMDFNKqVXt0Sb+VNPsCrvcTX vVfVFArOgJHomUpNGbU1sMvlAW5U9RgI8vDIdl6lf/vbmsdpn6l2yQY8n/A53ZN0+wf2 en4A3gIaATAtzxeJTikFRDPkcdIui5Zq+lY0Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=imH/SNDLajFD18DbG13ImbdFFhmxRgJVUzpwkxJGTOsnvNZbldkvN3GWmYJmwgY0rg o2FaooETNVCex+gH4OoVyXTbqyJ/PAWqpbrDrDiKz5heSPA7CC5Bb8nockWaMwQR6u5a quVtTpOYy0jMmeVfeX0e0v9R3F25Vw2KiIc0U= MIME-Version: 1.0 Received: by 10.216.90.3 with SMTP id d3mr2205829wef.110.1273067174465; Wed, 05 May 2010 06:46:14 -0700 (PDT) Received: by 10.216.169.71 with HTTP; Wed, 5 May 2010 06:46:14 -0700 (PDT) In-Reply-To: References: Date: Wed, 5 May 2010 14:46:14 +0100 Message-ID: Subject: Re: Better alternative than using foreach, for and if/then/else? From: Peter Reilly To: Ant Users List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org You need to use ant 1.8 and the task. declares that a property is local to the current scope, as defined by the enclosing or see: http://ant.apache.org/manual/CoreTasks/local.html ... Peter On Wed, May 5, 2010 at 2:24 PM, Bailey, Darragh wrote: > > Have recently just started using Ant, with the goal to using it as the de= fault build tool across an entire project. While most of the project will b= e java based, there are a few parts that won't be and I'm trying to make an= t work as effectively as possible for these sections. > > One of them just happens to be a kernel module. While there will be a mak= efile called by the Ant target in the end, I'm trying to set Ant up as the = entry point so that developers moving between different parts of the projec= t will get the same interface and the same targets to be called. It also si= mplifies the work around a continuous build tool, in that it doesn't have t= o run differently for the different components. > > > For the kernel module build, I'm trying to allow for more than 1 kernel v= ersion and different kernel variants. In most cases the kernel version will= be 2.6.18-194.el5 (RHEL5 Update 5 kernel) and the variant will be the defa= ult. However at times developers will want to build against multiple kernel= versions 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 s= pecify the variants for a particular version, rather than using the default= set. I use "" to represent the default variant simply because that is the = method that works best when building kmod-* rpm packages as I'm using a spe= c 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 = dynamically based on values set in properties in the makefile in order to r= eference multiple kernel versions and variants and then using pattern based= rules to build the necessary target. Right now I've got something partiall= y working in Ant using the foreach/for tasks from ant-contrib, but I'm not = sure that this is the best way to accomplish this. I'm also using if/the/el= se to work around the use of "" which Ant doesn't really like when it comes= to 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 c= hange properties which by default Ant won't overwrite after setting them in= itially. Like I mentioned before I'm very much used to make and I've yet to= fully get to grips with Ant. > > > Any suggestions on other Ant tasks that could simplify this would be very= welcome: > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0description=3D"Compile the source again= st all requested kernel versions and variants"> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > =C2=A0 > > > =C2=A0 > =C2=A0 > > > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > =C2=A0 > > > > -- > Regards, > Darragh Bailey > > Systems Software Engineer > Hewlett Packard Galway Ltd. > > Postal Address:=C2=A0=C2=A0=C2=A0 Hewlett Packard Galway Limited, Ballybr= it Business Park, Galway > Registered Office: Hewlett Packard Galway Limited, 63-74 Sir John Rogerso= n's Quay Dublin 2 > Registered Number: 361933 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org