Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eclipse Java Language Server compatibility #381

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ fun Project.configureIdeSync(vararg generateAllTasks: TaskProvider<Task>) {
}
}
}

//todo wasn't able to find something for VS(Code)
}

inline fun <reified T : Any> ExtensionContainer.findByType(noinline action: T.() -> Unit) {
Expand Down
31 changes: 31 additions & 0 deletions bungee/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import org.gradle.plugins.ide.eclipse.model.AccessRule
import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry

plugins {
// suppress unsafe access errors for eclipse
id("eclipse")
}

var bungeeCommit = "ff5727c"
var gsonVersion = "2.8.0"
var guavaVersion = "21.0"
Expand All @@ -18,3 +26,26 @@ provided("com.github.SpigotMC.BungeeCord", "bungeecord-proxy", bungeeCommit)
provided("com.google.code.gson", "gson", gsonVersion)
provided("com.google.guava", "guava", guavaVersion)
provided("org.yaml", "snakeyaml", Versions.snakeyamlVersion)

// found how to do this here https://github.com/JFormDesigner/markdown-writer-fx/blob/main/build.gradle.kts
eclipse {
classpath {
file {
whenMerged.add( object: Action<org.gradle.plugins.ide.eclipse.model.Classpath> {
override fun execute( classpath: org.gradle.plugins.ide.eclipse.model.Classpath ) {
val jre = classpath.entries.find {
it is AbstractClasspathEntry &&
it.path.contains("org.eclipse.jdt.launching.JRE_CONTAINER")
} as AbstractClasspathEntry

// make sun.misc accessible in Eclipse project
// (when refreshing Gradle project in buildship)
jre.accessRules.add(AccessRule("accessible", "sun/misc/**"))

// remove trailing slash from jre path
if (jre.path.endsWith("/")) jre.path = jre.path.substring(0, jre.path.length - 1)
}
} )
}
}
}
14 changes: 13 additions & 1 deletion database/mongo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
// allow resolution of compileOnlyApi dependencies in Eclipse
id("eclipse")
}

val mongoClientVersion = "4.4.1"

dependencies {
Expand All @@ -8,4 +13,11 @@ dependencies {
description = "The Floodgate database extension for MongoDB"

relocate("com.mongodb")
relocate("org.bson")
relocate("org.bson")

eclipse {
classpath {
configurations.compileOnlyApi.get().setCanBeResolved(true)
plusConfigurations.add( configurations.compileOnlyApi.get() )
}
}
12 changes: 12 additions & 0 deletions database/mysql/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
// allow resolution of compileOnlyApi dependencies in Eclipse
id("eclipse")
}

val mysqlClientVersion = "8.0.30"
val hikariVersion = "4.0.3"

Expand All @@ -10,3 +15,10 @@ dependencies {
description = "The Floodgate database extension for MySQL"

relocate("org.mariadb")

eclipse {
classpath {
configurations.compileOnlyApi.get().setCanBeResolved(true)
plusConfigurations.add( configurations.compileOnlyApi.get() )
}
}
12 changes: 12 additions & 0 deletions database/sqlite/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
// allow resolution of compileOnlyApi dependencies in Eclipse
id("eclipse")
}

val sqliteJdbcVersion = "3.36.0.3"

dependencies {
Expand All @@ -6,3 +11,10 @@ dependencies {
}

description = "The Floodgate database extension for SQLite"

eclipse {
classpath {
configurations.compileOnlyApi.get().setCanBeResolved(true)
plusConfigurations.add( configurations.compileOnlyApi.get() )
}
}