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

2008-02-14 Thread Justin Vallon

Peter Reilly wrote:

On Jan 28, 2008 10:55 PM, Vallon, Justin [EMAIL PROTECTED] wrote:
   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
[EMAIL PROTECTED]
--- src/main/org/apache/tools/ant/Main.java.orig2007-05-25 
06:31:03.0 -0400
+++ src/main/org/apache/tools/ant/Main.java 2008-02-14 12:58:10.556245800 
-0500
@@ -418,10 +418,13 @@
 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

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

2008-01-29 Thread Peter Reilly
On Jan 28, 2008 10:55 PM, Vallon, Justin [EMAIL PROTECTED] wrote:




 When import is given the same path twice, it skips the second import.
 However, 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) ...
 unless ant is invoked as ant –f /full/path/to/build.xml - then import does
 recognize that the file has already been imported.

That does sound like a bug!.

Please file a bugzilla report.

Ta.

Peter



 I would expect that import should not (ever) import the top-level build file
 again.



 Is this a bug?  I can submit a bug report and try to fix it.



 Why import the top-level file?  In a (parent, subproject1, subproject2,
 subproject3) setup, my parent project imports the subprojects and the
 subprojects import the parents – subprojects do not import each other.  When
 the parent is built, the top-level project imports subproject A, and
 subproject A imports the parent.  The import of the parent is not suppressed
 because the top-level build was not invoked with a full-path to the build
 file, and confusion ensues.



 Example:



 $ cat build.xml

 project name=test

 echo message=test-top /

 import file=./build.xml /

 echo message=test-bottom /

 /project



 $ ant

 Buildfile: build.xml

  [echo] test-top

  [echo] test-top

  [echo] test-bottom

  [echo] test-bottom



 BUILD SUCCESSFUL

 Total time: 0 seconds



 $ ant -f $PWD/build.xml

 Buildfile: /a/vallon/tmp/tmp.20080128/build.xml

  [echo] test-top

  [echo] test-bottom



 BUILD SUCCESSFUL

 Total time: 0 seconds



 $ ant -version

 Apache Ant version 1.7.0 compiled on December 13 2006





 -Justin

 office 8-383-6725, 212-272-6725; cell 917-861-6042




 ***
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



import re-imports top-level build.xml

2008-01-28 Thread Vallon, Justin
When import is given the same path twice, it skips the second import.
However, 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) ... unless ant is invoked as ant -f /full/path/to/build.xml -
then import does recognize that the file has already been imported.

 

I would expect that import should not (ever) import the top-level build
file again.

 

Is this a bug?  I can submit a bug report and try to fix it.

 

Why import the top-level file?  In a (parent, subproject1, subproject2,
subproject3) setup, my parent project imports the subprojects and the
subprojects import the parents - subprojects do not import each other.
When the parent is built, the top-level project imports subproject A,
and subproject A imports the parent.  The import of the parent is not
suppressed because the top-level build was not invoked with a full-path
to the build file, and confusion ensues.

 

Example:

 

$ cat build.xml

project name=test

echo message=test-top /

import file=./build.xml /

echo message=test-bottom /

/project

 

$ ant

Buildfile: build.xml

 [echo] test-top

 [echo] test-top

 [echo] test-bottom

 [echo] test-bottom

 

BUILD SUCCESSFUL

Total time: 0 seconds

 

$ ant -f $PWD/build.xml

Buildfile: /a/vallon/tmp/tmp.20080128/build.xml

 [echo] test-top

 [echo] test-bottom

 

BUILD SUCCESSFUL

Total time: 0 seconds

 

$ ant -version

Apache Ant version 1.7.0 compiled on December 13 2006

 

 

-Justin

office 8-383-6725, 212-272-6725; cell 917-861-6042

 



***
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]