As per the documentation on extension-points, there is a note that this is designed to be used with imported build files. I tried to create the example given (see attached files) where build.xml imports targets and an extension-point and then adds a dependency via the extensionOf. This results in an error that the extension-point does not exist, which it doesn't because the import is done after the build is parsed. I believe that I have the intent correct but that there is a bug in TargetHelper in ProjectHelper2. I can see that the extensionOf needs to find the other target so that it can add a dependency but that that target doesn't exist since the import stack hasn't been fully popped. I believe that the fix is to change ProjectHelper2 (I will try to create my own in the short term) to add the extension to a stack which then is processed after the import stack is done. That is, all extensions should be done after the imports are done.
Created attachment 25043 [details] build file from documentation
Created attachment 25044 [details] imported file from documentations
Created attachment 25045 [details] changed ProjectHelper
Created attachment 25046 [details] changed ProjectHelper2
Hi, Brian, and thanks for the submission. Typically the Ant developers are much better able to digest the intent of a change if it is provided as a patch against the svn trunk code. When you attach your changes in this format, you should also edit the title of the issue so that it begins with [PATCH]. Regards, Matt
Just tried these against a different scenario and it fails - please don't use these (I can't delete them). I didn't find any quick setup guide so that I could provide you a patch (I can't get the source bundle to not report errors in Eclipse) so you probably won't get that from me. I'm assuming you can do a diff. Thanks!
Created attachment 25047 [details] working ProjectHelper2
Created attachment 25048 [details] working ProjectHelper
I'm having this same problem and have found a work around. If your build files look like this: <project name="imported"> <extension-point name="extend-this"/> </project> <project name="importing"> <import file="imported"/> <target name="extending" extentionOf="extend-this"/> </project> Ant will complain that extend-this does not exist. By wrapping these build files in another Ant will not complain. The initial build files do not need to be modified so the wrapper files can be deleted when this bug is fixed. <project name="wrapper"> <import file="imported"/> <import file="importing"/> </project>
Created attachment 25155 [details] Patch for AntUnit testfile for showing this bug Attached a path for the AntUnit test. - create imported buildfile (defining extension-point) - create importing buildfile (enhancing the EP) - invoking the importing file - checks for the expected output
Jan, your test would even fail if there was no bug since you never call any target 8-) I've a modified version of the patch just undergoing ants unit test suite, it breaks at least one test: testExtensionPointMustBeKnown. This on asserts you can't extend an extension point that is defined later inside the same build file, which is no longer true. I'll poll the dev list to see whether this change is more of a benefit than a problem.
Created attachment 25340 [details] Consolidated Brian's changes and Jan's testcase I have modified Brian's original change to use a linked list rather than a vector and a two-element string array rather than a map, but these changes are really minor.
fixed with svn revision 938315 Thanks