Skip to content

Commit

Permalink
Compile with Java 21 (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski authored Nov 3, 2023
1 parent 09718c4 commit fc166f1
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- uses: gradle/wrapper-validation-action@v1

Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- name: Run ${{ matrix.task }}
uses: gradle/gradle-build-action@v2
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- name: Run ${{ matrix.task }}
uses: gradle/gradle-build-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- name: Cache
uses: gradle/gradle-build-action@v2
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- name: Cache
uses: gradle/gradle-build-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- uses: gradle/gradle-build-action@v2

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- name: Build app with Gradle
uses: gradle/gradle-build-action@v2
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- uses: gradle/gradle-build-action@v2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_diffuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
java-version: 21

- uses: actions/cache@v3
name: Download base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class AndroidLibraryPlugin : Plugin<Project> {

extensions.getByType<LibraryExtension>().apply {
configureAndroidPlugin(rootConfig)
defaultConfig.targetSdk = rootConfig.android.targetSdkVersion ?: rootConfig.android.compileSdkVersion

buildFeatures.buildConfig = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ internal class AndroidApplicationPluginTest : WithGradleProjectTest() {
rootDirectory.apply {
resolve("settings.gradle").writeText("""include ":module1", ":module2" """)

rootBuildScript = resolve("build.gradle")
rootBuildScript = resolve("build.gradle") {
writeText(
"""
plugins {
id('com.starter.config')
}
commonConfig {
javaVersion = JavaVersion.VERSION_1_8 // workaround for http://issuetracker.google.com/issues/294137077
}
""".trimIndent(),
)
}
module1Root = resolve("module1") {
val buildScript =
// language=groovy
Expand All @@ -45,7 +57,7 @@ internal class AndroidApplicationPluginTest : WithGradleProjectTest() {
}
dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
}
""".trimIndent()
Expand Down Expand Up @@ -83,7 +95,7 @@ internal class AndroidApplicationPluginTest : WithGradleProjectTest() {
}
dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
}
""".trimIndent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ internal class AndroidLibraryPluginTest : WithGradleProjectTest() {
mkdirs()
resolve("settings.gradle").writeText("""include ":module1", ":module2" """)

rootBuildScript = resolve("build.gradle")
rootBuildScript = resolve("build.gradle") {
writeText(
"""
plugins {
id('com.starter.config')
}
commonConfig {
javaVersion = JavaVersion.VERSION_1_8 // workaround for http://issuetracker.google.com/issues/294137077
}
""".trimIndent(),
)
}
module1Root = resolve("module1") {
val buildScript =
// language=groovy
Expand All @@ -46,7 +58,7 @@ internal class AndroidLibraryPluginTest : WithGradleProjectTest() {
}
dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
}
""".trimIndent()
Expand Down Expand Up @@ -88,7 +100,7 @@ internal class AndroidLibraryPluginTest : WithGradleProjectTest() {
}
dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
}
""".trimIndent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ internal class ConfigurationCacheTest : WithGradleProjectTest() {
rootDirectory.apply {
resolve("settings.gradle").writeText("""include ':module1', ':module2' """)

resolve("build.gradle").writeText("")
resolve("build.gradle") {
writeText(
"""
plugins {
id('com.starter.config')
}
commonConfig {
javaVersion = JavaVersion.VERSION_1_8 // workaround for http://issuetracker.google.com/issues/294137077
}
""".trimIndent(),
)
}
androidModuleRoot = resolve("module1") {
// language=groovy
val script =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal class AndroidQualityPluginTest : WithGradleProjectTest() {
}
kotlin {
jvmToolchain(20)
jvmToolchain(21)
}
tasks.withType(JavaCompile).configureEach {
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ allprojects {
}
}
kotlin {
jvmToolchain(20)
jvmToolchain(21)
}
}
tasks.withType(Test).configureEach {
Expand All @@ -35,8 +35,9 @@ allprojects {

pluginManager.withPlugin("java") {
if (project.hasProperty("skipJarVersion")) {
def projectName = project.name
tasks.named("jar") {
archiveFile.set(new File(project.buildDir, "libs/${project.name}.jar"))
archiveFile.set(layout.buildDirectory.map {it.file("libs/${projectName}.jar")})
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
}

kotlin {
jvmToolchain(20)
jvmToolchain(21)
}

def targetJavaVersion = JavaVersion.VERSION_11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal class KotlinLibraryPluginTest : WithGradleProjectTest() {
}
dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
}
""".trimIndent(),
Expand All @@ -57,7 +57,7 @@ internal class KotlinLibraryPluginTest : WithGradleProjectTest() {
}
dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
}
""".trimIndent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class QualityPlugin : Plugin<Project> {
source += sourceSet.allSource
}
}
report.set(buildDir.resolve("reports/issue_comments.txt"))
report.set(layout.buildDirectory.map { it.file("reports/issue_comments.txt") })
githubToken.set(provider<String?> { properties["GITHUB_TOKEN"]?.toString() })
}
onAndroid {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal class QualityPluginTest : WithGradleProjectTest() {
}
kotlin {
jvmToolchain(20)
jvmToolchain(21)
}
def targetJavaVersion = JavaVersion.VERSION_11
Expand Down

0 comments on commit fc166f1

Please sign in to comment.