Buildship 3.0 is now available

buildship-release

(Donát Csikós) #1

We are happy to announce Buildship 3.0 featuring improved project synchronization, new public APIs and more.

Improved project synchronization

Buildship can now import projects even if their configuration is broken. In that case, the root project is imported as-is. Also, instead of using a custom error dialog, synchronization issues are shown via error markers. In case the location information is present in the stack trace, Buildship assigns the error marker to the proper resource.

New APIs

Buildship 3.0 now offers a stable API for downstream dependencies manage Gradle projects programmatically. The API has the following components:

1) Project Synchronization API

This API lets Eclipse plugins programmatically import and synchronize Gradle projects with the workspace. To import a new project, clients need to declare a build configuration and use it to obtain a reference to the Gradle build and execute the project synchronization:

BuildConfiguration configuration = BuildConfiguration
    .forRootProjectDirectory(new File("path/to/project"))
    .overrideWorkspaceConfiguration(true)
    .gradleDistribution(GradleDistribution.forVersion("4.10.2"))
    .autoSync(true)
    .build();
GradleWorkspace workspace = GradleCore.getWorkspace();
GradleBuild newBuild = workspace.createBuild(configuration);
newBuild.synchronize(monitor);

For existing projects, the Gradle build reference can be returned via the getBuild() method:

IProject project = ...
GradleBuild existingBuild = workspace.getBuild(project).get();
existingBuild.synchronize(monitor);

2) Task Execution API

This API exposes all Tooling API functionality. Clients can enumerate and execute tasks, inspect the configuration of the current build and more. The provided connection instances are preconfigured to re-use Buildship resources (views, inputs, outputs, cancellation, etc.) for the Gradle invocations. Here’s an example of how to execute a task:

IProject project = ...;
GradleWorkspace workspace = GradleCore.getWorkspace();
GradleBuild build = workspace.getBuild(project).get();
build.withConnection(connection -> connection.newBuild().forTasks("build").run(), monitor)

3) Project configurators

This is an extension point, via which external plugins can hook into Buildship synchronization logic and can provide additional configuration to each workspace projects. The required interface is quite simple:

public interface ProjectConfigurator {
    void init(InitializationContext context, IProgressMonitor monitor);
    void configure(ProjectContext context, IProgressMonitor monitor);
    void unconfigure(ProjectContext context, IProgressMonitor monitor);
}

The context objects provide access to the current Gradle build, the project being configured and the helper objects to report configurator errors.

Complete import configuration attributes

Buildship 3.0 now offers all configuration options on all preference levels. Users can set the Gradle user home, JVM arguments and more, for the entire workspace, for a specific Gradle build or for a single task execution.

Installation

Buildship 3.0 is available from the Eclipse Marketplace or from the eclipse.org update sites.