Apache Lucene open-source search software
An attempt to use gradle's eclipse plugin to provide us with src paths for libs (#14870)
Dawid Weissf4339ee2aea6
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.gradleindex 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 SetSet<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.prefsindex 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=1org.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