diffplug / goomph

IDE as build artifact
Apache License 2.0
130 stars 30 forks source link

Run a custom Eclipse Builder with Goomph? #81

Closed jmini closed 4 years ago

jmini commented 6 years ago

Can Goomph be used to execute a Eclipse Custom Builder as a gradle step?

We have a custom Eclipse Builder that works on Eclipse Project having the java nature. This Builder perform some operations that are necessary in our build process.

For the moment the build is using Eclipse Buckminster (this project is no longer active). This tool starts an Headless Eclipse to compile the project on our CI-Server. This way we get the same result on the CI server as locally inside our Eclipse IDE.

We are trying to define a migration path to switch from Buckminster to Gradle. Of course in a final version we might rewrite some of our tooling to work as separated Gradle task independently from Eclipse IDE. But we think that a first step where we run an headless Eclipse inside a Gradle Task to let our builder perform his tasks might be less disruptive.

Does this make sense? Is it realistic? Do you think Goomph can be used/extended in a way useful for us?

Thank you for your advice.

nedtwigg commented 6 years ago

There are a few companies using goomph for exactly this purpose. The EquinoxLaunchPlugin should have everything needed for this.

jmini commented 6 years ago

Thank you a lot for your answer.

As this investigation is a side project for me, I can not spend as much time as I wish.

I hope you do not mind if I continue the conversation here, even if the issue is closed.


Is the org.eclipse.jdt.apt.core.aptBuild the application that you recommend to start to build the project?

Do you know if there is an example setup using this approach somewhere?

nedtwigg commented 6 years ago

I usually close issues after a week of inactivity, but I'm always happy to reopen them if there's renewed interest :)

I hadn't seen aptBuild before, but it looks to be a reasonable choice. There are two approaches you can take. To use apt build, you'll want to use P2AntRunner. It's a utility class used throughout Goomph, not a gradle task, but you can make a gradle task that uses it to run APT builder.

My suggestion above, EquinoxLaunchPlugin, is for running an Eclipse application (something like eclipsec -application someapp) - it doesn't have any special infrastructure for executing an eclipse workspace, so you'd have to handle all that logic inside whatever application you wrote.

It looks to me like aptBuild is your best bet. If I were you, I'd go about it like this:

If that fails, I think you'll have to resort to writing an Eclipse application that programmatically creates a workspace, loads your builder, etc, and then run it with EquinoxLaunchPlugin. Definitely possible, but a little tricky.

jmini commented 6 years ago

Thank you again for this information.

Have you an example setup of Goomph using the p2.mirror ant task inside a gradle build? I think it would help me to understand what is the basic setup.

nedtwigg commented 6 years ago

It's not a very good example, but this is the simplest I can easily dig up:

https://github.com/diffplug/goomph/blob/673bfe05a8425d2a7a078b32a52383582a6ae677/src/test/java/com/diffplug/gradle/eclipserunner/EclipseAppTest.java

https://github.com/diffplug/goomph/blob/master/src/main/java/com/diffplug/gradle/p2/P2AntRunner.java is mostly just a convenience around what the previous example demonstrates.