Skip to content

Commit 07eefa9

Browse files
authored
Clean up eclipse build (#53831)
* Clean up eclipse build Fixes up the "forbidden" warnings that you get when you import Elasticsearch using "import gradle projects". With this, and the manual step of switching circular project definitions to warnings this gets most thing *compiling*. * Move
1 parent 64d228c commit 07eefa9

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

build.gradle

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717
* under the License.
1818
*/
1919

20-
2120
import com.avast.gradle.dockercompose.tasks.ComposePull
2221
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
22+
import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin
2323
import org.apache.tools.ant.taskdefs.condition.Os
2424
import org.elasticsearch.gradle.BuildPlugin
2525
import org.elasticsearch.gradle.BwcVersions
2626
import org.elasticsearch.gradle.Version
2727
import org.elasticsearch.gradle.VersionProperties
2828
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
29+
import org.gradle.plugins.ide.eclipse.model.AccessRule
2930
import org.gradle.plugins.ide.eclipse.model.SourceFolder
3031
import org.gradle.util.DistributionLocator
3132
import org.gradle.util.GradleVersion
@@ -378,6 +379,21 @@ allprojects {
378379
}
379380
}
380381
}
382+
/*
383+
* Allow accessing com/sun/net/httpserver in projects that have
384+
* configured forbidden apis to allow it.
385+
*/
386+
plugins.withType(ForbiddenApisPlugin) {
387+
eclipse.classpath.file.whenMerged { classpath ->
388+
if (false == forbiddenApisTest.bundledSignatures.contains('jdk-non-portable')) {
389+
classpath.entries
390+
.findAll { it.kind == "con" && it.toString().contains("org.eclipse.jdt.launching.JRE_CONTAINER") }
391+
.each {
392+
it.accessRules.add(new AccessRule("accessible", "com/sun/net/httpserver/*"))
393+
}
394+
}
395+
}
396+
}
381397

382398
File licenseHeaderFile
383399
String prefix = ':x-pack'

x-pack/plugin/sql/sql-client/build.gradle

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,3 @@ forbiddenApisTest {
3434
forbiddenPatterns {
3535
exclude '**/*.keystore'
3636
}
37-
38-
// Allow for com.sun.net.httpserver.* usage for testing
39-
eclipse {
40-
classpath.file {
41-
whenMerged { cp ->
42-
def con = entries.find { e ->
43-
e.kind == "con" && e.toString().contains("org.eclipse.jdt.launching.JRE_CONTAINER")
44-
}
45-
con.accessRules.add(new org.gradle.plugins.ide.eclipse.model.AccessRule(
46-
"accessible", "com/sun/net/httpserver/*"))
47-
}
48-
}
49-
}

0 commit comments

Comments
 (0)