Skip to content

Commit 8d188af

Browse files
committed
Fix es-core build.gradle for the 9 MR jar
1 parent a703f16 commit 8d188af

File tree

1 file changed

+43
-23
lines changed

1 file changed

+43
-23
lines changed

libs/elasticsearch-core/build.gradle

+43-23
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,45 @@ apply plugin: 'nebula.maven-scm'
2626

2727
archivesBaseName = 'elasticsearch-core'
2828

29+
// we want to keep the JDKs in our IDEs set to JDK 8 until minimum JDK is bumped to 9 so we do not include this source set in our IDEs
30+
if (!isEclipse && !isIdea) {
31+
sourceSets {
32+
java9 {
33+
java {
34+
srcDirs = ['src/main/java9']
35+
}
36+
}
37+
}
38+
39+
configurations {
40+
java9Compile.extendsFrom(compile)
41+
}
42+
43+
dependencies {
44+
java9Compile sourceSets.main.output
45+
}
46+
47+
compileJava9Java {
48+
sourceCompatibility = 9
49+
targetCompatibility = 9
50+
}
51+
52+
/* Enable this when forbiddenapis was updated to 2.6.
53+
* See: https://github.com/elastic/elasticsearch/issues/29292
54+
forbiddenApisJava9 {
55+
targetCompatibility = 9
56+
}
57+
*/
58+
59+
jar {
60+
metaInf {
61+
into 'versions/9'
62+
from sourceSets.java9.output
63+
}
64+
manifest.attributes('Multi-Release': 'true')
65+
}
66+
}
67+
2968
publishing {
3069
publications {
3170
nebula {
@@ -39,6 +78,10 @@ dependencies {
3978
testCompile "junit:junit:${versions.junit}"
4079
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
4180

81+
if (!isEclipse && !isIdea) {
82+
java9Compile sourceSets.main.output
83+
}
84+
4285
if (isEclipse == false || project.path == ":libs:elasticsearch-core-tests") {
4386
testCompile("org.elasticsearch.test:framework:${version}") {
4487
exclude group: 'org.elasticsearch', module: 'elasticsearch-core'
@@ -52,29 +95,6 @@ forbiddenApisMain {
5295
signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
5396
}
5497

55-
// we want to keep the JDKs in our IDEs set to JDK 8 until minimum JDK is bumped to 9 so we do not include this source set in our IDEs
56-
if (!isEclipse && !isIdea) {
57-
sourceSets {
58-
java9 {
59-
java {
60-
srcDirs = ['src/main/java9']
61-
}
62-
}
63-
}
64-
65-
compileJava9Java {
66-
sourceCompatibility = 9
67-
targetCompatibility = 9
68-
}
69-
70-
jar {
71-
into('META-INF/versions/9') {
72-
from sourceSets.java9.output
73-
}
74-
manifest.attributes('Multi-Release': 'true')
75-
}
76-
}
77-
7898
if (isEclipse) {
7999
// in eclipse the project is under a fake root, we need to change around the source sets
80100
sourceSets {

0 commit comments

Comments
 (0)