Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on latest Java, test through lowest possible #254

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/gradle-latest-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: 19
distribution: 'zulu'
- uses: gradle/gradle-build-action@v2

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/java-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
openjdk:
strategy:
matrix:
jdk: [11, 17]
jdk: [8, 11, 17]
name: "OpenJDK ${{ matrix.jdk }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk }}
java-version: 19
distribution: 'zulu'
- uses: gradle/gradle-build-action@v2
# Workaround https://github.com/ajoberstar/gradle-stutter/issues/22
Expand All @@ -32,8 +32,8 @@ jobs:
# java11=6.0.1,6.9.4,7.0.2,7.6.1,8.0.2,8.1.1,8.2-rc-1
# ->
# java11=8.2-rc-1
# The trick is that \2 will greedily eat everything before the last comma.
sed -r 's/^(.*?)=(.*),(.*)$/\1=\3/g' -i stutter.lockfile
# The trick is that \3 will greedily eat everything before the last comma.
sed -r 's/^(.*?)=(.*?),(.*),(.*?)$/\1=\2,\4/g' -i stutter.lockfile
cat stutter.lockfile
- name: Test cross Java versions compatibility
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: 19
distribution: 'zulu'
- uses: gradle/gradle-build-action@v2
with:
Expand Down
9 changes: 6 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ dependencies {
testImplementation("com.github.tomakehurst:wiremock:2.27.2")
testImplementation("ru.lanwen.wiremock:wiremock-junit5:1.3.1")
testImplementation("org.assertj:assertj-core:3.24.2")
// This cannot be updated to 5.x as it requires Java 11,
// but we are running CI on Java 8 in .github/workflows/java-versions.yml.
testImplementation("org.mockito:mockito-junit-jupiter:4.11.0")
testImplementation("org.mockito:mockito-junit-jupiter:5.4.0")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
}

Expand Down Expand Up @@ -260,6 +258,11 @@ tasks {
withType<Test>().matching { it.name.startsWith("compatTest") }.configureEach {
systemProperty("plugin.version", project.version)
}
named<Test>("test").configure {
javaLauncher = project.javaToolchains.launcherFor {
TWiStErRob marked this conversation as resolved.
Show resolved Hide resolved
languageVersion = JavaLanguageVersion.of(11)
}
}
}

publishing {
Expand Down
14 changes: 7 additions & 7 deletions buildSrc/src/main/kotlin/IdeaExtExtensions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,13 +24,13 @@ import java.io.File
import kotlin.math.min

fun IdeaProject.settings(configuration: ProjectSettings.() -> kotlin.Unit) =
(this as ExtensionAware).configure(configuration)
(this as ExtensionAware).configure(configuration)

fun ProjectSettings.copyright(configuration: CopyrightConfiguration.() -> kotlin.Unit) =
(this as ExtensionAware).configure(configuration)
(this as ExtensionAware).configure(configuration)

fun Project.readCopyrightHeader(licenseHeaderFile: File) =
licenseHeaderFile.readLines()
.map { line -> line.substring(min(line.length, 3)) }
.joinToString("\n")
.trim()
licenseHeaderFile.readLines()
.map { line -> line.substring(min(line.length, 3)) }
.joinToString("\n")
.trim()