Bug 53405

Summary: ExtensionPoint doesn't work with nested import/include
Product: Ant Reporter: Jean-Louis Boudart <jlboudart>
Component: CoreAssignee: Ant Notifications List <notifications>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: enhanced extension-point-test.xml to reproduce the use case with nested include/import
patch to add support of extensionpoint with nested import and include

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!