Skip to content

Commit

Permalink
Handle JDK 8 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
rpalcolea committed Aug 8, 2024
1 parent 5ecd4f5 commit e1497ba
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 39 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/nebula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
# test against latest update of some major Java version(s), as well as specific LTS version(s)
java: [ 8, 17, 21]
java: [8, 17, 21]
name: Gradle Build without Publish
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -74,10 +74,18 @@ jobs:
run: |
git config --global user.name "Nebula Plugin Maintainers"
git config --global user.email "nebula-plugins-oss@netflix.com"
- name: Setup jdk 8
uses: actions/setup-java@v1
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 1.8
distribution: 'zulu'
java-version: '8'
java-package: jdk
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '21'
java-package: jdk
- uses: actions/cache@v1
id: gradle-cache
with:
Expand Down Expand Up @@ -115,10 +123,18 @@ jobs:
run: |
git config --global user.name "Nebula Plugin Maintainers"
git config --global user.email "nebula-plugins-oss@netflix.com"
- name: Setup jdk 8
uses: actions/setup-java@v1
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 1.8
distribution: 'zulu'
java-version: '8'
java-package: jdk
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '21'
java-package: jdk
- uses: actions/cache@v1
id: gradle-cache
with:
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies {
implementation 'com.gradle.publish:plugin-publish-plugin:1.2.1'

testImplementation 'com.netflix.nebula:nebula-test:latest.release'
testImplementation("org.ajoberstar.grgit:grgit-core:3.1.1") {
testImplementation("org.ajoberstar.grgit:grgit-core:4.1.1") {
exclude group: "org.codehaus.groovy", module: "groovy"
}
}
Expand All @@ -70,3 +70,7 @@ tasks.withType(GenerateModuleMetadata).configureEach {
// error message you got
suppressedValidationErrors.add('enforced-platform')
}

tasks.withType(Test).configureEach {
systemProperty('ignoreDeprecations', true)
}
36 changes: 9 additions & 27 deletions gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,35 @@
cglib:cglib-nodep:3.2.2=integTestRuntimeClasspath,testRuntimeClasspath
com.fasterxml.jackson:jackson-bom:2.14.3=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.github.zafarkhaja:java-semver:0.9.0=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.googlecode.javaewah:JavaEWAH:1.1.6=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
com.googlecode.javaewah:JavaEWAH:1.1.12=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
com.gradle.publish:plugin-publish-plugin:1.2.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.jcraft:jsch.agentproxy.connector-factory:0.0.7=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.jcraft:jsch.agentproxy.core:0.0.7=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.jcraft:jsch.agentproxy.pageant:0.0.7=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.jcraft:jsch.agentproxy.sshagent:0.0.7=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.jcraft:jsch.agentproxy.svnkit-trilead-ssh2:0.0.7=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.jcraft:jsch.agentproxy.usocket-jna:0.0.7=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.jcraft:jsch.agentproxy.usocket-nc:0.0.7=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.jcraft:jsch:0.1.54=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
com.jcraft:jzlib:1.1.1=integTestCompileClasspath,testCompileClasspath
com.jcraft:jzlib:1.1.2=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.netflix.nebula:gradle-contacts-plugin:7.0.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:gradle-dependency-lock-plugin:15.0.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:gradle-info-plugin:12.1.6=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:gradle-dependency-lock-plugin:15.1.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:gradle-info-plugin:13.1.2=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:gradle-java-cross-compile-plugin:8.0.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-dependencies-comparison:0.2.1=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-gradle-interop:2.1.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-oss-publishing-plugin:3.3.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-project-plugin:10.1.5=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-project-plugin:11.0.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-publishing-plugin:21.0.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-release-plugin:19.0.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-test:10.5.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-release-plugin:19.0.10=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-test:10.6.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
com.perforce:p4java:2015.2.1365273=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.squareup.moshi:moshi:1.12.0=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.squareup.okio:okio:2.10.0=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.trilead:trilead-ssh2:1.0.0-build220=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
de.regnis.q.sequence:sequence-library:1.0.3=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
io.github.gradle-nexus:publish-plugin:1.0.0=compileClasspath,integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
joda-time:joda-time:2.10=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
junit:junit:4.13.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
net.java.dev.jna:jna-platform:5.7.0=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
net.java.dev.jna:jna:5.7.0=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
net.java.dev.jna:platform:3.4.0=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
org.ajoberstar.grgit:grgit-core:3.1.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.antlr:antlr-runtime:3.4=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
org.ajoberstar.grgit:grgit-core:4.1.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.commons:commons-lang3:3.12.0=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
org.apache.maven:maven-model:3.6.3=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
org.apiguardian:apiguardian-api:1.1.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.bouncycastle:bcpg-jdk15on:1.60=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.bouncycastle:bcpkix-jdk15on:1.60=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.bouncycastle:bcprov-jdk15on:1.60=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy:3.0.12=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.codehaus.plexus:plexus-utils:3.2.1=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hamcrest:hamcrest-core:1.3=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hamcrest:hamcrest:2.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.jetbrains.kotlin:kotlin-stdlib-common:1.9.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
Expand All @@ -60,9 +44,7 @@ org.junit.platform:junit-platform-commons:1.9.0=integTestCompileClasspath,integT
org.junit.platform:junit-platform-engine:1.9.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.objenesis:objenesis:2.4=integTestRuntimeClasspath,testRuntimeClasspath
org.opentest4j:opentest4j:1.2.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.slf4j:slf4j-api:1.7.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.slf4j:slf4j-api:1.7.30=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.spockframework:spock-core:2.3-groovy-3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.spockframework:spock-junit4:2.3-groovy-3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.tmatesoft.sqljet:sqljet:1.1.10=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
org.tmatesoft.svnkit:svnkit:1.8.12=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
empty=annotationProcessor,integTestAnnotationProcessor,testAnnotationProcessor
1 change: 1 addition & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
toolchainVersion=21
11 changes: 7 additions & 4 deletions src/main/groovy/nebula/plugin/plugin/NebulaPluginPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class NebulaPluginPlugin implements Plugin<Project> {
}

if (GradleVersion.current().baseVersion >= GradleVersion.version("7.0")) {
tasks.withType(Test) {
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
}
Expand All @@ -125,16 +125,19 @@ class NebulaPluginPlugin implements Plugin<Project> {
}

Provider<String> jdkVersionForTestsEnvVariable = providers.environmentVariable("JDK_VERSION_FOR_TESTS")
Integer jdkVersionForTests = jdkVersionForTestsEnvVariable.isPresent() ? jdkVersionForTestsEnvVariable.get().toInteger() : 8
Integer jdkVersionForTests = jdkVersionForTestsEnvVariable.isPresent() ? jdkVersionForTestsEnvVariable.get().toInteger() : 21
JavaToolchainService javaToolchainService = project.extensions.getByType(JavaToolchainService)
tasks.withType(Test) { task ->
tasks.withType(Test).configureEach { task ->
minHeapSize = '32m'
maxHeapSize = '256m'
/*
Allows to override the JDK used to execute the test process
*/
javaLauncher = javaToolchainService.launcherFor {
javaLauncher.set(javaToolchainService.launcherFor {
it.languageVersion.set(JavaLanguageVersion.of(jdkVersionForTests))
})
if(jdkVersionForTests < 17) {
systemProperty('ignoreDeprecations', true)
}
doFirst {
logger.lifecycle("Executing tests with JDK: ${jdkVersionForTests}")
Expand Down

0 comments on commit e1497ba

Please sign in to comment.