Skip to content

Commit cf2295b

Browse files
authored
Add JDK11 support and enable in CI (#31644)
* Upgrade bouncycastle Required to fix `bcprov-jdk15on-1.55.jar; invalid manifest format ` on jdk 11 * Downgrade bouncycastle to avoid invalid manifest * Add checksum for new jars * Update tika permissions for jdk 11 * Mute test failing on jdk 11 * Add JDK11 to CI * Thread#stop(Throwable) was removed http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-June/053536.html * Disable failing tests #31456 * Temprorarily disable doc tests To see if there are other failures on JDK11 * Only blacklist specific doc tests * Disable only failing tests in ingest attachment plugin * Mute failing HDFS tests #31498 * Mute failing lang-painless tests #31500 * Fix backwards compatability builds Fix JAVA version to 10 for ES 6.3 * Add 6.x to bwx -> java10 * Prefix out and err from buildBwcVersion for readability ``` > Task :distribution:bwc:next-bugfix-snapshot:buildBwcVersion [bwc] :buildSrc:compileJava [bwc] WARNING: An illegal reflective access operation has occurred [bwc] WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/alpar/.gradle/wrapper/dists/gradle-4.5-all/cg9lyzfg3iwv6fa00os9gcgj4/gradle-4.5/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize() [bwc] WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass [bwc] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations [bwc] WARNING: All illegal access operations will be denied in a future release [bwc] :buildSrc:compileGroovy [bwc] :buildSrc:writeVersionProperties [bwc] :buildSrc:processResources [bwc] :buildSrc:classes [bwc] :buildSrc:jar ``` * Also set RUNTIME_JAVA_HOME for bwcBuild So that we can make sure it's not too new for the build to understand. * Align bouncycastle dependency * fix painles array tets closes #31500 * Update jar checksums * Keep 8/10 runtime/compile untill consensus builds on 11 * Only skip failing tests if running on Java 11 * Failures are dependent of compile java version not runtime * Condition doc test exceptions on compiler java version as well * Disable hdfs tests based on runtime java * Set runtime java to minimum supported for bwc * PR review * Add comment with ticket for forbidden apis
1 parent 0a2ef59 commit cf2295b

File tree

23 files changed

+107
-26
lines changed

23 files changed

+107
-26
lines changed

.ci/matrix-build-javas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77

88
ES_BUILD_JAVA:
99
- java10
10+
- java11

.ci/matrix-runtime-javas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
ES_RUNTIME_JAVA:
99
- java8
1010
- java10
11+
- java11

buildSrc/src/main/resources/forbidden/jdk-signatures.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ java.lang.Thread#getAllStackTraces()
8888

8989
@defaultMessage Stopping threads explicitly leads to inconsistent states. Use interrupt() instead.
9090
java.lang.Thread#stop()
91-
java.lang.Thread#stop(java.lang.Throwable)
91+
# uncomment when https://github.com/elastic/elasticsearch/issues/31715 is fixed
92+
# java.lang.Thread#stop(java.lang.Throwable)
9293

9394
@defaultMessage Please do not terminate the application
9495
java.lang.System#exit(int)

distribution/bwc/build.gradle

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
*/
1919

2020

21+
2122
import org.apache.tools.ant.taskdefs.condition.Os
2223
import org.elasticsearch.gradle.LoggedExec
2324
import org.elasticsearch.gradle.Version
2425

25-
import static org.elasticsearch.gradle.BuildPlugin.getJavaHome
26+
import java.nio.charset.StandardCharsets
2627

28+
import static org.elasticsearch.gradle.BuildPlugin.getJavaHome
2729
/**
2830
* This is a dummy project which does a local checkout of the previous
2931
* wire compat version's branch, and builds a snapshot. This allows backcompat
@@ -147,12 +149,16 @@ subprojects {
147149

148150
task buildBwcVersion(type: Exec) {
149151
dependsOn checkoutBwcBranch, writeBuildMetadata
152+
// send RUNTIME_JAVA_HOME so the build doesn't fails on newer version the branch doesn't know about
153+
environment('RUNTIME_JAVA_HOME', getJavaHome(it, rootProject.ext.minimumRuntimeVersion.getMajorVersion() as int))
150154
workingDir = checkoutDir
155+
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
151156
if (["5.6", "6.0", "6.1"].contains(bwcBranch)) {
152-
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
153157
environment('JAVA_HOME', getJavaHome(it, 8))
154158
} else if ("6.2".equals(bwcBranch)) {
155159
environment('JAVA_HOME', getJavaHome(it, 9))
160+
} else if (["6.3", "6.x"].contains(bwcBranch)) {
161+
environment('JAVA_HOME', getJavaHome(it, 10))
156162
} else {
157163
environment('JAVA_HOME', project.compilerJavaHome)
158164
}
@@ -177,6 +183,8 @@ subprojects {
177183
} else if (showStacktraceName.equals("ALWAYS_FULL")) {
178184
args "--full-stacktrace"
179185
}
186+
standardOutput = new IndentingOutputStream(System.out)
187+
errorOutput = new IndentingOutputStream(System.err)
180188
doLast {
181189
List missing = artifactFiles.grep { file ->
182190
false == file.exists()
@@ -196,3 +204,27 @@ subprojects {
196204
}
197205
}
198206
}
207+
208+
class IndentingOutputStream extends OutputStream {
209+
210+
public static final byte[] INDENT = " [bwc] ".getBytes(StandardCharsets.UTF_8)
211+
private final OutputStream delegate
212+
213+
public IndentingOutputStream(OutputStream delegate) {
214+
this.delegate = delegate
215+
}
216+
217+
@Override
218+
public void write(int b) {
219+
write([b] as int[], 0, 1)
220+
}
221+
222+
public void write(int[] bytes, int offset, int length) {
223+
for (int i = 0; i < bytes.length; i++) {
224+
delegate.write(bytes[i])
225+
if (bytes[i] == '\n') {
226+
delegate.write(INDENT)
227+
}
228+
}
229+
}
230+
}

docs/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ integTestCluster {
3939
setting 'reindex.remote.whitelist', '127.0.0.1:*'
4040
}
4141

42+
// remove when https://github.com/elastic/elasticsearch/issues/31305 is fixed
43+
if (rootProject.ext.compilerJavaVersion.isJava11()) {
44+
integTestRunner {
45+
systemProperty 'tests.rest.blacklist', [
46+
'plugins/ingest-attachment/line_164',
47+
'plugins/ingest-attachment/line_117'
48+
].join(',')
49+
}
50+
}
4251
// Build the cluster with all plugins
4352

4453
project.rootProject.subprojects.findAll { it.parent.path == ':plugins' }.each { subproj ->

modules/lang-painless/src/test/java/org/elasticsearch/painless/ArrayTests.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.elasticsearch.painless;
2121

2222
import org.apache.lucene.util.Constants;
23+
import org.elasticsearch.bootstrap.JavaVersion;
2324
import org.hamcrest.Matcher;
2425

2526
import java.lang.invoke.MethodHandle;
@@ -41,7 +42,11 @@ protected String valueCtorCall(String valueType, int size) {
4142

4243
@Override
4344
protected Matcher<String> outOfBoundsExceptionMessageMatcher(int index, int size) {
44-
return equalTo(Integer.toString(index));
45+
if (JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0) {
46+
return equalTo(Integer.toString(index));
47+
} else{
48+
return equalTo("Index " + Integer.toString(index) + " out of bounds for length " + Integer.toString(size));
49+
}
4550
}
4651

4752
public void testArrayLengthHelper() throws Throwable {

plugins/ingest-attachment/build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@ esplugin {
2525
versions << [
2626
'tika': '1.18',
2727
'pdfbox': '2.0.9',
28-
'bouncycastle': '1.55',
28+
'bouncycastle': '1.59',
2929
'poi': '3.17',
3030
'mime4j': '0.8.1'
3131
]
3232

33+
if (rootProject.ext.compilerJavaVersion.isJava11()) {
34+
// disabled until https://github.com/elastic/elasticsearch/issues/31456 is fixed.
35+
integTestRunner {
36+
systemProperty 'tests.rest.blacklist', [
37+
'ingest_attachment/20_attachment_processor/Test indexed chars are configurable',
38+
'ingest_attachment/20_attachment_processor/Test indexed chars are configurable per document'
39+
].join(',')
40+
}
41+
}
42+
3343
dependencies {
3444
// mandatory for tika
3545
compile "org.apache.tika:tika-core:${versions.tika}"

plugins/ingest-attachment/licenses/bcmail-jdk15on-1.55.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
db389ade95f48592908a84e7050a691c8834723c

plugins/ingest-attachment/licenses/bcpkix-jdk15on-1.55.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)