Bug 53405 - ExtensionPoint doesn't work with nested import/include
ExtensionPoint doesn't work with nested import/include
Status: RESOLVED FIXED
Product: Ant
Classification: Unclassified
Component: Core
unspecified
PC Linux
: P2 normal (vote)
: ---
Assigned To: Ant Notifications List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-06-12 20:59 UTC by Jean-Louis Boudart
Modified: 2012-06-13 20:25 UTC (History)
0 users



Attachments
enhanced extension-point-test.xml to reproduce the use case with nested include/import (3.08 KB, patch)
2012-06-12 20:59 UTC, Jean-Louis Boudart
Details | Diff
patch to add support of extensionpoint with nested import and include (4.98 KB, patch)
2012-06-12 21:08 UTC, Jean-Louis Boudart
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Louis Boudart 2012-06-12 20:59:49 UTC
Created attachment 28923 [details]
enhanced extension-point-test.xml to reproduce the use case with nested include/import

ExtensionPoint doesn't work when using nested import/include and fails with a message "referenced target XXXX is not an extension-point".

Example :
Say we have three distinct build file :
* abstract-compile.xml defining an extension point named "compile"
* compile-java.xml imports abstract-compile.xml and define a concrete target "compile-java" referenced as an extension-of "compile" 
* build.xml (the main script) including compile-java.xml with a prefix "myprefix".

When project helper try to handle this use case, the build fail with the following message :
"referenced target 'compile' is not an extension-point".
Comment 1 Jean-Louis Boudart 2012-06-12 21:08:48 UTC
Created attachment 28924 [details]
patch to add support of extensionpoint with nested import and include

The problems seems to come when ProjectHelper duplicate the extension point while importing a build file.
ProjectHelper2 implementation is cloning the extension point as if it was a Target (using Target clone constructor).
Then, implementation check instanceof extension point and fails with the message mentioned in original description as it is a Target instance and not an ExtensionPoint instance.

I attached a patch to fix this.
Comment 2 Nicolas Lalevée 2012-06-13 20:25:34 UTC
Patch applied.
Thanks!