You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2025/06/30 13:30:13 UTC
(lucene) branch main updated: An attempt to use gradle's eclipse plugin to provide us with src paths for libs (#14870)
This is an automated email from the ASF dual-hosted git repository.
dweiss pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new f4339ee2aea An attempt to use gradle's eclipse plugin to provide us with src paths for libs (#14870)
f4339ee2aea is described below
commit f4339ee2aea65bdf1efb2a3c196c3e9a4adf9d67
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Mon Jun 30 15:30:07 2025 +0200
An attempt to use gradle's eclipse plugin to provide us with src paths for libs (#14870)
---
.../src/main/groovy/lucene.ide.eclipse.gradle | 53 ++++++++--------------
.../dot.settings/org.eclipse.jdt.core.prefs | 2 +
2 files changed, 20 insertions(+), 35 deletions(-)
diff --git a/build-tools/build-infra/src/main/groovy/lucene.ide.eclipse.gradle b/build-tools/build-infra/src/main/groovy/lucene.ide.eclipse.gradle
index a6d3160cf61..1b58e809dd0 100644
--- a/build-tools/build-infra/src/main/groovy/lucene.ide.eclipse.gradle
+++ b/build-tools/build-infra/src/main/groovy/lucene.ide.eclipse.gradle
@@ -42,14 +42,28 @@ if (gradle.startParameter.taskNames.contains("eclipse")) {
classpath {
defaultOutputDir = file('build/eclipse')
+ downloadSources = true
+ downloadJavadoc = false
+
+ plusConfigurations += allprojects.findAll{ prj ->
+ return prj.plugins.hasPlugin(JavaPlugin)
+ }.collectMany {
+ return [ it.configurations.compileClasspath, it.configurations.testCompileClasspath ]
+ }
+
file {
- beforeMerged { classpath ->
+ whenMerged { classpath ->
classpath.entries.removeAll {
- it.kind == "src"
+ return it.kind == "src" || (it.kind == "lib" && it.getPath() ==~ /(.+)lucene-.*\.jar/)
+ }
+
+ // I'm not sure what these attributes are supposed to do. Keeping the previous version of having no-attributes.
+ classpath.entries.each {
+ if (it.kind == "lib") {
+ it.getEntryAttributes().clear()
+ }
}
- }
- whenMerged { classpath ->
def projects = allprojects.findAll { prj ->
return prj.plugins.hasPlugin(JavaPlugin)
}
@@ -62,7 +76,6 @@ if (gradle.startParameter.taskNames.contains("eclipse")) {
'tools'
] as Set
Set<String> sources = []
- Set<File> jars = []
projects.each { prj ->
prj.sourceSets.each { sourceSet ->
if (sourceSetNames.contains(sourceSet.name)) {
@@ -70,13 +83,6 @@ if (gradle.startParameter.taskNames.contains("eclipse")) {
sources += sourceSet.resources.srcDirs.findAll { dir -> dir.exists() }.collect { dir -> relativize(dir) }
}
}
-
- // This is hacky - we take the resolved compile classpath and just
- // include JAR files from there. We should probably make it smarter
- // by looking at real dependencies. But then: this Eclipse configuration
- // doesn't really separate sources anyway so why bother.
- jars += prj.configurations.compileClasspath.resolve()
- jars += prj.configurations.testCompileClasspath.resolve()
}
classpath.entries += sources.sort().collect { name ->
@@ -84,9 +90,6 @@ if (gradle.startParameter.taskNames.contains("eclipse")) {
sourceFolder.setExcludes(["module-info.java"])
return sourceFolder
}
- classpath.entries += jars.unique().findAll { location -> location.isFile() && !(location.name ==~ /lucene-.*\.jar/) }.collect { location ->
- new LibEntry(location.toString())
- }
}
}
}
@@ -132,23 +135,3 @@ if (gradle.startParameter.taskNames.contains("eclipse")) {
}
}
-public class LibEntry implements ClasspathEntry {
- private String path;
-
- LibEntry(String path) {
- this.path = path;
- }
-
- @Override
- String getKind() {
- return "lib"
- }
-
- @Override
- void appendNode(Node node) {
- node.appendNode("classpathentry", Map.of(
- "kind", "lib",
- "path", path
- ))
- }
-}
diff --git a/gradle/ide/eclipse/dot.settings/org.eclipse.jdt.core.prefs b/gradle/ide/eclipse/dot.settings/org.eclipse.jdt.core.prefs
index 2f4303bb257..a25766d92b1 100644
--- a/gradle/ide/eclipse/dot.settings/org.eclipse.jdt.core.prefs
+++ b/gradle/ide/eclipse/dot.settings/org.eclipse.jdt.core.prefs
@@ -3,6 +3,8 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=@eclipseJavaVersion@
org.eclipse.jdt.core.compiler.compliance=@eclipseJavaVersion@
org.eclipse.jdt.core.compiler.source=@eclipseJavaVersion@
+# this turns off split package checks, which gradle-api jar contains. https://github.com/gradle/gradle/issues/19577
+org.eclipse.jdt.core.compiler.ignoreUnnamedModuleForSplitPackage=enabled
# Note: all compiler flags are defined in ECJ linter configuration
@ecj-lint-config@
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false