Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 19516 invoked from network); 2 May 2002 17:03:58 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 2 May 2002 17:03:58 -0000 Received: (qmail 3850 invoked by uid 97); 2 May 2002 17:03:56 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@nagoya.betaversion.org Received: (qmail 3758 invoked by alias); 2 May 2002 17:03:56 -0000 Delivered-To: jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 3737 invoked by uid 97); 2 May 2002 17:03:55 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 3720 invoked by uid 98); 2 May 2002 17:03:54 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <28EDF15139E6BD4DAFFCA7A5D6F686392C0414@prodexch1.zilliant.com> From: "Albrecht, Matt" To: 'Ant Developers List' Subject: RE: Ant extension, templatized build files Date: Thu, 2 May 2002 12:07:18 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N To aid with the generic-ism of the brother.xml and sister.xml files, you can use the XML built-in ENTITY trick: ----- ]> &default-clean; ... ---- clean.inc.xml would contain something like: ---- ... ---- -Matt Albrecht Try something new. > -----Original Message----- > From: Dominique Devienne [mailto:DDevienne@lgc.com] > Sent: Thursday, May 02, 2002 10:16 AM > To: 'Ant Developers List' > Subject: RE: Ant extension, templatized build files > > > Interesting, and clever. You're example is missing targets in > bother and > sister to call down on the template to do the 'clean' target > for example. > You defined clean in parent.xml, but call 'build' sub-targets > for it... If > you did call 'clean' (as I believe you should), it would fail > as shown since > there's no 'clean' target in brother or sister.xml. > Basically, it means > every target you want to be able to call in parent.xml has to > be present in > all siblings build.xml, and call done on the template it's > using. May not be > a problem for you, but is a little constraining. Like I said though, > interesting! Thanks, --DD > > -----Original Message----- > From: Chad Loder [mailto:cloder@acm.org] > Sent: Wednesday, May 01, 2002 10:55 PM > To: Ant Developers List > Subject: Re: Ant extension, templatized build files > > Peter wrote: > > I would recomend you have a look at the existing projects > as they are > more > > likely to be imediately usable by you. > > I am personally turned off by what I've seen of Maven and > (to a lesser extent) Centipide. Ant is attractive because > it aims only to be a great, NEUTRAL build tool. Using ant by > itself implies no particular project management/structuring > ideology (i.e. "eXtreme programming", "The Apache way (tm)" > or whatever the buzzword of the year is). I don't want anyone > telling me how to structure my projects, how to do my unit testing, > etc. Rather than using Maven and struggling to turn all the > unwanted stuff off, I would like to use ant and build what's > necessary from scratch. > > To sum it up, I don't think one needs all the Maven baggage > to implement templatized buildfiles. Kudos to the Maven people > and all...it's just not how I do things. > > Therefore let me re-state my problem in the simplest way I > can. "Given a set of subprojects whose buildfiles share a high > degree of redundancy, how do I reduce this redundancy by factoring > the redundant portions into a single buildfile, while retaining the > flexibility to override the definitions of particular targets." > > Having thus restated my problem, I sat down and played with > ant 1.4, coming up with a solution that does what I need, > without requiring any ant changes whatsoever. > > I describe my solution below -- I'd like to know what people > think of it. Peter, in particular, I think you and I may be trying to > solve different problems (my needs being somewhat simpler). > > I'd like to get comments on this proposed solution (improvements? > possible complications or limitations down the road for large > projects?). > > THE SOLUTION > ------------ > > Assume there is one main project "parent" which consists of > two similar "Sibling"-style subprojects, "brother" and "sister". > The steps required to build a Sibling are always the same, > subject to minor differences subproject-specific differences > (compile flags, pre-build and post-build steps, etc.). > > If one had other kinds of subprojects (e.g., in addition to > Siblings, one wanted to build WinExe's or WinDLLs, etc.), > one could make a template-winexe.xml, template-windll.xml, > and so on. > > I created 4 build files: > > build.xml: the parent build file > brother.xml: the build file for the "brother" subproject > sister.xml: the build file for the "sister" subproject > template-sibling.xml: the "Sibling" template > > ----------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > > > > > > ----------------------------------------------------------------- > > > > > > > value="brother-pre-build"/> > > value="${ant.file}"/> > > > > > > > Executing the brother's pre-build targets > > > > Executing the brother's post-build targets > > > > > ----------------------------------------------------------------- > > > > > value="sister-pre-build"/> > value="${ant.file}"/> > value="sister-post-build"/> > value="${ant.file}"/> > > > > > Executing the sister's pre-build targets > > > > Executing the sister's post-build targets > > > > ----------------------------------------------------------------- > > > > > > > > > > > > > > Doing > pre-build. > ${project-pre-build-file}:${project-pre-build-targets} > target="${project-pre-build-targets}"/> > > > > Doing template build > Compile flags is ${compile-flags} > > > > > Doing > post-build. > ${project-post-build-file}:${project-post-build-targets} > target="${project-post-build-targets}"/> > > > > > > > > ----------------------------------------------------------------- > > > This gives me the desired results and *almost* all the flexibility > I need. Watch: > > $ ant > > Buildfile: build.xml > > build: > > children: > > build: > > pre-build: > [echo] Doing pre-build. > E:\r7\ant-test\brother.xml:brother-pre-build > > brother-pre-build: > [echo] Executing the brother's pre-build targets > > build: > [echo] Doing template build > [echo] Compile flags is /A /B /C /BROTHER > > post-build: > [echo] Doing post-build. > E:\r7\ant-test\template-sibling.xml:do-nothing > > do-nothing: > > build: > > pre-build: > [echo] Doing pre-build. > E:\r7\ant-test\sister.xml:sister-pre-build > > sister-pre-build: > [echo] Executing the sister's pre-build targets > > build: > [echo] Doing template build > [echo] Compile flags is /A /B /C > > post-build: > [echo] Doing post-build. > E:\r7\ant-test\sister.xml:sister-post-build > > sister-post-build: > [echo] Executing the sister's post-build targets > > BUILD SUCCESSFUL > Total time: 1 second > > > -- > To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: