Skip to content

Commit

Permalink
Set distribution checker target JDK compatibility to 11.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Mar 8, 2022
1 parent 19b0967 commit 31b7fae
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 20 deletions.
11 changes: 8 additions & 3 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,20 @@ Fork [opensearch-project/OpenSearch](https://github.com/opensearch-project/OpenS

#### JDK 11

OpenSearch builds using Java 11 at a minimum, using the Adoptium distribution. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`. This is configured in [buildSrc/build.gradle](buildSrc/build.gradle).
OpenSearch builds using Java 11 at a minimum, using the Adoptium distribution. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`. This is configured in [buildSrc/build.gradle](buildSrc/build.gradle) and [distribution/tools/java-version-checker/build.gradle](distribution/tools/java-version-checker/build.gradle).

```
allprojects {
targetCompatibility = 11
sourceCompatibility = 11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
}
```

```
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
```

Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).

#### JDK 14
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ if (project != rootProject) {
apply plugin: 'opensearch.publish'

allprojects {
targetCompatibility = 11
sourceCompatibility = 11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
}

// groovydoc succeeds, but has some weird internal exception...
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/resources/minimumRuntimeVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8
11
4 changes: 2 additions & 2 deletions client/rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
apply plugin: 'opensearch.build'
apply plugin: 'opensearch.publish'

targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11

group = 'org.opensearch.client'
archivesBaseName = 'opensearch-rest-client'
Expand Down
4 changes: 2 additions & 2 deletions client/sniffer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
apply plugin: 'opensearch.build'
apply plugin: 'opensearch.publish'

targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11

group = 'org.opensearch.client'
archivesBaseName = 'opensearch-rest-client-sniffer'
Expand Down
4 changes: 2 additions & 2 deletions client/test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
*/
apply plugin: 'opensearch.build'

targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11

group = "${group}.client.test"

Expand Down
5 changes: 3 additions & 2 deletions distribution/tools/java-version-checker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

apply plugin: 'opensearch.build'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

// targetting very old java versions enables a warning by default on newer JDK: disable it.
compileJava.options.compilerArgs += '-Xlint:-options'

Expand Down
6 changes: 3 additions & 3 deletions libs/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ if (!isEclipse) {
}

compileJava11Java {
sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

forbiddenApisJava11 {
if (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_11) {
targetCompatibility = JavaVersion.VERSION_11.getMajorVersion()
targetCompatibility = JavaVersion.VERSION_11
}
replaceSignatureFiles 'jdk-signatures'
}
Expand Down
6 changes: 3 additions & 3 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ if (!isEclipse) {
}

compileJava11Java {
sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.named('forbiddenApisJava11').configure {
doFirst {
if (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_11) {
targetCompatibility = JavaVersion.VERSION_11.getMajorVersion()
targetCompatibility = JavaVersion.VERSION_11
}
}
}
Expand Down

0 comments on commit 31b7fae

Please sign in to comment.