mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 21:32:35 +01:00
build.gradle: Add testOnJdk8 task (if Gradle > 6.7)
* testOnJdk8 is not run by default * If testJdk8 Gradle property is set, run testOnJdk8 as part of `check` * Set testJdk8 in gradle.yml Github Actions workflow
This commit is contained in:
parent
3f25626837
commit
bd6e1c6a09
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
||||
uses: gradle/gradle-build-action@v1
|
||||
with:
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
arguments: build --stacktrace
|
||||
arguments: -PtestJdk8=true build --stacktrace
|
||||
- name: Upload Test Results and Reports
|
||||
uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
|
@ -53,7 +53,7 @@ protobuf {
|
||||
generatedFilesBaseDir = new File(projectDir, '/src') // workaround for '$projectDir/src'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.withType(Test) {
|
||||
exclude 'org/bitcoinj/core/PeerTest*'
|
||||
exclude 'org/bitcoinj/core/TransactionBroadcastTest*'
|
||||
exclude 'org/bitcoinj/net/discovery/DnsDiscoveryTest*'
|
||||
@ -63,6 +63,33 @@ test {
|
||||
}
|
||||
}
|
||||
|
||||
// Test with default Java toolchain
|
||||
test {
|
||||
doFirst {
|
||||
logger.lifecycle("Testing with default toolchain")
|
||||
}
|
||||
}
|
||||
|
||||
def gradleVersionToolchains = GradleVersion.version("6.7")
|
||||
|
||||
if (GradleVersion.current().compareTo(gradleVersionToolchains) > 0) {
|
||||
// If the Gradle Java Toolchains feature is available, run tests on older JDKs
|
||||
System.err.println "Adding 'testOnJdk8' task, because ${GradleVersion.current()}"
|
||||
|
||||
task('testOnJdk8', type: Test) {
|
||||
doFirst {
|
||||
logger.lifecycle("Testing with JDK ${javaLauncher.get().metadata.javaRuntimeVersion}")
|
||||
}
|
||||
javaLauncher = javaToolchains.launcherFor {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
}
|
||||
// Activate if `testJdk8` is `true` in `gradle.properties` or `-PtestJdk8=true` is on command-line
|
||||
if (Boolean.valueOf(findProperty('testJdk8'))) {
|
||||
check.dependsOn testOnJdk8
|
||||
}
|
||||
}
|
||||
|
||||
ext.moduleName = 'org.bitcoinj.core'
|
||||
|
||||
jar {
|
||||
|
Loading…
Reference in New Issue
Block a user