Use property to specify test java version instead of adding tasks. (#3365)
* Use property to specify test java version instead of adding tasks. * Typo
This commit is contained in:
parent
fffc831c46
commit
431bb1281a
|
|
@ -14,9 +14,12 @@ jobs:
|
||||||
os:
|
os:
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- ubuntu-18.04
|
- ubuntu-18.04
|
||||||
|
test-java-version:
|
||||||
|
- 8
|
||||||
|
- 11
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-18.04
|
- os: ubuntu-18.04
|
||||||
testAdditionalJavaVersions: true
|
test-java-version: 11
|
||||||
coverage: true
|
coverage: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.4
|
- uses: actions/checkout@v2.3.4
|
||||||
|
|
@ -40,7 +43,7 @@ jobs:
|
||||||
remote-build-cache-proxy-enabled: false
|
remote-build-cache-proxy-enabled: false
|
||||||
arguments: build --stacktrace ${{ matrix.coverage && 'jacocoTestReport' || '' }}
|
arguments: build --stacktrace ${{ matrix.coverage && 'jacocoTestReport' || '' }}
|
||||||
properties: |
|
properties: |
|
||||||
testAdditionalJavaVersions=${{ matrix.testAdditionalJavaVersions }}
|
testJavaVersion=${{ matrix.test-java-version }}
|
||||||
org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-11.outputs.path }}
|
org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-11.outputs.path }}
|
||||||
- uses: codecov/codecov-action@v1.5.2
|
- uses: codecov/codecov-action@v1.5.2
|
||||||
if: ${{ matrix.coverage }}
|
if: ${{ matrix.coverage }}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,12 @@ jobs:
|
||||||
os:
|
os:
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- ubuntu-18.04
|
- ubuntu-18.04
|
||||||
|
test-java-version:
|
||||||
|
- 8
|
||||||
|
- 11
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-18.04
|
- os: ubuntu-18.04
|
||||||
testAdditionalJavaVersions: true
|
test-java-version: 11
|
||||||
coverage: true
|
coverage: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.4
|
- uses: actions/checkout@v2.3.4
|
||||||
|
|
@ -40,7 +43,7 @@ jobs:
|
||||||
remote-build-cache-proxy-enabled: false
|
remote-build-cache-proxy-enabled: false
|
||||||
arguments: build --stacktrace ${{ matrix.coverage && 'jacocoTestReport' || '' }}
|
arguments: build --stacktrace ${{ matrix.coverage && 'jacocoTestReport' || '' }}
|
||||||
properties: |
|
properties: |
|
||||||
testAdditionalJavaVersions=${{ matrix.testAdditionalJavaVersions }}
|
testJavaVersion=${{ matrix.test-java-version }}
|
||||||
org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-11.outputs.path }}
|
org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-11.outputs.path }}
|
||||||
- uses: codecov/codecov-action@v1.5.2
|
- uses: codecov/codecov-action@v1.5.2
|
||||||
if: ${{ matrix.coverage }}
|
if: ${{ matrix.coverage }}
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,6 @@ jobs:
|
||||||
os:
|
os:
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- ubuntu-18.04
|
- ubuntu-18.04
|
||||||
include:
|
|
||||||
- os: ubuntu-18.04
|
|
||||||
testAdditionalJavaVersions: true
|
|
||||||
coverage: true
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.4
|
- uses: actions/checkout@v2.3.4
|
||||||
- id: setup-java-11
|
- id: setup-java-11
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,11 @@ tasks {
|
||||||
options.release.set(11)
|
options.release.set(11)
|
||||||
}
|
}
|
||||||
|
|
||||||
named("testJava8") {
|
val testJavaVersion: String? by project
|
||||||
enabled = false
|
if (testJavaVersion == "8") {
|
||||||
|
test {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,24 +40,9 @@ checkstyle {
|
||||||
configProperties["rootDir"] = rootDir
|
configProperties["rootDir"] = rootDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val testJavaVersion = gradle.startParameter.projectProperties.get("testJavaVersion")?.let(JavaVersion::toVersion)
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
val testJava8 by registering(Test::class) {
|
|
||||||
javaLauncher.set(javaToolchains.launcherFor {
|
|
||||||
languageVersion.set(JavaLanguageVersion.of(8))
|
|
||||||
})
|
|
||||||
|
|
||||||
jacoco {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val testAdditionalJavaVersions: String? by rootProject
|
|
||||||
if (testAdditionalJavaVersions == "true") {
|
|
||||||
named("check") {
|
|
||||||
dependsOn(testJava8)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
withType<JavaCompile>().configureEach {
|
withType<JavaCompile>().configureEach {
|
||||||
with(options) {
|
with(options) {
|
||||||
release.set(8)
|
release.set(8)
|
||||||
|
|
@ -96,6 +81,12 @@ tasks {
|
||||||
withType<Test>().configureEach {
|
withType<Test>().configureEach {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
|
|
||||||
|
if (testJavaVersion != null) {
|
||||||
|
javaLauncher.set(javaToolchains.launcherFor {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(testJavaVersion.majorVersion))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
testLogging {
|
testLogging {
|
||||||
exceptionFormat = TestExceptionFormat.FULL
|
exceptionFormat = TestExceptionFormat.FULL
|
||||||
showExceptions = true
|
showExceptions = true
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,12 @@ tasks {
|
||||||
options.release.set(11)
|
options.release.set(11)
|
||||||
}
|
}
|
||||||
|
|
||||||
named("testJava8") {
|
test {
|
||||||
enabled = false
|
val testJavaVersion: String? by project
|
||||||
}
|
if (testJavaVersion == "8") {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
named("test") {
|
|
||||||
// Disabled due to https://bugs.openjdk.java.net/browse/JDK-8245283
|
// Disabled due to https://bugs.openjdk.java.net/browse/JDK-8245283
|
||||||
configure<JacocoTaskExtension> {
|
configure<JacocoTaskExtension> {
|
||||||
enabled = false
|
enabled = false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue