Bug 245776 - More integration between custom builders and Eclipse's environment
Summary: More integration between custom builders and Eclipse's environment
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-30 16:19 EDT by userdeleted_bug262356 CLA
Modified: 2019-09-06 16:17 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description userdeleted_bug262356 CLA 2008-08-30 16:19:58 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1. Open project properties
2. Go to builders
3. New builder



More information:

I think Eclipse needs more support on custom builders. I mean it should be easier to write a builder integrating it with Eclipse's environment. For example, you could write some class MyBuilder extends org.eclipse.jdt.JavaBuilder... and then you'd have instant access to stuff like project's classpath.

Currently you can only create external builders: Ant scripts and Program. Both aren't integrated with Eclipse. 

For example, I wanted to write a JUnit test-on-save builder. I had a Java class whose main would run a test suite and show a JFace message box on failing tests. I had to put that class running on auto builds, that is, when you save your files. This way, every time I'd edit code and save file, it'd trigger the test suite and I'd see a nice integrated JFace message if any test failed. 

To get that class compiled I've created an user library called JFace, pointing to the required jars into eclipse's plugin directory. I've added JFace and JUnit libraries to the project's classpath.

The Ant builder however doesn't have access to project's classpath, neither the Program builder does. Both are run as external stuff, so you have to manually type each jar from JFace and JUnit as parameters to the builder, but jar versions change over new versions of Eclipse and location may change over each machine. So, I'm currently using a ruby script which dynamically seeks for the required jars and calls the specified test suite.

Therefore, it would be nice if you could write a Java class which would not be treated as an external program. I wonder even if it'd be necessary to extend some base class. We could maybe just have a "Java Class" or whatever added to the New builder options. That builder wouldn't require to specify classpath again since it'd run inside Eclipse context, just like any other class. 

Actually, I think this has the same effect as making it possible to get a run configuration always running on automatic builds (regardless of the current one).
Comment 1 Jerome Lanneluc CLA 2008-09-02 05:43:14 EDT
It looks like the use of the Java builder is just an example. The request seems to be more general. However I'm not sure to understand exactly what it is about. Could you please provide a scenario which would describe steps by steps what you expect? 
Comment 2 userdeleted_bug262356 CLA 2008-09-02 17:35:10 EDT
(In reply to comment #1)
> It looks like the use of the Java builder is just an example. The request seems
> to be more general. However I'm not sure to understand exactly what it is
> about. Could you please provide a scenario which would describe steps by steps
> what you expect? 
> 

Sure. I'd like to get my test suite running whenever I save my tested classes. There's a "continuous testing" plugin for 3.1 but not 3.4, therefor I wrote a builder to make it work.

The builder is activated on autobuilds (i.e. when you save files). The builder then needs to call a test suite which shows a JFace dialog in case of test failures. Therefore, I need to pass it a classpath pointing to JFace and JUnit.

Note that this classpath is _the same_ from the project, because that test suite class wouldn't compile if I hadn't JFace and JUnit in the project's calsspath. 

So I wrote a ruby script which dynamically discovers the JFace and JUnit jars, mount a classpath string and the calls the java command passing it that classpath string. The builder is that script: you specify ruby.exe as the program to run, the location inside bin folder of your test suite as working dir (because script passes . as classpath), the ruby script name and test suite class name as arguments to ruby.exe.

Therefore, when you run a builder you're running it outside Eclipse's context, this si why you need to pass a classpath config.

It would be nice however, if you were able to create an "internal builder", that is, you specify a _class_ to run, not an _external program, so you woudn't need to reconfigure your classpath since the class would run under the project's classpath.

I think this would have the same effect as being able to activate a Run configuration whenever you save files/ on autobuilds, but I don't know which of them would be suitable.



Comment 3 Eclipse Webmaster CLA 2019-09-06 16:17:06 EDT
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.