Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 12510 invoked from network); 28 Sep 2010 12:04:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 Sep 2010 12:04:19 -0000 Received: (qmail 26051 invoked by uid 500); 28 Sep 2010 12:04:18 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 25754 invoked by uid 500); 28 Sep 2010 12:04:16 -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 25746 invoked by uid 99); 28 Sep 2010 12:04:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Sep 2010 12:04:15 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of graham.heath@ts.fujitsu.com designates 80.70.172.51 as permitted sender) Received: from [80.70.172.51] (HELO dgate20.ts.fujitsu.com) (80.70.172.51) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Sep 2010 12:04:08 +0000 DomainKey-Signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:Received:From:To:Date: Subject:Thread-Topic:Thread-Index:Message-ID: Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:acceptlanguage:Content-Type: MIME-Version; b=g9gBa04cm14zTnPqF/jazfcWcAKom4PWkIEMH0rP/9kXsbjbWVU41Ky7 uAG/t4e6jbzYoPAiNA4bCPmp39LS6SYHwOaKvPaJ3IzFnZKsgGNLBBNoL MiFW4cMpMs3hJU/EaA60yrrOElMvEHFmEY1Vr13lhUMLYiLpaVI217zXO kHlsiBfs8skAudIxT/9km4D1G/rwcmx+gUka2thgVTHY7czRUfo0JItIJ kyAz8oD/4g3tNMY1EplIctwRNwQUb; DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ts.fujitsu.com; i=graham.heath@ts.fujitsu.com; q=dns/txt; s=s1536b; t=1285675465; x=1317211465; h=from:to:date:subject:message-id:mime-version; z=From:=20"Heath,=20Graham"=20|To:=20"user@ant.apache.org"=20 |Date:=20Tue,=2028=20Sep=202010=2014:03:46=20+0200 |Subject:=20conditional=20global=20variables?|Message-ID: =20<83A10C1DCDF9EC448E614661875FE6160140D8D847EF@ABGEX73E .FSC.NET>|MIME-Version:=201.0; bh=XfzSVjqgbkK9AavglAwKRIUHS8K2HpxD3dcD21X/iUQ=; b=jgWXQoyfNx9Gz4tEHscxFCrb81i6MPN965umNkHRb+KZQkDUrqW2LZdP WSKYW32TfJPPbE8fnq9rGYyvez0WeZ3aZHLWme+HUb1/sZWzXGlXI1SyJ okZViLepZmSy/SqzyBMemRGgv9LTKupD71dUvvn00fc888gqC/9w9MFpr 6Gq6wSKfo/xRs+CRbAYYrKSJV0ALYuqyPg6tOq/wp/IcomLJOCE7V8vTg OTF9mCzFOEbQs0YGSdDv/QXhDm7vW; X-SBRSScore: None X-IronPort-AV: E=Sophos;i="4.57,246,1283724000"; d="scan'208,217";a="45968189" Received: from abgze79e.fsc.net ([172.25.138.145]) by dgate20u.abg.fsc.net with ESMTP/TLS/RC4-MD5; 28 Sep 2010 14:04:04 +0200 Received: from ABGEX73E.FSC.NET ([172.25.138.139]) by abgze79e.FSC.NET ([172.25.138.145]) with mapi; Tue, 28 Sep 2010 14:04:03 +0200 From: "Heath, Graham" To: "user@ant.apache.org" Date: Tue, 28 Sep 2010 14:03:46 +0200 Subject: conditional global variables? Thread-Topic: conditional global variables? Thread-Index: ActfBTQGr12vTpIwTvWExjWwWu7eyg== Message-ID: <83A10C1DCDF9EC448E614661875FE6160140D8D847EF@ABGEX73E.FSC.NET> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_83A10C1DCDF9EC448E614661875FE6160140D8D847EFABGEX73EFSC_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_83A10C1DCDF9EC448E614661875FE6160140D8D847EFABGEX73EFSC_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Sep 26, 2010, at 8:23 AM, Marina wrote: > Hello! > In essence, I would like to know how to define a global property > conditionally, and then have it available to all build files via = . > What I do is supply a -Dtarget=3DDebug or Release via the commandline which= causes a build.properties file to be built with useful things like build.n= umber, build.time, build.date, build.machine, build.type and so on. ... All my subservient build files just import this file - oh and debug builds copy it into the= dist directory too.. That way I have a chance to know on a test machine wh= ere/when/who built the failing jar! root.dir |____metadata | |__ build.number | |__ build.properties |____Source jar1 | |__ build.xml |____Source jar2 | |__ build.xml Cheers Graham > Now the details: > I have a build.common.xml file with all global properties and paths > defined. I import it into my main build and component build files via > , and this makes everything that is defined in the common file > available to all other build files. > build.common.xml: > > ... > > > > > > > ... > > > Then, I have a main build.xml that calls a few component build.xml via > call. > If I the build.common.xml into all my build files - I have > all properties and paths available to all builds. > > It all works great, but now I want to have the build.classes property > set conditionally, based on the build mode (dev vs. release). Ideally, > I would like something similar to the C #ifdef macros: > > build.common.xml: > if > mode=3D'dev' > then > value=3D"${build}/dev/classes"/> else > value=3D"${build}/release/classes"/> > > I can do the logic if I define this property in the main build, > for example, as part of some task. But, it means that the > property is not global anymore, and, which is more important, I cannot > define my paths in the build.common.xml based on the value of this > property. At least I could not figure out yet a way to do it... > > So, I was pondering over a few options: > 1. define all properties like that and paths in the main build.xml and > pass them as parameters to all component builds - very involved and infle= xible... > 2. define a target in the build.common.xml that defines all > those properties and paths - and make all builds call it (or depend on > it) - again, very involved in terms of refactoring my existing builds, an= d inflexible. > 3. any other way??? > > If only I could just define that one global property conditionally! I > feel like I'm missing some basic core concept here.... > > Any pointers? > > Thanks! > Marina --_000_83A10C1DCDF9EC448E614661875FE6160140D8D847EFABGEX73EFSC_--