Skip to content

Commit 6b9d4ec

Browse files
authored
Explicitly specify the JVM version (#98)
By default, setup-gradle action uses Java 17. But we need to compile our plugins with Java 11 for now. Also, this PR adds parameters to always compile the classes for Java 11 (no matter which Jvm is used - 11 or above)
1 parent a683b0c commit 6b9d4ec

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

Diff for: .github/workflows/build-and-test.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ jobs:
1111
steps:
1212
- name: Checkout project sources
1313
uses: actions/checkout@v4
14-
- name: Validate Gradle Wrapper
15-
uses: gradle/actions/wrapper-validation@v4
14+
- name: Setup Java
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: 'temurin'
18+
java-version: 11
1619
- name: Setup Gradle
1720
uses: gradle/actions/setup-gradle@v4
1821
with:
1922
gradle-version: wrapper
23+
validate-wrappers: 'true'
2024
- name: Run build with Gradle
2125
run: ./gradlew clean build --info

Diff for: .github/workflows/publish-gradle-plugin.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ jobs:
3838
steps:
3939
- name: Checkout project sources
4040
uses: actions/checkout@v4
41-
- name: Validate Gradle Wrapper
42-
uses: gradle/actions/wrapper-validation@v4
41+
- name: Setup Java
42+
uses: actions/setup-java@v4
43+
with:
44+
distribution: 'temurin'
45+
java-version: 11
4346
- name: Setup Gradle
4447
uses: gradle/actions/setup-gradle@v4
4548
with:
4649
gradle-version: wrapper
50+
validate-wrappers: 'true'
4751
- name: Publish plugins to Gradle portal
4852
run: >
4953
./gradlew clean build publishPlugins --info
@@ -55,12 +59,16 @@ jobs:
5559
steps:
5660
- name: Checkout project sources
5761
uses: actions/checkout@v4
58-
- name: Validate Gradle Wrapper
59-
uses: gradle/actions/wrapper-validation@v4
62+
- name: Setup Java
63+
uses: actions/setup-java@v4
64+
with:
65+
distribution: 'temurin'
66+
java-version: 11
6067
- name: Setup Gradle
6168
uses: gradle/actions/setup-gradle@v4
6269
with:
6370
gradle-version: wrapper
71+
validate-wrappers: 'true'
6472
- name: Publish plugins to Gradle portal
6573
run: >
6674
./gradlew clean build publishToSonatype closeAndReleaseStagingRepositories --info

Diff for: .github/workflows/verify-publish-configuration.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ jobs:
1313
steps:
1414
- name: Checkout project sources
1515
uses: actions/checkout@v4
16-
- name: Validate Gradle Wrapper
17-
uses: gradle/actions/wrapper-validation@v4
16+
- name: Setup Java
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: 'temurin'
20+
java-version: 11
1821
- name: Setup Gradle
1922
uses: gradle/actions/setup-gradle@v4
2023
with:
2124
gradle-version: wrapper
25+
validate-wrappers: 'true'
2226
- name: Validate Gradle portal publication configuration
2327
run: >
2428
./gradlew clean publishPlugins --info --validate-only

Diff for: plugin/build.gradle.kts

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
23
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
34

@@ -13,6 +14,18 @@ plugins {
1314
alias(libs.plugins.gradle.functional.test)
1415
}
1516

17+
java {
18+
targetCompatibility = JavaVersion.VERSION_11
19+
sourceCompatibility = JavaVersion.VERSION_11
20+
}
21+
22+
kotlin {
23+
compilerOptions {
24+
jvmTarget = JvmTarget.JVM_11
25+
freeCompilerArgs.add("-Xjdk-release=11")
26+
}
27+
}
28+
1629
repositories {
1730
mavenCentral()
1831
gradlePluginPortal()

0 commit comments

Comments
 (0)