diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b081b934..e9f222ae 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -30,25 +30,15 @@ jobs: id: ci-env uses: FranzDiebold/github-env-vars-action@v2 - - name: Set up Java - uses: actions/setup-java@v2 + - name: Set up java + uses: actions/setup-java@v2.5.0 with: - distribution: 'temurin' java-version: ${{ matrix.java }} - - - name: Cache Gradle packages - # speed up the build by caching dependencies, downloaded versions - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- + distribution: temurin + cache: gradle - name: Build with Gradle - run: ./gradlew build + run: gradle clean build -PjavacRelease=${{ matrix.java }} - name: SHA256 if: matrix.upload diff --git a/build.gradle.kts b/build.gradle.kts index 398019ba..e61d5c8b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,8 @@ +// permits to start the build setting the javac release parameter, no parameter means build for java8: +// gradle clean build -PjavacRelease=8 +// gradle clean build -PjavacRelease=17 +val javacRelease = (project.findProperty("javacRelease") ?: "8") as String + plugins { id("fr.brouillard.oss.gradle.jgitver") version "0.9.1" id("jacoco") @@ -38,9 +43,12 @@ jgitver { useGitCommitID = true } -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 +tasks.compileJava { + if (JavaVersion.current().isJava8) { + java.targetCompatibility = JavaVersion.VERSION_1_8 + } else { + options.release.set(Integer.parseInt(javacRelease)) + } } tasks.withType {