Community
Participate
Working Groups
Build Identifier: For a custom IDE based on Eclipse components, I would like to have the possibility to add Build Listeners to Ant Projects launched by the AntLauncher and executed within the same VM. Currently, I cannot determine any way to do this. The Build Listener would e.g. display the progress of the build in a graphical way. Possible implementation: The bundle org.eclipse.ant.launching could be extended with a central registry for BuildListener implementation class names. The registry would have to be accessible by clients. AntLaunchDelegate.configureAntRunner() would have to be extended to add these classes to the AntRunner in use. Reproducible: Didn't try
Ant already has support for adding your own build listeners: 1. AntRunner.addBuildListener(String) allows you to add a listener 2. You can add your own build listener / logger class to launch configurations using the -logger argument. More information about listeners / loggers can be found: http://ant.apache.org/manual/listeners.html Florian, does one (or both) of these methods satisfy your requirement(s)?
(In reply to comment #1) > Ant already has support for adding your own build listeners: > > 1. AntRunner.addBuildListener(String) allows you to add a listener > 2. You can add your own build listener / logger class to launch configurations > using the -logger argument. > > More information about listeners / loggers can be found: > http://ant.apache.org/manual/listeners.html > > Florian, does one (or both) of these methods satisfy your requirement(s)? Hi Michael, Unfortunately both methods are not satisfying: 1. The AntRunner object instantiated by the AntLauncherDelegate class cannot be accessed from outside that class in any way. If I could retrieve it from the AntLaunch or AntProcess object (which I can get with a Launch listener registered in the Debug Plugin), it would be fine. 2. The arguments would be a way. But in an IDE for developers, it would require the user to add an argument like "-listener de.clintworld.eclipse.ant.ui.AntBuildListener" to every created Ant launch just to have a GUI feature enabled. I would prefer that this feature is enabled for every build without any user action required.
(In reply to comment #2) > 2. The arguments would be a way. But in an IDE for developers, it would require > the user to add an argument like "-listener > de.clintworld.eclipse.ant.ui.AntBuildListener" to every created Ant launch just > to have a GUI feature enabled. I would prefer that this feature is enabled for > every build without any user action required. So you would like a way to register a listener that would be attached to every Ant build regardless of the user actually requesting the use of such a listener?
(In reply to comment #3) > So you would like a way to register a listener that would be attached to every > Ant build regardless of the user actually requesting the use of such a > listener? Yes, exactly. Of course the user could switch on or off this feature via Preferences, but in general our graphical View should be able to reflect the process of every Ant Build executed in the IDE.
Created attachment 207235 [details] A proposed implemenation of the requested feature
Created attachment 207236 [details] Image resources for the proposed feature implementation
Created attachment 207237 [details] An example plug-in project making use of the new feature
Created attachment 207240 [details] An example build file to use for testing the plug-in project Okay, I tried to implement a "clean" feature for this and added Listeners almost analogous to Tasks and Types: - There is a new extension point, antListeners - The user can disable registered listeners using the Preferences dialog - The listeners will be added to InternalAntLauncher executions as well as to executions in separate VMs (if they do not require Eclipse running) - I also included some graphics required for the GUI ;-) The attached example project shall demonstrate for what we want to use this feature. An additional progress monitor is added to the project references when a Task is starting, to which the task can report percentage progress. This progress is displayed via Eclipse Jobs API.
(In reply to comment #8) > Created attachment 207240 [details] > An example build file to use for testing the plug-in project Thanks for the patch Florian! Satyam or myself will review it as soon as we can.
Hi Florina, I haven't looked at the patch completely, but here are my initial comments. - What is the motivation for the listeners to be enabled by default? Your example plug-in is showing one usecase but I think it could be managed well by moving that into Task. There will be many kind of ant files in users workspace. Now with this change all listeners will be enabled by this change. - Shouldn't the list of listeners be also shown in the launch configuration? - Please add your name/company to the copyright messages - All @since can have 3.3 - Manifest file can be updated (I can take care of this) - Are the other constructors required in Listener? - Message to call of configureAntObject should go to the Messages file.. - IAntCoreConstants: New preference should be categorized accordingly - InternalAntRunner: If the same listener is mentioned in the command line, it is likely to get added. - The UI should have the checkbox in the first column rather than the last column. Look at Templates.
(In reply to comment #10) Hi Satyam, Thank you for your comments. I got most of the points, and will change my patch proposal accordingly. One question is left: > - InternalAntRunner: If the same listener is mentioned in the command line, it > is likely to get added. What do you mean with "mentioned in the command line"? Do you refer to the code adding the listener to the command line (in AntLaunchDelegate)? This is only done for Ant Builds running in a separate VM, as they are not using AntRunner. Adding the listener to the command line passed to the AntRunner does not work (for whatever reason).
> What do you mean with "mentioned in the command line"? Do you refer to the code > adding the listener to the command line (in AntLaunchDelegate)? This is only > done for Ant Builds running in a separate VM, as they are not using AntRunner. > Adding the listener to the command line passed to the AntRunner does not work > (for whatever reason). I actually meant for "same vm". Actually command line is a wrong word. It should been specified in the arguments. Look at InternalAntRunner#run(). It calls addBuildListeners() in the beginning. Listeners registered through extension point gets added through setListeners(). So, if somebody mentions the same listener in the argument, it gets added twice. I haven't run or tried out, but looking at the code, I think the listener will run twice.
(In reply to comment #12) > I actually meant for "same vm". Actually command line is a wrong word. It > should been specified in the arguments. Look at InternalAntRunner#run(). It > calls addBuildListeners() in the beginning. Listeners registered through > extension point gets added through setListeners(). So, if somebody mentions the > same listener in the argument, it gets added twice. I haven't run or tried out, > but looking at the code, I think the listener will run twice. You are right, but when the user explicitly (with the other changes you suggested) enables a "provided" listener via the Preferences dialog, adding it also explicitly via the launch configuration arguments should IMO result in executing this listener twice. (Notice that "custom" listeners cannot be registered in the Preferences, as these could indeed simply be added to the arguments of the launch configuration.)
(In reply to comment #13) > You are right, but when the user explicitly (with the other changes you > suggested) enables a "provided" listener via the Preferences dialog, adding it > also explicitly via the launch configuration arguments should IMO result in > executing this listener twice. If anybody adds the listener twice in the argument list, it will be run only once. Taking the same argument further, I don't think the listener should run twice. Moreover, will someone want the listener to be run twice? > (Notice that "custom" listeners cannot be registered in the Preferences, as > these could indeed simply be added to the arguments of the launch > configuration.) Putting in a different way, listeners registered in the preferences can be "custom" listeners, isn't it?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the "stalebug" whiteboard tag.