Skip to content

Commit

Permalink
Update to java 17, with java 21 compatible build (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
aprudhomme authored Mar 20, 2024
1 parent d1153bb commit 0ee3c26
Show file tree
Hide file tree
Showing 55 changed files with 490 additions and 458 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['17']
java: ['17', '21']
name: Java ${{ matrix.Java }} build
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ In the home directory.
./gradlew clean installDist test
```

Note: This code has been tested on *Java14*
Note: This code has been tested on *Java17*


# Run gRPC Server
Expand Down
38 changes: 21 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {
id 'idea'
id 'maven-publish'
id 'signing'
id "com.diffplug.gradle.spotless" version "4.3.0"
id "com.diffplug.spotless" version "6.22.0"
id 'java-library'
id 'jacoco'
// Build docs locally by running "site" command
id 'kr.motd.sphinx' version '2.10.0'
id 'kr.motd.sphinx' version '2.10.1'
}

repositories {
Expand All @@ -20,8 +20,10 @@ repositories {
mavenCentral()
}

sourceCompatibility = 1.14
targetCompatibility = 1.14
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

allprojects {
version = '0.30.0'
Expand All @@ -48,7 +50,7 @@ def spatial4jVersion = '0.7'
def s3mockVersion = '0.2.6'
def commonsCompressVersion = '1.21'
def awsJavaSdkVersion = '1.12.457'
def guicedeeVersion = '1.1.1.3-jre14'
def guicedeeVersion = '1.2.2.1-jre17'
def prometheusClientVersion = '0.8.0'
def fastutilVersion = '8.5.6'

Expand Down Expand Up @@ -121,32 +123,32 @@ dependencies {
startScripts.enabled = false

task luceneServer(type: CreateStartScripts) {
mainClassName = 'com.yelp.nrtsearch.server.grpc.LuceneServer'
mainClass = 'com.yelp.nrtsearch.server.grpc.LuceneServer'
applicationName = 'lucene-server'
outputDir = new File(project.buildDir, 'tmp')
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
// Add additional dependencies, e.g. custom loggers
classpath += files('$APP_HOME/additional_libs')
}

task luceneServerClient(type: CreateStartScripts) {
mainClassName = 'com.yelp.nrtsearch.server.cli.LuceneClientCommand'
mainClass = 'com.yelp.nrtsearch.server.cli.LuceneClientCommand'
applicationName = 'lucene-client'
outputDir = new File(project.buildDir, 'tmp')
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
}

task backupRestoreTool(type: CreateStartScripts) {
mainClassName = 'com.yelp.nrtsearch.server.cli.BackupRestoreCommand'
mainClass = 'com.yelp.nrtsearch.server.cli.BackupRestoreCommand'
applicationName = 'backup-restore'
outputDir = new File(project.buildDir, 'tmp')
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
}

task nrtUtils(type: CreateStartScripts) {
mainClassName = 'com.yelp.nrtsearch.tools.nrt_utils.NrtUtilsCommand'
mainClass = 'com.yelp.nrtsearch.tools.nrt_utils.NrtUtilsCommand'
applicationName = 'nrt_utils'
outputDir = new File(project.buildDir, 'tmp')
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
}

Expand All @@ -169,6 +171,8 @@ task buildGrpcGateway(dependsOn: installDist, type: Exec) {
//e.g. default is to exclude perfTests: ./gradlew test
test {
finalizedBy 'spotlessJavaCheck'
// Used by LuceneServerConfigurationTest
environment(Map.of('CUSTOM_HOST', 'my_custom_host', 'VAR1', 'v1', 'VAR2', 'v2', 'VAR3', 'v3'))
if (project.hasProperty('longRunningTestsOnly')) {
include '**/IncrementalDataCleanupCommandTest.class'
} else {
Expand All @@ -193,7 +197,7 @@ test {

jacocoTestReport {
reports {
csv.enabled true
csv.required = true
}
}

Expand All @@ -202,17 +206,17 @@ task javadocs(type: Javadoc) {
}

task javadocsJar(type: Jar) {
classifier('javadoc')
archiveClassifier = 'javadoc'
from javadocs.destinationDir
}

task sourcesJar(type: Jar) {
classifier('sources')
archiveClassifier = 'sources'
from sourceSets.main.java.srcDirs
}

task testsJar(type: Jar) {
classifier('tests')
archiveClassifier = 'tests'
from sourceSets.test.output
}

Expand Down
16 changes: 10 additions & 6 deletions clientlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ plugins {
// Provide convenience executables for trying out the examples.
id 'application'
// ASSUMES GRADLE 2.12 OR HIGHER. Use plugin version 0.7.5 with earlier gradle versions
id 'com.google.protobuf' version '0.8.12'
id 'com.google.protobuf' version '0.9.4'
// Generate IntelliJ IDEA's .idea & .iml project files
id 'idea'
// Publish clientlib to maven central
id 'maven-publish'
id 'signing'
id "com.diffplug.gradle.spotless"
id "com.diffplug.spotless"
id 'java-library'
}

Expand All @@ -20,8 +20,10 @@ repositories {
mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
startScripts.enabled = false

// groupId, artifactId and version for the generated pom
Expand All @@ -39,6 +41,7 @@ dependencies {
implementation "javax.annotation:javax.annotation-api:1.2"
implementation "org.slf4j:slf4j-api:${rootProject.slf4jVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${rootProject.jacksonYamlVersion}"
implementation "com.google.protobuf:protobuf-java:${protobufVersion}"

// for lz4 message compression
implementation "org.lz4:lz4-java:${rootProject.lz4Version}"
Expand Down Expand Up @@ -87,12 +90,12 @@ task javadocs(type: Javadoc) {
}

task javadocsJar(type: Jar) {
classifier('javadoc')
archiveClassifier = 'javadoc'
from javadocs.destinationDir
}

task sourcesJar(type: Jar) {
classifier('sources')
archiveClassifier = 'sources'
from sourceSets.main.java.srcDirs
}

Expand Down Expand Up @@ -182,6 +185,7 @@ publishing {

spotless {
java {
targetExclude "build/**/*.java"
licenseHeaderFile '../license_header'
removeUnusedImports()
endWithNewline()
Expand Down
8 changes: 5 additions & 3 deletions example-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.diffplug.gradle.spotless' version '4.3.0'
id 'com.diffplug.spotless' version '6.22.0'
id 'distribution'
// Generate IntelliJ IDEA's .idea & .iml project files
id 'idea'
Expand All @@ -14,8 +14,10 @@ repositories {
mavenCentral()
}

sourceCompatibility = 1.17
targetCompatibility = 1.17
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

group 'com.yelp.nrtsearch.plugins'
version '0.0.1'
Expand Down
Binary file modified example-plugin/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion example-plugin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0ee3c26

Please sign in to comment.