Skip to content

Commit

Permalink
Adds java 21 support
Browse files Browse the repository at this point in the history
(cherry picked from commit e78426b)
  • Loading branch information
RetGal committed Jul 31, 2024
1 parent 03325a1 commit 4127b4e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '8'
java-version: '21'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
39 changes: 21 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ sourceSets {
}
}

sourceCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_17
}

project.buildDir = 'target'
project.layout.buildDirectory = 'target'

repositories {
mavenCentral()
Expand All @@ -31,31 +33,32 @@ dependencies {

// mandatory dependencies for using Spock
// note: please use same Groovy version as on Jenkins
implementation "org.codehaus.groovy:groovy-all:2.4.12"
implementation "org.codehaus.groovy:groovy-all:2.4.21"
implementation "com.cloudbees:groovy-cps:1.31@jar", withoutIcu
implementation "org.jenkins-ci.main:jenkins-core:2.225", withoutIcu
implementation "org.jenkins-ci.plugins:badge:1.8@jar"
implementation "org.jenkins-ci.main:jenkins-core:2.452", withoutIcu
implementation "org.jenkins-ci.plugins:badge:1.13@jar"
implementation "org.jenkins-ci.plugins:pipeline-maven:3.9.3@jar" // dependency for MavenReport
implementation "org.jenkins-ci.plugins:credentials-binding:1.27.1@jar"

implementation "org.slf4j:jcl-over-slf4j:1.7.25"
testImplementation "org.slf4j:log4j-over-slf4j:1.7.25"
testImplementation "org.slf4j:slf4j-api:1.7.25"
implementation "org.slf4j:jcl-over-slf4j:2.0.13"
testImplementation "org.slf4j:log4j-over-slf4j:2.0.13"
testImplementation "org.slf4j:slf4j-api:2.0.12"

testImplementation "ch.qos.logback:logback-core:1.2.3"
testImplementation "ch.qos.logback:logback-classic:1.2.3"
testImplementation "com.google.guava:guava:20.0"
testImplementation "ch.qos.logback:logback-core:1.5.6"
testImplementation "ch.qos.logback:logback-classic:1.5.6"
testImplementation "com.google.guava:guava:33.2.1-jre"

testImplementation "org.spockframework:spock-core:1.3-groovy-2.4@jar"
testImplementation "org.codehaus.groovy:groovy-all:3.0.21"
testImplementation "org.spockframework:spock-core:2.3-groovy-3.0@jar"

// Jenkins Pipeline Unit + JUnit 4
testImplementation "com.lesfurets:jenkins-pipeline-unit:1.13"
testImplementation "org.assertj:assertj-core:3.22.0"
testImplementation "org.assertj:assertj-core:3.26.0"

// Jenkins related
testImplementation "com.homeaway.devtools.jenkins:jenkins-spock:2.1.4"
testImplementation "javax.servlet:javax.servlet-api:3.1.0"
testImplementation "org.jenkins-ci.main:jenkins-core:2.225", withoutIcu
testImplementation "com.homeaway.devtools.jenkins:jenkins-spock:2.1.5"
testImplementation "javax.servlet:javax.servlet-api:4.0.1"
testImplementation "org.jenkins-ci.main:jenkins-core:2.452", withoutIcu
testImplementation "org.jenkins-ci.plugins.workflow:workflow-api:2.40@jar"
testImplementation "org.jenkins-ci.plugins.workflow:workflow-step-api:2.22@jar"
testImplementation "org.jenkins-ci.plugins.workflow:workflow-cps:2.78@jar"
Expand All @@ -72,9 +75,9 @@ dependencies {

// this is needed for spock to find all the source code in the var directory
task copyGlobalLibVars (type: Copy) {
from "$rootDir/vars"
from layout.projectDirectory.dir("vars")
include '**/*.groovy'
into "$buildDir/classes/vars"
into layout.buildDirectory.dir("classes/vars")
}

compileTestGroovy {
Expand Down
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-6.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions jenkins/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
privileged: true
user: root
ports:
- 8081:8080
- 50000:50000
- "8081:8080"
- "50000:50000"
container_name: jenkins
volumes:
- ~/jenkins:/var/jenkins_home
Expand Down
2 changes: 1 addition & 1 deletion test/groovy/util/Result.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Result {

def Result() {}

def int status() {
int status() {
return status
}
}
4 changes: 2 additions & 2 deletions test/groovy/vars/KustomizeTest.groovy
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package groovy.vars

import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString
import static org.assertj.core.api.Assertions.*;
import static org.assertj.core.api.Assertions.*

import com.lesfurets.jenkins.unit.BasePipelineTest
import org.junit.Before
import org.junit.Test

class KustomizeTest extends BasePipelineTest {

Script kustomize;
Script kustomize

@Before
@Override
Expand Down

0 comments on commit 4127b4e

Please sign in to comment.