Skip to content

Commit

Permalink
Add new preview feature supporting Declarative Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
hegyibalint committed Oct 31, 2024
1 parent 6bb773e commit 622d678
Show file tree
Hide file tree
Showing 32 changed files with 1,167 additions and 27 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,25 @@ on:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
distribution: "zulu"
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
distribution: "temurin"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: Build with Gradle
run: ./gradlew build -x eclipseTest '-Pbuild.invoker=ci'


16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
# Eclipse Buildship: Gradle integration for the Eclipse IDE <a href="https://builds.gradle.org/viewType.html?buildTypeId=Tooling_Buildship_Checkpoint_Full_Test_Coverage_Phase_33"><img src="https://builds.gradle.org/guestAuth/app/rest/builds/buildType:(id:Tooling_Buildship_Checkpoint_Full_Test_Coverage_Phase_33)/statusIcon"/></a>

Buildship is a set of Eclipse Plug-ins that provide a deep integration of Gradle into the Eclipse IDE. Buildship is hosted
on [eclipse.org](https://projects.eclipse.org/projects/tools.buildship).

> [!TIP]
> We have preview of Declarative Gradle support. See [here](/docs/user/DeclarativeGradle.md) how to set it up.
## Requirements

Buildship can be used with Eclipse IDE 4.2.x or newer. Older versions of Eclipse the IDE might work but have not been tested explicitly. Depending
on the version of Gradle that Buildship interacts with, certain features of Buildship may not be available.


## Documentation

All documentation of Buildship for users and developers is hosted on [GitHub](https://github.com/eclipse/buildship).

More specifically, you can find

* [User documentation](docs/user/README.md) (plugin installation, current functionality)
* [Developer documentation](docs/development/README.md) (development environment setup)
* [Build documentation](docs/pluginbuild/README.md) (building Eclipse projects with Gradle)
* [Outline of upcoming stories](docs/stories/README.md)

- [User documentation](docs/user/README.md) (plugin installation, current functionality)
- [Developer documentation](docs/development/README.md) (development environment setup)
- [Build documentation](docs/pluginbuild/README.md) (building Eclipse projects with Gradle)
- [Outline of upcoming stories](docs/stories/README.md)

## Discussions &amp; News

We are very interested in feedback from the Gradle and Eclipse communities. All things Buildship are discussed on the [Gradle Forums](http://discuss.gradle.org/c/help-discuss/buildship).


## Issue Tracking

Issues are tracked on GitHub. Add your :thumbsup: for issues that you care about to help us prioritize them. If you want to follow our priorities and progress, install the [ZenHub](https://www.zenhub.com/extension) extension and have a look at our [board](https://github.com/eclipse/buildship#boards).
Expand Down
26 changes: 26 additions & 0 deletions docs/user/DeclarativeGradle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Declarative Gradle - EAP

Our [Declarative Gradle](https://declarative.gradle.org/) attempts to create an elegant and extensible declarative build language that enables expressing any build in a clear and understandable way.
Declarative uses a new `*.gradle.dcl` format, which resembles a simplified Kotlin language with some unique features.

Buildship provides some EAP support for the Declarative Gradle language by using our [declarative-lsp](https://github.com/gradle/declarative-lsp) project.

## Setup

In order to install

1. In the Help > Install New Software dialog, add the following update site: https://download.eclipse.org/buildship/updates/latest-snapshot/
1. Install the "Buildship - Gradle Declarative editor support" under the "Buildship Extras - Incubating" category.
1. Check out and build the [declarative-lsp](https://github.com/gradle/declarative-lsp) project by running `shadowJar`. The task should make a `lsp-all.jar` file under `build/libs`.
1. Go to the "Settings > Gradle > Experimental features" menu, and select this `lsp-all.jar` file.
1. Upon opening any `gradle.dcl` file, the LSP should turn on. Observe the console for any diagnostic messages.

## Sample projects

To try out the feature, take a look at our [sample projects](https://declarative.gradle.org/docs/getting-started/samples/).
These projects should be importable by Buildship without any problem, but make sure that the importing uses the wrapper shipped by the samples.

## Verifying if the LSP works

Eclipse offers a "Language Servers" view.
If everything is set up correctly, upon opening a DCL file, a "Declarative Gradle Language Server" entry should show up in the list persistently.
1 change: 1 addition & 0 deletions docs/user/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ The following user documentation of Buildship is currently available:
1. [Release Announcements](ReleaseAnnouncements.md)
1. [Overview of current functionality](Overview.md)
1. [Frequently Asked Questions](Faq.md)
1. [Declarative Gradle - EAP](DeclarativeGradle.md)
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ public final class WorkspaceConfiguration {
private final boolean showExecutionsView;
private final boolean experimentalModuleSupportEnabled;
private final boolean problemsApiSupportEnabled;
private final String lspJarPath;

public WorkspaceConfiguration(GradleDistribution gradleDistribution, File gradleUserHome,
File javaHome, boolean gradleIsOffline, boolean buildScansEnabled,
boolean autoSync, List<String> arguments,
List<String> jvmArguments, boolean showConsoleView,
boolean showExecutionsView, boolean experimentalModuleSupportEnabled, boolean problemApiSupportEnabled) {
boolean showExecutionsView, boolean experimentalModuleSupportEnabled, boolean problemApiSupportEnabled, String lspJarPath) {
this.gradleDistribution = gradleDistribution;
this.gradleUserHome = gradleUserHome;
this.javaHome = javaHome;
Expand All @@ -54,6 +55,7 @@ public WorkspaceConfiguration(GradleDistribution gradleDistribution, File gradle
this.showExecutionsView = showExecutionsView;
this.experimentalModuleSupportEnabled = experimentalModuleSupportEnabled;
this.problemsApiSupportEnabled = problemApiSupportEnabled;
this.lspJarPath = lspJarPath;
}

public GradleDistribution getGradleDistribution() {
Expand Down Expand Up @@ -107,6 +109,10 @@ public boolean isProblemsApiSupportEnabled() {
return this.problemsApiSupportEnabled;
}

public String getLspJarPath() {
return this.lspJarPath;
}

@Override
public boolean equals(Object obj) {
if (obj instanceof WorkspaceConfiguration) {
Expand All @@ -122,7 +128,8 @@ public boolean equals(Object obj) {
&& Objects.equal(this.showConsoleView, other.showConsoleView)
&& Objects.equal(this.showExecutionsView, other.showExecutionsView)
&& Objects.equal(this.experimentalModuleSupportEnabled, other.experimentalModuleSupportEnabled)
&& Objects.equal(this.problemsApiSupportEnabled, other.problemsApiSupportEnabled);
&& Objects.equal(this.problemsApiSupportEnabled, other.problemsApiSupportEnabled
&& Objects.equal(this.lspJarPath, other.lspJarPath));
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ final class WorkspaceConfigurationPersistence {
private static final String SHOW_EXECUTIONS_VIEW = "show.executions.view";
private static final String EXPERIMENTAL_ENABLE_MODULE_SUPPORT = "experimental.module.support";
private static final String PROBLEMS_API_SUPPORT = "problems.api.support";
private static final String LSP_JAR_PATH = "lsp.jar.path";

public WorkspaceConfiguration readWorkspaceConfig() {
IEclipsePreferences preferences = getPreferences();
Expand Down Expand Up @@ -74,7 +75,8 @@ public WorkspaceConfiguration readWorkspaceConfig() {
boolean showExecutionsView = preferences.getBoolean(SHOW_EXECUTIONS_VIEW, true);
boolean moduleSupport = preferences.getBoolean(EXPERIMENTAL_ENABLE_MODULE_SUPPORT, false);
boolean problemsApiSupport = preferences.getBoolean(PROBLEMS_API_SUPPORT, false);
return new WorkspaceConfiguration(distribution, gradleUserHome, javaHome, offlineMode, buildScansEnabled, autoSyncEnabled, arguments, jvmArguments, showConsoleView, showExecutionsView, moduleSupport, problemsApiSupport);
String lspJarPath = preferences.get(LSP_JAR_PATH, "");
return new WorkspaceConfiguration(distribution, gradleUserHome, javaHome, offlineMode, buildScansEnabled, autoSyncEnabled, arguments, jvmArguments, showConsoleView, showExecutionsView, moduleSupport, problemsApiSupport, lspJarPath);
}

public void saveWorkspaceConfiguration(WorkspaceConfiguration config) {
Expand All @@ -100,6 +102,7 @@ public void saveWorkspaceConfiguration(WorkspaceConfiguration config) {
preferences.putBoolean(SHOW_EXECUTIONS_VIEW, config.isShowExecutionsView());
preferences.putBoolean(EXPERIMENTAL_ENABLE_MODULE_SUPPORT, config.isExperimentalModuleSupportEnabled());
preferences.putBoolean(PROBLEMS_API_SUPPORT, config.isProblemsApiSupportEnabled());
preferences.put(LSP_JAR_PATH, config.getLspJarPath());
try {
preferences.flush();
} catch (BackingStoreException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public final class CoreMessages extends NLS {
public static String Preference_Label_ProblemsApiSupport;
public static String Preference_Label_ProblemsApiSupportHover;

public static String Preference_Label_LspJarPath;
public static String Preference_Label_LspJarBrowse;
public static String Preference_Label_LspJarPathFilterName;

static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, CoreMessages.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ Preference_Label_ShowExecutionsViewHover=Makes the Executions view visible durin
Preference_Label_ModulePath=Enable module support
Preference_Label_ModulePathHover=Add module dependencies to the modulepath
Preference_Label_ProblemsApiSupport=Enable Problems API support
Preference_Label_ProblemsApiSupportHover=Problems reported via the Problems API will appear as error markers on the UI.
Preference_Label_ProblemsApiSupportHover=Problems reported via the Problems API will appear as error markers on the UI.
Preference_Label_LspJarPath=Language Server Protocol JAR path
Preference_Label_LspJarBrowse=Browse
Preference_Label_LspJarPathFilterName=LSP JAR
17 changes: 17 additions & 0 deletions org.eclipse.buildship.dcl.feature/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.buildship.dcl.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions org.eclipse.buildship.dcl.feature/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

1 change: 1 addition & 0 deletions org.eclipse.buildship.dcl.feature/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apply plugin: eclipsebuild.FeaturePlugin
9 changes: 9 additions & 0 deletions org.eclipse.buildship.dcl.feature/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bin.includes = epl-v10.html,\
feature.xml,\
feature.properties,\
license.html
src.includes = build.properties,\
epl-v10.html,\
feature.xml,\
feature.properties,\
license.html
7 changes: 7 additions & 0 deletions org.eclipse.buildship.dcl.feature/category.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<bundle id="org.eclipse.buildship.dcl.provider">
<category name="Declarative DCL support"/>
</bundle>
<category-def name="Declarative Gradle" label="Features for Declarative Gradle support"/>
</site>
Loading

0 comments on commit 622d678

Please sign in to comment.