Skip to content

Commit

Permalink
Upgrade min JDK compatibility to JDK 21 (#2422)
Browse files Browse the repository at this point in the history
Signed-off-by: Kunal Kotwani <[email protected]>
  • Loading branch information
kotwanikunal authored Jan 23, 2025
1 parent f11bd9f commit 1c4a7ca
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Bug Fixes
### Infrastructure
* Removed JDK 11 and 17 version from CI runs [#1921](https://github.com/opensearch-project/k-NN/pull/1921)
* Upgrade min JDK compatibility to JDK 21 [#2422](https://github.com/opensearch-project/k-NN/pull/2422)
### Documentation
### Maintenance
### Refactoring
Expand Down
21 changes: 9 additions & 12 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- [Getting Started](#getting-started)
- [Fork OpenSearch k-NN Repo](#fork-opensearch-k-nn-repo)
- [Install Prerequisites](#install-prerequisites)
- [JDK 11](#jdk-11)
- [JDK 21](#jdk-21)
- [CMake](#cmake)
- [Faiss Dependencies](#Faiss-Dependencies)
- [Environment](#Environment)
Expand Down Expand Up @@ -39,23 +39,20 @@ git clone https://github.com/[your username]/OpenSearch.git

### Install Prerequisites

#### JDK 11
#### JDK 21

OpenSearch builds using Java 11 at a minimum. 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`.
OpenSearch builds using Java 21 at a minimum. This means you must have a JDK 21 installed with the environment variable
`JAVA_HOME` referencing the path to Java home for your JDK 21 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-21`.

One easy way to get Java 11 on *nix is to use [sdkman](https://sdkman.io/).
One easy way to get Java 21 on *nix is to use [sdkman](https://sdkman.io/).

```bash
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh
sdk install java 11.0.2-open
sdk use java 11.0.2-open
sdk install java 21.0.2-open
sdk use java 21.0.2-open
```

Team has to replace minimum JDK version 14 as it was not an LTS release. JDK 14 should still work for most scenarios.
In addition to this, the plugin has been tested with JDK 17, and this JDK version is fully supported.

#### CMake

The plugin requires that cmake >= 3.24.0 is installed in order to build the JNI libraries.
Expand Down Expand Up @@ -201,10 +198,10 @@ Please follow these formatting guidelines:
OpenSearch k-NN uses a [Gradle](https://docs.gradle.org/6.6.1/userguide/userguide.html) wrapper for its build.
Run `gradlew` on Unix systems.
Tests use `JAVA11_HOME` environment variable, make sure to add it in the export path else the tests might fail.
Tests use `JAVA21_HOME` environment variable, make sure to add it in the export path else the tests might fail.
e.g
```
echo "export JAVA11_HOME=<JDK11 path>" >> ~/.zshrc
echo "export JAVA21_HOME=<JDK21 path>" >> ~/.zshrc
source ~/.zshrc
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ allprojects {
}
apply from: rootProject.file('build-tools/repositories.gradle').absoluteFile
plugins.withId('java') {
sourceCompatibility = targetCompatibility = "11"
sourceCompatibility = targetCompatibility = "21"
}

afterEvaluate {
Expand Down
7 changes: 7 additions & 0 deletions qa/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
file_ext = "zip"
}

allprojects {
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
}

// Task to pull k-NN plugin from archive
task pullBwcPlugin {
doFirst {
Expand Down

0 comments on commit 1c4a7ca

Please sign in to comment.