Buildship 3.1 is now available

(Donát Csikós) #1

We are happy to announce that Buildship 3.1 has just been released. The highlight of this release is the “Run tasks upon synchronization” story, which is the highest voted issue in the project’s bug tracker. The full list of changes is available here.

Run tasks on synchronization

Since Gradle 5.4, projects can declare an arbitrary set of tasks in the eclipse.synchronizationTasks configuration. Once configured, Gradle will automatically execute those tasks every time the user synchronizes workspace with the build.

plugins {
    id 'eclipse'
}

task foo {
    doLast {
        println 'foo'
    }
}

eclipse {
    synchronizationTasks foo
}

Run tasks on Eclipse build

Similarly to the feature above, tasks can be configured to execute every time the Eclipse auto-build is triggered:

plugins {
    id 'eclipse'
}

task foo {
    doLast {
        println 'foo'
    }
}

eclipse {
    autoBuildTasks foo
}

Installation

Buildship 3.1 can be installed from the Eclipse Marketplace or by using the usual update sites.

(Donát Csikós) #2

Update: we published a blog post that elaborates on the task execution: https://blog.gradle.org/buildship-sync-task-exec

(Nat Mishkin) #3

Hi @donat,

I got the synchronizationTasks feature to work in my project. That’s going to be a big win for our dev team.

WRT the autoBuildTasks feature, can you explain a bit about what the phrase “every time the Eclipse auto-build” means? I used to know a bit more about the Eclipse builder architecture than I remember now, but IIRC the builder runs only relatively infrequently and, for example, not when I’m just editing Java source files. And I know it runs when you do a “Project > Clean”. But other than that, I’m hazy on when it runs.

Like other projects, our Gradle build generates Java source files. The inputs into that source generation process are themselves Java source files. Ideally, whenever one edits and saves one of those input files in Eclipse, the Gradle task that does the generation process would run. However, even when I added the appropriate autoBuildTasks directive, that doesn’t happen. So either I’m misunderstanding the extent of the feature’s capability, or I’m doing something wrong.

Any suggestions?

Thanks.

Nat

(Donát Csikós) #4

Actually, it should happen quite frequently. Buildship launches autoBuildTasks every time a resource changes within the project and Project > Build Automatically Eclipse menu item is enabled. Did you turn off the option?

(Nat Mishkin) #5

For whatever reason my use of autoBuildTasks appears to be resulting in exactly nothing ever happening.

I do have Project > Build Automatically enabled. As an experiment, I turned it off and then did Project > Build on the project that uses autoBuildTasks. Still the Gradle build task didn’t run.

Is there some logging or other mechanisms I can enable to see what might be going on?

(Donát Csikós) #6

You can debug the plugin to see why the execution doesn’t reach this line: https://github.com/eclipse/buildship/blob/master/org.eclipse.buildship.core/src/main/java/org/eclipse/buildship/core/internal/configuration/DefaultGradleProjectBuilder.java#L46

(Angal Faria) #7

It is a very good news for me.
Thanks

(Angal Faria) #8

How many changes are taken for this?

(Angal Faria) #9

The full list of changes which you gave in your thread closed nine days ago. So how can I make it sure?