Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Developers List »

Re: import re-imports top-level build.xml

Vallon, Justin

2008-02-14


Author LoginPost Reply
Peter Reilly wrote:
> On Jan 28, 2008 10:55 PM, Vallon, Justin <jvallon@(protected):
> > if <import> is given a path to the original (top-level)
> build-file,
> > it does not consider it a duplicate import, and imports it (again) ...
>
> That does sound like a bug!.
>
> Please file a bugzilla report.

Filed as 44323.

I have attached a patch against ant_20080130114915.tar.gz. It calls
FileUtils.normalize on the buildFile in Main.

Who can commit this?

Test case:

build.xml:
 <project name="test">
   <echo message="start test" />
   <import file="./build.xml" />
   <echo message="end test" />
 </project>

'ant' should show "start test", "end test". Without the patch it shows
"start test"*2, "end test"*2.

-Justin
jvallon@(protected)
--- src/main/org/apache/tools/ant/Main.java.orig  2007-05-25 06:31:03.000000000 -0400
+++ src/main/org/apache/tools/ant/Main.java  2008-02-14 12:58:10.556245800 -0500
@@(protected) @@
     if (buildFile.isDirectory()) {
        System.out.println("What? Buildfile: " + buildFile + " is a dir!");
        throw new BuildException("Build failed");
     }

+     // Normalize buildFile for re-import detection
+     buildFile = FileUtils.getFileUtils().normalize(buildFile.getAbsolutePath());
+    
     // Load the property files specified by -propertyfile
     loadPropertyFiles();

     if (msgOutputLevel >= Project.MSG_INFO) {
        System.out.println("Buildfile: " + buildFile);

***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@(protected)
For additional commands, e-mail: dev-help@(protected)
©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.