Buildship Tasks for Oomph

We are in the process of moving an application off of Maven and into Gradle. We want to use Buildship to import projects so that they are maintained as gradle projects.

We are also investigating using the eclipse installer to help distribute our applications developer environment. The problem I am running into is how to have these two items work together effectively.

What I think I need as a gradle project import task. But I am not sure. I was looking at Buildship’s own setup file for inspiration but so far I haven’t found anything to help me.

Any ideas on how to achieve this?

In Oomph there’s no Gradle specific project importer implemented. You can do what the Buildship project itself does. Add the Eclipse project descriptor files (.project, .classpath) to your version control, and use Oomph’s generic project importer.

Thanks for the confirmation. I did find some promising information about extending an oomph task to trigger a buildship import.

If that doesn’t work, then importing the project and classpath files will be the way to go.

Thanks again.

I am also looking for Oomph / Buildship support. Any plans to add Oomph support? Is this the proper place to ask or does it belong in the Oomph project?

So I’ve managed to rig together a simple Oomph task to run a SynchronizeGradleProjectJob and it works pretty well.

What I am not sure about is if this is the proper way to invoking actions through the buildship plugin At first I looked into going with just the Gradle Tooling API, modeling it after what Buildship does. But, I found Buildship to be quite complex and very difficult to pick apart.

I also looked at modeling my plugin to be similar to the Maven import plugin from Oomph but the architecture of that plugin and the tooling/buildship stuff is different enough that I can’t figure out how to do it that way.

I guess I am questioning how best to kick off Buildship programmatically. My goal is to create a plugin that will take as properties, all of the inputs of the import project wizard for gradle. Then, with those properties, I want to start up the same kind of operation that the buildship UI starts when performing that task. I am assuming I don’t have to worry about monitoring the job/operation since its done by buildship.

Hopefully this makes sense. Am I on the right track?

1 Like

You could use CorePlugin.workspaceManager().getGradleBuild(FixedRequestAttributes).synchronize(). Note that this is not public API and will change before we make it public.

Maybe you could contribute it to Oomph once the Buildship import API is stable. I’ve heard others ask for that as well.

I’m not sure how the extensibility story for Oomph looks like. My current assumption is that if you’re not in the standard installer than you might as well not exist. But that might be completely wrong.

Understood about the API aspect. Buildship seems like its still in flux, pieces like hooking into the progress monitors and providing cancellation opportunities are missing according to some of the TODO commentary in the code. I just noticed that GradleBuild.create() was renamed to GradleBuild.synchronize() for 2.0.x. I’m actually still working in 1.0.x so it caught me off guard.

I think it would be great to contribute to the Oomph project once Buildship is stable. Oomph uses EMF for modeling tasks and such so its quite extensible. You are right about the standard installer. The plugin would need to be added to the main index catalog. You can still add it yourself as a plugin to eclipse through P2 though.

Absolutely, public APIs were not our focus so far. Cleaning some of this stuff up is on our list though, as it will make contributing easier.

@jjstreet Do you have the Oomph support published somewhere? Did you have all the APIs you need to implement this? I’m asking because I am also interested in Buildship / Oomph support and created #376 to try and get the support built.

I don’t have anything published publicly unfortunately. But I was able to find another project doing something similar: https://github.com/herkne/buildship-import-4-oomph

It does something very similar to what I did, but with some more features that I did not implement or anything.

The gradle tooling API does have methods that can be used to compile projects, but I got the feeling that a lot of what buildship for custom eclipse support (new progress monitors and such) might need to be rebuilt for an oomph plugin. Or at least, they need to be made available in a way that makes sense for another plugin to use them.

Hope that makes some sense.

Is there a current solution for this missing feature? The given link for https://github.com/herkne/buildship-import-4-oomph is not usable anymore, since the project has been abandoned: https://github.com/herkne/buildship-import-4-oomph/issues/2

Nowadays this plugin works: https://github.com/fraenkelc/buildship3_setuptask. If you aren’t able to use it, check out the (closed) issue I submitted.

Thanks to Christian, Buildship has now Oomph import support.